I don't have much experience with linker scripts, so maybe I'm just misunderstanding something here. The LD linker script for the ATmega32u4 (avr5.x) specifies that data memory (SRAM) starts at 0x800060
. I know that 0x800000
is just a special offset that the compiler uses for SRAM pointers, but why use 0x60
as the base of RAM? The ATmega32u4 datasheet shows that 0x60
is the start of external I/O registers and that SRAM actually starts at 0x100
. Doesn't that mean the external I/O registers will be clobbered when the .data
section is copied into SRAM?
Asked
Active
Viewed 390 times
0

David Brown
- 35,411
- 11
- 83
- 132
1 Answers
0
Apparently, this is something GCC accounts for if you invoke avr-ld
through it. GCC overrides the virtual address of the .data
section depending on what you passed to -mmcu=
. If you link with avr-ld
directly, the .data
section is at the default 0x800060
.

David Brown
- 35,411
- 11
- 83
- 132