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
- TAGS
- linker
- scripts
- atmel
- www.atmel.com
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
6.1.2 Related examples in <str<strong>on</strong>g>the</str<strong>on</strong>g> software framework<br />
32158A-<strong>AVR</strong>-01/11<br />
<str<strong>on</strong>g><strong>AVR</strong>32795</str<strong>on</strong>g><br />
• drivers/flashc/flash_example/: C<strong>on</strong>trolling <str<strong>on</strong>g>the</str<strong>on</strong>g> locati<strong>on</strong> of a variable in flash<br />
• drivers/cpu/mpu/example/: C<strong>on</strong>trolling <str<strong>on</strong>g>the</str<strong>on</strong>g> locati<strong>on</strong> of a functi<strong>on</strong> in flash<br />
6.2 C<strong>on</strong>trolling <str<strong>on</strong>g>the</str<strong>on</strong>g> locati<strong>on</strong> of functi<strong>on</strong>s in internal RAM<br />
6.2.1 Process flow<br />
6.2.2 Related examples<br />
A. Define a custom output secti<strong>on</strong>, .ram_fcts, with VMA in RAM and LMA in flash:<br />
.ram_fcts :<br />
{<br />
*(.ram_fcts.*)<br />
} >INTRAM AT>FLASH :FLASH<br />
B. Locate a functi<strong>on</strong> in a custom secti<strong>on</strong>, .ram_fcts:<br />
� Extensi<strong>on</strong>s to <str<strong>on</strong>g>the</str<strong>on</strong>g> C language family:<br />
o Declaring attributes of functi<strong>on</strong>s<br />
Include all input secti<strong>on</strong>s .ram_fcts<br />
Assign a secti<strong>on</strong> to a previously defined segment<br />
(cf PHDRS command)<br />
Specify a memory regi<strong>on</strong> for <str<strong>on</strong>g>the</str<strong>on</strong>g> .text secti<strong>on</strong> LMA<br />
Assign this secti<strong>on</strong>’s VMA to <str<strong>on</strong>g>the</str<strong>on</strong>g> INTRAM regi<strong>on</strong> of memory<br />
(defined in MEMORY{ })<br />
__attribute__ ((__secti<strong>on</strong>__(".ram_fcts"))) void Func(void) {…}<br />
C. The startup routine is resp<strong>on</strong>sible for copying <str<strong>on</strong>g>the</str<strong>on</strong>g> .ram_fcts LMA (in flash) to <str<strong>on</strong>g>the</str<strong>on</strong>g><br />
.ram_fcts VMA (in INTRAM), as is d<strong>on</strong>e for <str<strong>on</strong>g>the</str<strong>on</strong>g> .data secti<strong>on</strong>.<br />
Examples of a startup routine implementati<strong>on</strong> can be found in <str<strong>on</strong>g>the</str<strong>on</strong>g> <strong>AVR</strong> Software<br />
Framework under utils/startup_files/gcc/ in ASF v1 and under<br />
utils/startup/startup_uc3.S in ASF v2.<br />
An example using <str<strong>on</strong>g>the</str<strong>on</strong>g> same method can be found here:<br />
<strong>AVR</strong>32749 Applicati<strong>on</strong> note: Software Workaround Implementati<strong>on</strong> for <str<strong>on</strong>g>the</str<strong>on</strong>g> Erratum<br />
Flash Read-after-Write for AT32<strong>UC3</strong>A0512 / AT32<strong>UC3</strong>A1512 Revisi<strong>on</strong> E, H and I.<br />
11