I have some initialized variables that I want to place in a special area
of RAM. I want the initialized values stored in ROM after the load area
for .ramcode. Like this:
1 | . = ALIGN(4);
|
2 | _ramcodeload = .; /* at this point "dot" is still in ROM */
|
3 | .ramcode :
|
4 | {
|
5 | _ramcodestart = .;
|
6 | *(.ramcode);
|
7 | _ramcodeend = .;
|
8 | } > ram
|
9 |
|
10 | . = ALIGN(4);
|
11 | _where_am_i = .; /* Now in RAM. This is = _ramcodeend + alignment */
|
12 | /* ALIGN(4) only works on the "dot" location marker */
|
13 |
|
14 | _usbload = ( LOADADDR(.ramcode) + SIZEOF(.ramcode) );
|
15 | .usbram : AT ( _usbload ) /* I want _usbload aligned! */
|
16 | {
|
17 | _usbstart = .;
|
18 | *(.usbram)
|
19 | _usbend = .;
|
20 | } > usbram
|
But the end of .ramcode stored in ROM may not be aligned. How I do I
force the linker to align where the initialized values for the .usbram
section are to be stored in ROM?