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.13 Placing unassigned sections with <strong>the</strong> .ANY module selector<br />
<strong>Using</strong> scatter files<br />
The linker attempts to place input sections into specific execution regions. For any input<br />
sections that cannot be resolved, and when <strong>the</strong> placement of those sections is not important, you<br />
can use <strong>the</strong> .ANY module selector in <strong>the</strong> scatter file.<br />
In most cases, using a single .ANY selector is equivalent to using <strong>the</strong> * module selector. However,<br />
unlike *, you can specify .ANY in multiple execution regions.<br />
8.13.1 Default rules for placing unassigned sections<br />
By default, <strong>the</strong> linker places unassigned sections using <strong>the</strong> following criteria:<br />
• Place an unassigned section in <strong>the</strong> execution region that currently has <strong>the</strong> most free space.<br />
You can specify a maximum amount of space to use for unassigned sections with <strong>the</strong><br />
exection region attribute ANY_SIZE.<br />
• Sort sections in descending size order.<br />
8.13.2 Placement rules when using multiple .ANY selectors<br />
If more than one .ANY selector is present in a scatter file, <strong>the</strong> linker takes <strong>the</strong> unassigned section<br />
with <strong>the</strong> largest size and assigns <strong>the</strong> section to <strong>the</strong> most specific .ANY execution region that has<br />
enough free space. For example, .ANY(.text) is judged to be more specific than .ANY(+RO).<br />
If several execution regions are equally specific, <strong>the</strong>n <strong>the</strong> section is assigned to <strong>the</strong> execution<br />
region with <strong>the</strong> most available remaining space.<br />
For example:<br />
8.13.3 Prioritizing .ANY sections<br />
• If you have two equally specific execution regions where one has a size limit of 0x2000<br />
and <strong>the</strong> o<strong>the</strong>r has no limit, <strong>the</strong>n all <strong>the</strong> sections are assigned to <strong>the</strong> second unbounded .ANY<br />
region.<br />
• If you have two equally specific execution regions where one has a size limit of 0x2000<br />
and <strong>the</strong> o<strong>the</strong>r has a size limit of 0x3000, <strong>the</strong>n <strong>the</strong> first sections to be placed are assigned to<br />
<strong>the</strong> second .ANY region of size limit 0x3000 until <strong>the</strong> remaining size of <strong>the</strong> second .ANY is<br />
reduced to 0x2000. From this point, sections are assigned alternately between both .ANY<br />
execution regions.<br />
You can give a priority ordering if you have multiple .ANY sections with <strong>the</strong> .ANYnum selector,<br />
where num is a positive integer from zero upwards. The highest priority is given to <strong>the</strong> selector<br />
with <strong>the</strong> highest integer.<br />
The following example shows how to use .ANYnum:<br />
lr1 0x8000 1024<br />
{<br />
er1 +0 512<br />
{<br />
.ANY1(+RO) ; evenly distributed with er3<br />
}<br />
er2 +0 256<br />
{<br />
.ANY2(+RO) ; Highest priority, so filled first<br />
}<br />
er3 +0 256<br />
{<br />
<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 8-25<br />
ID080411 Non-Confidential