Erez D wrote:
Okay. I'm going to assume that you are writing code that is meant
to run directly on the hardware, no external OS. Also, I'm
assuming you have a means to actually load that code into the
CPU's address space (nor flash, loader, etc.)
correct
If those assumptions are true, and you are working with a GNU
toolchain (or derivative), then you, most likely, have a linker
control file (also known as a "linker script"). If you are not
sure, search for an invocation of the linker phase with the -T or
--script options.
nope
i compile with:
avr32-g++ -O0 -g3 -Wall -c -fmessage-length=0 -mpart=uc3l064
-ffunction-sections -masm-addr-pseudos -oDebug\main.o main.cpp
avr32-g++ -O0 -g3 -Wall -c -fmessage-length=0 -mpart=uc3l064
-ffunction-sections -masm-addr-pseudos -oDebug\uart.o uart.cpp
avr32-g++ -mpart=uc3l064 -Wl,--gc-sections -Wl,--direct-data
--rodata-writable -Wl,-Map,Debug\main.map -oDebug\proj3.elf
Debug\main.o Debug\uart.o
I saw on the internet that i should modify the crt0.S file to call my
initialization function
however i can not find the crt0.S file it uses. probably already
compiled.
s/probably/definitely/
You have two options. The more "correct" way is to, indeed, change the C
RunTime file. The file is probably available in object form, and you can
detect which one by checking what is the command line that avr-g++
passes to avr-ld when it calls it. I am almost positive that there is a
command line to see that, but I usually find it easier to use 'strace -f
-e execve'.
Then again, if, for whatever reason, you do not wish to tear apart the
internal libraries used, you can also go by my original proposed route.
The implicit linker script can be extracted by running avr-ld --verbose.
You can copy it out into a file, and modify it from there.
Personally, which way I'd go depends on how frequent this change you
need to do is. If you are working on a custom hw platform, where you are
expected to compile many programs for that platform, and that platform
alone, I might prefer getting the sources to crt and making the change
there. If you have several AVR platforms using the same toolchain, but
only some of them need these registers, then I'd go the linker script
path, as they do not require you to change the toolchain's files.
Might I ask why you cannot init these hardware registers as the first
thing that your actual program does? Does the startup code not run
without this init?
Shachar
--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com
_______________________________________________
Linux-il mailing list
[email protected]
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il