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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

0x00000200 0x00000004 Code RO 5 sec5 sections.o<br />

0x00000204 0x00000004 Code RO 6 sec6 sections.o<br />

8.14.2 Example for worst_fit<br />

In this example:<br />

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

• For first_fit <strong>the</strong> linker first assigns all <strong>the</strong> sections it can to ER_1, <strong>the</strong>n moves on to ER_2<br />

because that is <strong>the</strong> next available region.<br />

• For next_fit <strong>the</strong> linker does <strong>the</strong> same as first_fit. However, when ER_1 is full it is<br />

marked as FULL and is not considered again. In this example, ER_1 is completely full. ER_2<br />

is <strong>the</strong>n considered.<br />

• For best_fit <strong>the</strong> linker assigns sec1 to ER_1. It <strong>the</strong>n has two regions of equal priority and<br />

specificity, but ER_1 has less space remaining. Therefore, <strong>the</strong> linker assigns sec2 to ER_1,<br />

and continues assigning sections until ER_1 is full.<br />

This example shows <strong>the</strong> image memory map when using <strong>the</strong> worst_fit algorithm.<br />

Execution Region ER_1 (Base: 0x00000100, Size: 0x0000000c, Max: 0x00000010, ABSOLUTE)<br />

Base Addr Size Type Attr Idx E Section Name Object<br />

0x00000100 0x00000004 Code RO 1 sec1 sections.o<br />

0x00000104 0x00000004 Code RO 3 sec3 sections.o<br />

0x00000108 0x00000004 Code RO 5 sec5 sections.o<br />

Execution Region ER_2 (Base: 0x00000200, Size: 0x0000000c, Max: 0x00000010, ABSOLUTE)<br />

Base Addr Size Type Attr Idx E Section Name Object<br />

0x00000200 0x00000004 Code RO 2 sec2 sections.o<br />

0x00000204 0x00000004 Code RO 4 sec4 sections.o<br />

0x00000208 0x00000004 Code RO 6 sec6 sections.o<br />

8.14.3 See also<br />

The linker first assigns sec1 to ER_1. It <strong>the</strong>n has two equally specific and priority regions. It<br />

assigns sec2 to <strong>the</strong> one with <strong>the</strong> most free space, ER_2 in this example. The regions now have <strong>the</strong><br />

same amount of space remaining, so <strong>the</strong> linker assigns sec3 to <strong>the</strong> first one that appears in <strong>the</strong><br />

scatter file, that is ER_1.<br />

Note<br />

The behavior of worst_fit is <strong>the</strong> default behavior in this version of <strong>the</strong> linker, and it is <strong>the</strong> only<br />

algorithm available and earlier linker versions.<br />

Concepts<br />

• Placing unassigned sections with <strong>the</strong> .ANY module selector on page 8-25<br />

• Example of next_fit algorithm showing behavior of full regions, selectors, and priority on<br />

page 8-30.<br />

Reference<br />

<strong>Linker</strong> Reference:<br />

• --any_placement=algorithm on page 2-9<br />

• --scatter=file on page 2-142.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!