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.31 Reserving an empty region<br />

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

You can use <strong>the</strong> EMPTY attribute in an execution region scatter-loading description to reserve an<br />

empty block of memory for <strong>the</strong> stack.<br />

The block of memory does not form part of <strong>the</strong> load region, but is assigned for use at execution<br />

time. Because it is created as a dummy ZI region, <strong>the</strong> linker uses <strong>the</strong> following symbols to access<br />

it:<br />

• Image$$region_name$$ZI$$Base<br />

• Image$$region_name$$ZI$$Limit<br />

• Image$$region_name$$ZI$$Length.<br />

If <strong>the</strong> length is given as a negative value, <strong>the</strong> address is taken to be <strong>the</strong> end address of <strong>the</strong> region.<br />

This must be an absolute address and not a relative one.<br />

In <strong>the</strong> following example, <strong>the</strong> execution region definition STACK 0x800000 EMPTY –0x10000<br />

defines a region called STACK that starts at address 0x7F0000 and ends at address 0x800000:<br />

Example 8-20 Reserving a region for <strong>the</strong> stack<br />

LR_1 0x80000 ; load region starts at 0x80000<br />

{<br />

STACK 0x800000 EMPTY -0x10000 ; region ends at 0x800000 because of <strong>the</strong><br />

; negative length. The start of <strong>the</strong> region<br />

; is calculated using <strong>the</strong> length.<br />

{<br />

; Empty region used to place stack<br />

}<br />

HEAP +0 EMPTY 0x10000 ; region starts at <strong>the</strong> end of previous<br />

; region. End of region calculated using<br />

; positive length<br />

{<br />

; Empty region used to place heap<br />

}<br />

... ; rest of scatter-loading description...<br />

}<br />

Note<br />

The dummy ZI region that is created for an EMPTY execution region is not initialized to zero at<br />

runtime.<br />

If <strong>the</strong> address is in relative (+offset) form and <strong>the</strong> length is negative, <strong>the</strong> linker generates an<br />

error.<br />

The following figure shows a diagrammatic representation for this example.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!