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.

4.4 Methods of specifying an image memory map with <strong>the</strong> linker<br />

Image structure and generation<br />

An image can consist of any number of regions and output sections. Regions can have different<br />

load and execution addresses. To construct <strong>the</strong> memory map of an image, armlink must have<br />

information about:<br />

• how input sections are grouped into output sections and regions<br />

• where regions are to be located in <strong>the</strong> memory maps.<br />

Depending on <strong>the</strong> complexity of <strong>the</strong> memory maps of <strong>the</strong> image, <strong>the</strong>re are two ways to pass this<br />

information to armlink:<br />

<strong>Using</strong> command-line options<br />

The following options can be used for simple cases where an image has only one<br />

or two load regions and up to three execution regions:<br />

• --first<br />

• --last<br />

• --ro_base<br />

• --rw_base<br />

• --ropi<br />

• --rwpi<br />

• --split<br />

• --rosplit<br />

• --zi_base.<br />

These options provide a simplified notation that gives <strong>the</strong> same settings as a<br />

scatter-loading description for a simple image.<br />

<strong>Using</strong> a scatter file<br />

A scatter file is a textual description of <strong>the</strong> memory layout and code and data<br />

placement. It is used for more complex cases where you require complete control<br />

over <strong>the</strong> grouping and placement of image components. To use a scatter file,<br />

specify --scatter=filename at <strong>the</strong> command-line.<br />

Note<br />

You cannot use --scatter with <strong>the</strong> o<strong>the</strong>r memory map related command-line options.<br />

Table 4-2 Comparison of scatter file and equivalent command-line options<br />

Scatter file Equivalent command-line options<br />

LR1 0x0000 0x20000<br />

{<br />

ER1 0x0 0x2000<br />

{<br />

init.o (INIT, +FIRST)<br />

*(+RO)<br />

}<br />

RAM 0x400000<br />

{<br />

*(+RW)<br />

}<br />

RAM 0x405000<br />

{<br />

*(+ZI)<br />

}<br />

}<br />

--ro_base=0x0<br />

--first=init.o(init)<br />

--rw_base=0x400000<br />

--zi_base=0x405000<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!