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
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
8.25 Placement of sections with overlays<br />
<strong>Using</strong> scatter files<br />
You can use <strong>the</strong> OVERLAY attribute in a scatter file to place multiple execution regions at <strong>the</strong> same<br />
address. An overlay manager is required to make sure that only one execution region is<br />
instantiated at a time. The <strong>ARM</strong> <strong>Compiler</strong> <strong>toolchain</strong> does not provide an overlay manager.<br />
The following example shows <strong>the</strong> definition of a static section in RAM followed by a series of<br />
overlays. Here, only one of <strong>the</strong>se sections is instantiated at a time.<br />
Example 8-16 Specifying a root region<br />
EMB_APP 0x8000<br />
{<br />
.<br />
.<br />
STATIC_RAM 0x0 ; contains most of <strong>the</strong> RW and ZI code/data<br />
{<br />
* (+RW,+ZI)<br />
}<br />
OVERLAY_A_RAM 0x1000 OVERLAY ; start address of overlay...<br />
{<br />
module1.o (+RW,+ZI)<br />
}<br />
OVERLAY_B_RAM 0x1000 OVERLAY<br />
{<br />
module2.o (+RW,+ZI)<br />
}<br />
... ; rest of scatter-loading description...<br />
}<br />
A region marked as OVERLAY is not initialized by <strong>the</strong> C library at startup. The contents of <strong>the</strong><br />
memory used by <strong>the</strong> overlay region are <strong>the</strong> responsibility of an overlay manager. If <strong>the</strong> region<br />
contains initialized data, use <strong>the</strong> NOCOMPRESS attribute to prevent RW data compression.<br />
The linker defined symbols can be used to obtain <strong>the</strong> addresses required to copy <strong>the</strong> code and<br />
data.<br />
The OVERLAY attribute can be used on a single region that is not <strong>the</strong> same address as a different<br />
region. Therefore, an overlay region can be used as a method to prevent <strong>the</strong> initialization of<br />
particular regions by <strong>the</strong> C library startup code. As with any overlay region <strong>the</strong>se must be<br />
manually initialized in your code.<br />
An overlay region can have a relative base. The behavior of an overlay region with a +offset<br />
base address depends on <strong>the</strong> regions that precede it and <strong>the</strong> value of +offset. The linker places<br />
consecutive +offset regions at <strong>the</strong> same base address if <strong>the</strong>y have <strong>the</strong> same +offset value.<br />
When a +offset execution region ER follows a contiguous overlapping block of overlay<br />
execution regions <strong>the</strong> base address of ER is:<br />
limit address of <strong>the</strong> overlapping block of overlay execution regions + offset<br />
<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 8-44<br />
ID080411 Non-Confidential