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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8.35 Expression evaluation in scatter files<br />

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

The linker can carry out simple expression evaluation with a restricted set of operators, The<br />

operators are +, -, *, /, AND, OR, and paren<strong>the</strong>ses. The implementation of OR and AND follows C<br />

operator precedence rules.<br />

8.35.1 Example of using expression evaluation<br />

8.35.2 See also<br />

Use <strong>the</strong> directives:<br />

#define BASE_ADDRESS 0x8000<br />

#define ALIAS_NUMBER 0x2<br />

#define ALIAS_SIZE 0x400<br />

#define AN_ADDRESS (BASE_ADDRESS+(ALIAS_NUMBER*ALIAS_SIZE))<br />

The scatter file might contain:<br />

LOAD_FLASH AN_ADDRESS ; start address<br />

After preprocessing, this evaluates to:<br />

LOAD_FLASH ( 0x8000 + ( 0x2 * 0x400 )) ; start address<br />

After evaluation, <strong>the</strong> linker parses <strong>the</strong> scatter file to produce <strong>the</strong> load region:<br />

LOAD_FLASH 0x8800 ; start address<br />

Concepts<br />

• <strong>Using</strong> preprocessing commands in a scatter file on page 8-57<br />

• <strong>Using</strong> expression evaluation in a scatter file to avoid padding on page 8-59.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!