Keil Logo Arm Logo

Technical Support

On-Line Manuals

Linker User Guide

Conventions and feedback Overview of the linker Linking models supported by armlink Image structure and generation Using linker optimizations Getting information about images Accessing and managing symbols with armlink Using scatter files About scatter-loading When to use scatter-loading Scatter-loading command-line option Images with a simple memory map Images with a complex memory map Linker-defined symbols that are not defined when s Specifying stack and heap using the scatter file What is a root region? Creating root execution regions Using the FIXED attribute to create root regions Placing functions and data at specific addresses Placing a named section explicitly using scatter-l Placing unassigned sections with the .ANY module s Examples of using placement algorithms for .ANY se Example of next_fit algorithm showing behavior of Examples of using sorting algorithms for .ANY sect Selecting veneer input sections in scatter-loading Using __attribute__((section("name"))) t Using __at sections to place sections at a specifi Restrictions on placing __at sections Automatic placement of __at sections Manual placement of __at sections Placing a key in flash memory using __at Placing a structure over a peripheral register usi Placement of sections with overlays About placing ARM C and C++ library code Example of placing code in a root region Example of placing ARM C library code Example of placing ARM C++ library code Example of placing ARM library helper functions Reserving an empty region About creating regions on page boundaries Overalignment of execution regions and input secti Using preprocessing commands in a scatter file Expression evaluation in scatter files Using expression evaluation in a scatter file to a Equivalent scatter-loading descriptions for simple Type 1 image, one load region and contiguous execu Type 2 image, one load region and non-contiguous e Type 3 image, two load regions and non-contiguous Scatter file to ELF mapping

Linker User Guide

Creating root execution regions

Creating root execution regions

To specify a region as a root region in a scatter file you can:

  • Specify ABSOLUTE as the attribute for the execution region, either explicitly or by permitting it to default, and use the same address for the first execution region and the enclosing load region. To make the execution region address the same as the load region address, either:

    • Specify the same numeric value for both the base address for the execution region and the base address for the load region.

    • Specify a +0 offset for the first execution region in the load region.

      If an offset of zero (+0) is specified for all subsequent execution regions in the load region, then all execution regions not following an execution region containing ZI are also root regions.

    The following example shows an implicitly defined root region:

    Example 13. Implicit root region with the same load and execution address

    LR_1 0x040000          ; load region starts at 0x40000   
    {                      ; start of execution region descriptions	      
        ER_RO 0x040000     ; load address = execution address
        {
            * (+RO)        ; all RO sections (must include section with 
                           ; initial entry point)
        }
        ...                ; rest of scatter-loading description
    }
    

  • Use the FIXED execution region attribute to ensure that the load address and execution address of a specific region are the same.

    You can use the FIXED attribute to place any execution region at a specific address in ROM.

    For example, the following memory map shows fixed execution regions:

    Figure 8. Memory map for fixed execution regions


    The following example shows the corresponding scatter-loading description:

    Example 14. Using the FIXED attribute

    LR_1 0x040000              ; load region starts at 0x40000   
    {                          ; start of execution region descriptions	      
        ER_RO 0x040000         ; load address = execution address
        {
            * (+RO)            ; RO sections other than those in init.o
        }
        ER_INIT 0x080000 FIXED ; load address and execution address of this
                               ; execution region are fixed at 0x80000
        {
            init.o(+RO)        ; all RO sections from init.o
        }
        ...                    ; rest of scatter-loading description
    }
    

Show/hideExamples of misusing the FIXED attribute

The following example shows common cases where the FIXED execution region attribute is misused:

Example 15. Misuse of the FIXED attribute

LR1 0x8000
{
    ER_LOW +0 0x1000
    {
        *(+RO)
    }
; At this point the next available Load and Execution address is 0x8000 + size of
; contents of ER_LOW. The maximum size is limited to 0x1000 so the next available Load
; and Execution address is at most 0x9000
    ER_HIGH 0xF0000000 FIXED
    {
        *(+RW+ZI)
    }
; The required execution address and load address is 0xF0000000. The linker inserts
; 0xF0000000 - (0x8000 + size of(ER_LOW)) bytes of padding so that load address matches
; execution address
}

; The other common misuse of FIXED is to give a lower execution address than the next
; available load address.

LR_HIGH 0x100000000
{
    ER_LOW 0x1000 FIXED
    {
        *(+RO)
    }
; The next available load address in LR_HIGH is 0x10000000. The required Execution
; address is 0x1000. Because the next available load address in LR_HIGH must increase
; monotonically the linker cannot give ER_LOW a Load Address lower than 0x10000000
}

Copyright © 2007-2008, 2011-2012 ARM. All rights reserved.ARM DUI 0377D
Non-ConfidentialID062912

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.