Keil Logo Arm Logo

Technical Support

On-Line Manuals

Linker Reference Guide

Conventions and feedback Linker command-line options Linker steering file command reference Formal syntax of the scatter file BNF notation used in scatter-loading description s Syntax of a scatter file About load region descriptions Syntax of a load region description Load region attributes About execution region descriptions Syntax of an execution region description Execution region attributes Address attributes for load and execution regions Considerations when using a relative address +offs Considerations when using a relative address +offs Inheritance rules for load region address attribut Inheritance rules for execution region address att Inheritance rules for the RELOC address attribute About input section descriptions Syntax of an input section description How the linker resolves multiple matches when proc Behavior when .ANY sections overflow because of li How the linker resolves path names when processing About Expression evaluation in scatter files Expression usage in scatter files Expression rules in scatter files Execution address built-in functions for use in sc Scatter files containing relative base address loa ScatterAssert function and load address related fu Symbol related function in a scatter file Example of aligning a base address in execution sp AlignExpr(expr, align) function GetPageSize() function SizeOfHeaders() function

Linker Reference Guide

Execution address built-in functions for use in scatter files

Execution address built-in functions for use in scatter files

The execution address related functions can only be used when specifying a base_address, +offset value, or max_size. They map to combinations of the linker defined symbols shown in Table 3.

Table 3. Execution address related functions 

FunctionLinker defined symbol value
ImageBase(region_name)
Image$$region_name$$Base
ImageLength(region_name)
Image$$region_name$$Length + Image$$region_name$$ZI$$Length
ImageLimit(region_name)
Image$$region_name$$Base + Image$$region_name$$Length + Image$$region_name$$ZI$$Length

The parameter region_name  can be either a load or an execution region name. Forward references are not permitted. The region_name can only refer to load or execution regions that have already been defined.

Note

You cannot use these functions when using the .ANY selector pattern. This is because a .ANY region uses the maximum size when assigning sections. The maximum size might not be available at that point, because the size of all regions is not known until after the .ANY assignment.

The following example shows how to use ImageLimit(region_name) to place one execution region immediately after another:

Example 10. Placing an execution region after another

LR1 0x8000
{
    ER1 0x100000
    {
        *(+RO)
    }
}
LR2 0x100000
{
    ER2 (ImageLimit(ER1))               ; Place ER2 after ER1 has finished
    {
        *(+RW +ZI)
    }
}

Show/hideUsing +offset with expressions

A +offset value for an execution region is defined in terms of the previous region. You can use this as an input to other expressions such as AlignExpr. For example:

LR1 0x4000
{
    ER1 AlignExpr(+0, 0x8000)
    {
        ...
    }
}

By using AlignExpr, the result of +0 is aligned to a 0x8000 boundary. This creates an execution region with a load address of 0x4000 but an execution address of 0x8000.

Copyright © 2008, 2011-2012 ARM. All rights reserved.ARM DUI 0458C
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.