Guest
#1172463
Hello,
Has anyone found a need to modify the linker scripts for the AT91SAM7 to
carve off some internal flash variable space?
I'm working with a AT91SAM7S256 and would LIKE to shave off the top 1k
to store variables but am having trouble getting it to work right.
Details: using WinARM w/ gcc 4.1.1
I have the linker scripts from Martin Thomas' gamma example (last
updated on 2-Sept-06. In my AT91SAM7S256_memory.ldh file I modified it
as follows:
From:
MEMORY
{
CODE (rx) : ORIGIN = 0x00100000, LENGTH = 256k
DATA (rwx) : ORIGIN = 0x00200000, LENGTH = 64k
}
To:
MEMORY
{
CODE (rx) : ORIGIN = 0x00100000, LENGTH = 255k
DATA (rwx) : ORIGIN = 0x00200000, LENGTH = 64k
VARS (rx) : ORIGIN = 0x0013FC00, LENGTH = 1k
}
And declared a variable as:
const unsigned int checker _attribute_ ((section ("VARS"))) = 0xF;
When the linker runs and it reports the following:
Size after:
main.tmp.elf :
section size addr
.text 53444 1048576
VARS 4 1102020
.data 2928 2097152
.noinit 12 2100080
.bss 3328 2100092
.comment 1512 0
Total 61228
So it looks like the variable is in the "VARS" section but the address
doesn't make sense. It is in the "CODE" section a.k.a. addr:
0x0010D0C4.
I'm guessing I have to modify the AT91SAM7S_sections_ROM.ldh file to
accomodate this change but that file just looks scary.
Has anyone done something similar and got it to work out?
Thanks in advance for any help!