06.02.2013 Views

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

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.21 Automatic placement of __at sections<br />

<strong>Using</strong> scatter files<br />

The automatic placement of __at sections is enabled by default. This feature is controlled by <strong>the</strong><br />

linker command-line option, --autoat.<br />

Note<br />

You cannot use __at section placement with position independent execution regions.<br />

When linking with <strong>the</strong> --autoat option, <strong>the</strong> __at sections are not placed by <strong>the</strong> scatter-loading<br />

selectors. Instead, <strong>the</strong> linker places <strong>the</strong> __at section in a compatible region. If no compatible<br />

region is found, <strong>the</strong> linker creates a load and execution region for <strong>the</strong> __at section.<br />

All linker --autoat created execution regions have <strong>the</strong> UNINIT scatter-loading attribute. If you<br />

require a ZI __at section to be zero-initialized <strong>the</strong>n it must be placed within a compatible region.<br />

A linker --autoat created execution region must have a base address that is at least 4<br />

byte-aligned. The linker produces an error message if any region is incorrectly aligned.<br />

A compatible region is one where:<br />

• The __at address lies within <strong>the</strong> execution region base and limit, where limit is <strong>the</strong> base<br />

address + maximum size of execution region. If no maximum size is set, <strong>the</strong> linker sets<br />

<strong>the</strong> limit for placing __at sections as <strong>the</strong> current size of <strong>the</strong> execution region without __at<br />

sections plus a constant, 10240 bytes.<br />

• The execution region meets at least one of <strong>the</strong> following conditions:<br />

— it has a selector that matches <strong>the</strong> __at section by <strong>the</strong> standard scatter-loading rules<br />

— it has at least one section of <strong>the</strong> same type (RO, RW or ZI) as <strong>the</strong> __at section<br />

— it does not have <strong>the</strong> EMPTY attribute.<br />

Note<br />

The linker considers an __at section with type RW compatible with RO.<br />

The following example shows <strong>the</strong> sections .<strong>ARM</strong>.__at_0x0 type RO, .<strong>ARM</strong>.__at_0x2000 type RW,<br />

.<strong>ARM</strong>.__at_0x4000 type ZI, and .<strong>ARM</strong>.__at_0x8000 type ZI:<br />

Example 8-11 Automatic placement of __at sections<br />

LR1 0x0<br />

{<br />

ER_RO 0x0 0x2000<br />

{<br />

*(+RO) ; .<strong>ARM</strong>.__at_0x0 lies within <strong>the</strong> bounds of ER_RO<br />

}<br />

ER_RW 0x2000 0x2000<br />

{<br />

*(+RW) ; .<strong>ARM</strong>.__at_0x2000 lies within <strong>the</strong> bounds of ER_RW<br />

}<br />

ER_ZI 0x4000 0x2000<br />

{<br />

*(+ZI) ; .<strong>ARM</strong>.__at_0x4000 lies within <strong>the</strong> bounds of ER_ZI<br />

}<br />

}<br />

; <strong>the</strong> linker creates a load and execution region for <strong>the</strong> __at section<br />

; .<strong>ARM</strong>.__at_0x8000 because it lies outside all candidate regions.<br />

<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 8-39<br />

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!