https://sourceware.org/bugzilla/show_bug.cgi?id=12757
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gjl at gcc dot gnu.org
Status|NEW |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Thibault North from comment #0)
> MMCU: at90usb646
> [...]
> It was reported that SRAM start offset seems to be
> incorrect (0x60 in the new and 0x100 in the older version).
Binutils have only an arch specific SRAM start that may be incorrect for some
devices in that arch.
The correct SRAM start address is provided by AVR-LibC's startup code. Search
for REGION in:
https://github.com/avrdudes/avr-libc/blob/main/crt1/gcrt1.S
The compiler sets -Tdata when it invokes the linker and when the value doesn't
match the arch default.
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/avr/gen-avr-mmcu-specs.cc;h=470d40538e536bebb2cd3d28dbac04efc704c523;hb=HEAD#l368
This happens qua device-specs files shipped with the compiler.
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/avr/avr-mcus.def;h=de48396e12d8e69c2143913c1b62b1c75c3983fc;hb=HEAD#l273
int x = 123;
int main () {
return x;
}
$ avr-gcc x.c -o x.elf -Os -mmcu=at90usb646 && avr-objdump -h x.elf | grep -B1
data
Idx Name Size VMA LMA File off Algn
0 .data 00000002 00800100 000000d4 00000148 2**0
So SRAM starts at 0x100.
On newer versons of Binutlis, the start of the RAM memory area can be adjusted
at link time, for example the following invocation lets RAM start at 0x70:
$ avr-gcc x.c -o x.elf -Os -mmcu=at90usb646
-Wl,--defsym,__DATA_REGION_ORIGIN__=0x800070 -Tdata=0x800070 && avr-objdump -h
x.elf | grep -B1 data
Idx Name Size VMA LMA File off Algn
0 .data 00000002 00800070 000000d4 00000148 2**0
This may be needed when you don't use the startup code from AVR-LibC.
--
You are receiving this mail because:
You are on the CC list for the bug.