ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
8.19 <strong>Using</strong> __at sections to place sections at a specific address<br />
8.19.1 See also<br />
<strong>Using</strong> scatter files<br />
You can give a section a special name that encodes <strong>the</strong> address where it must be placed. You<br />
specify <strong>the</strong> name as follows:<br />
.<strong>ARM</strong>.__at_address<br />
Where:<br />
address is <strong>the</strong> required address of <strong>the</strong> section. You can specify this in hexadecimal or<br />
decimal. Sections in <strong>the</strong> form of .<strong>ARM</strong>.__at_address are referred to by <strong>the</strong><br />
abbreviation __at.<br />
In <strong>the</strong> compiler, you can assign variables to __at sections by:<br />
• explicitly naming <strong>the</strong> section using <strong>the</strong> __attribute__((section(”name”)))<br />
• using <strong>the</strong> attribute __at that sets up <strong>the</strong> name of <strong>the</strong> section for you.<br />
; place variable1 in a section called .<strong>ARM</strong>.__at_0x00008000<br />
int variable1 __attribute__((at(0x8000))) = 10;<br />
Example 8-10 Assigning variables to __at sections<br />
; place variable2 in a section called .<strong>ARM</strong>.__at_0x8000<br />
int variable2 __attribute__((section(".<strong>ARM</strong>.__at_0x8000"))) = 10;<br />
Note<br />
When using __attribute__((at(address))), <strong>the</strong> part of <strong>the</strong> __at section name representing<br />
address is normalized to an 8 digit hexadecimal number. The name of <strong>the</strong> section is only<br />
significant if you are trying to match <strong>the</strong> section by name in a scatter file. The linker<br />
automatically assigns __at sections when you use <strong>the</strong> --autoat command-line option. This<br />
option is <strong>the</strong> default.<br />
Concepts<br />
• Placing functions and data at specific addresses on page 8-18<br />
• <strong>Using</strong> __attribute__((section("name"))) on page 8-35<br />
• Restrictions on placing __at sections on page 8-38<br />
• Automatic placement of __at sections on page 8-39<br />
• Manual placement of __at sections on page 8-41<br />
• Placing a key in flash memory using __at on page 8-42<br />
• Placing a structure over a peripheral register using __at on page 8-43.<br />
Reference<br />
<strong>Linker</strong> Reference:<br />
• --autoat, --no_autoat on page 2-17.<br />
<strong>Compiler</strong> Reference:<br />
• __attribute__((section("name"))) function attribute on page 5-53<br />
• __attribute__((at(address))) variable attribute on page 5-67<br />
• __attribute__((section("name"))) variable attribute on page 5-72.<br />
<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 8-37<br />
ID080411 Non-Confidential