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.36 <strong>Using</strong> expression evaluation in a scatter file to avoid padding<br />

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

<strong>Using</strong> <strong>the</strong> ALIGN, ALIGNALL, or FIXED attributes in a scatter file can result in a large amount of<br />

padding in <strong>the</strong> image. To remove this padding, you can use expression evaluation to specify <strong>the</strong><br />

start address of a load region and execution region. The built-in function AlignExpr is available<br />

to help you specify address expressions.<br />

8.36.1 Example to avoid padding in scatter file<br />

8.36.2 See also<br />

The following scatter file produces an image with padding:<br />

LR1 0x4000<br />

{<br />

ER1 +0 ALIGN 0x8000<br />

{<br />

...<br />

}<br />

}<br />

<strong>Using</strong> <strong>the</strong> ALIGN keyword ER1 is aligned to a 0x8000 boundary in both <strong>the</strong> load and <strong>the</strong> execution<br />

view. To align in <strong>the</strong> load view, <strong>the</strong> linker must insert 0x4000 bytes of padding.<br />

The following scatter file produces an image without padding:<br />

LR1 0x4000<br />

{<br />

ER1 AlignExpr(+0, 0x8000)<br />

{<br />

...<br />

}<br />

}<br />

<strong>Using</strong> AlignExpr <strong>the</strong> result of +0 is aligned to a 0x8000 boundary. This creates an execution region<br />

with a load address of 0x4000 but an Execution Address of 0x8000.<br />

Concepts<br />

• Expression evaluation in scatter files on page 8-58.<br />

<strong>Linker</strong> Reference:<br />

• Example of aligning a base address in execution space but still tightly packed in load<br />

space on page 4-41.<br />

Reference<br />

<strong>Linker</strong> Reference:<br />

• Execution region attributes on page 4-11<br />

• AlignExpr(expr, align) function on page 4-42.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!