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.4 Images with a simple memory map<br />

If an image has a simple memory map, you can ei<strong>the</strong>r:<br />

• use a scatter file<br />

• specify <strong>the</strong> memory map using basic linker command-line options.<br />

The following figure shows a simple memory map:<br />

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

Load view Execution view<br />

0x16000<br />

RW section<br />

RO section<br />

Figure 8-1 Simple scatter-loaded memory map<br />

The following example shows <strong>the</strong> corresponding scatter-loading description that loads <strong>the</strong><br />

segments from <strong>the</strong> object file into memory:<br />

Example 8-1 Simple memory map in a scatter file<br />

LOAD_ROM 0x0000 0x8000 ; Name of load region (LOAD_ROM),<br />

; Start address for load region (0x0000),<br />

; Maximum size of load region (0x8000)<br />

{<br />

EXEC_ROM 0x0000 0x8000 ; Name of first exec region (EXEC_ROM),<br />

; Start address for exec region (0x0000),<br />

; Maximum size of first exec region (0x8000)<br />

{<br />

* (+RO) ; Place all code and RO data into<br />

; this exec region<br />

}<br />

}<br />

Zero fill<br />

Copy / decompress<br />

SRAM 0x10000 0x6000 ; Name of second exec region (RAM),<br />

; Start address of second exec region (0x10000),<br />

; Maximum size of second exec region (0x6000)<br />

{<br />

* (+RW, +ZI) ; Place all RW and ZI data into<br />

; this exec region<br />

}<br />

The maximum size specifications for <strong>the</strong> regions are optional. However, if you include <strong>the</strong>m,<br />

<strong>the</strong>y enable <strong>the</strong> linker to check that a region does not overflow its boundary.<br />

In this example, you can achieve <strong>the</strong> same result, apart from <strong>the</strong> limit checking with <strong>the</strong><br />

following linker command-line:<br />

armlink --ro_base 0x0 --rw_base 0x10000<br />

ZI section<br />

RW section<br />

RO section<br />

0x8000<br />

0x0000<br />

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

ID080411 Non-Confidential<br />

SRAM<br />

0x10000<br />

ROM

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

Saved successfully!

Ooh no, something went wrong!