06.02.2013 Views

AVR32795: Using the GNU Linker Scripts on AVR UC3 ... - Atmel

AVR32795: Using the GNU Linker Scripts on AVR UC3 ... - Atmel

AVR32795: Using the GNU Linker Scripts on AVR UC3 ... - Atmel

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.3 C<strong>on</strong>trolling <str<strong>on</strong>g>the</str<strong>on</strong>g> locati<strong>on</strong> of variables and <str<strong>on</strong>g>the</str<strong>on</strong>g> heap in external SDRAM<br />

6.3.1 Process flow<br />

12 <str<strong>on</strong>g><strong>AVR</strong>32795</str<strong>on</strong>g><br />

A. <str<strong>on</strong>g>Linker</str<strong>on</strong>g> script customizati<strong>on</strong><br />

A.1. Adding <str<strong>on</strong>g>the</str<strong>on</strong>g> external SDRAM memory (MEMORY{})<br />

MEMORY<br />

{<br />

}<br />

FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x00040000<br />

INTRAM (wxa!ri) : ORIGIN = 0x00000004, LENGTH = 0x0000FFFC<br />

ERAM0 (wxa!ri) : ORIGIN = 0xFF000000, LENGTH = 0x00008000<br />

ERAM1 (wxa!ri) : ORIGIN = 0xFF008000, LENGTH = 0x00008000<br />

SDRAM (wxa!ri) : ORIGIN = 0xD0000000, LENGTH = 0x02000000<br />

USERPAGE : ORIGIN = 0x80800000, LENGTH = 0x00000200<br />

A.2. Adding <str<strong>on</strong>g>the</str<strong>on</strong>g> external SDRAM segments (PHDRS{})<br />

PHDRS<br />

{<br />

}<br />

FLASH PT_LOAD;<br />

INTRAM_ALIGN PT_NULL;<br />

INTRAM_AT_FLASH PT_LOAD;<br />

INTRAM PT_NULL;<br />

SDRAM_AT_FLASH PT_LOAD;<br />

SDRAM PT_NULL;<br />

USERPAGE PT_LOAD;<br />

A.3. Defining two output secti<strong>on</strong>s for variables placed in external SDRAM<br />

(.data_sdram, .bss_sdram)<br />

. = ORIGIN(SDRAM);<br />

.data_sdram ORIGIN(SDRAM) :<br />

{<br />

PROVIDE(_data_sdram = .);<br />

*(.data_sdram)<br />

. = ALIGN(8);<br />

PROVIDE(_edata_sdram = .);<br />

} >SDRAM AT>FLASH :SDRAM_AT_FLASH<br />

Set <str<strong>on</strong>g>the</str<strong>on</strong>g> locati<strong>on</strong> counter to SDRAM start address<br />

Set <str<strong>on</strong>g>the</str<strong>on</strong>g> VMA of .data sdram<br />

Will be used by <str<strong>on</strong>g>the</str<strong>on</strong>g> startup routine for data init<br />

32158A-<strong>AVR</strong>-01/11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!