Keil Logo

Technical Support

On-Line Manuals

Linker User Guide

Preface Overview of the Linker Linking Models Supported by armlink Image Structure and Generation Linker Optimization Features Getting Image Details Accessing and Managing Symbols with armlink Scatter-loading Features Scatter File Syntax BNF notation used in scatter-loading description s Syntax of a scatter file Load region descriptions Components of a load region description Syntax of a load region description Load region attributes Inheritance rules for load region address attribut Inheritance rules for the RELOC address attribute Considerations when using a relative address +offs Execution region descriptions Components of an execution region description Syntax of an execution region description Execution region attributes Inheritance rules for execution region address att Considerations when using a relative address +offs Input section descriptions Components of an input section description Syntax of an input section description Examples of module and input section specification Expression evaluation in scatter files Expression usage in scatter files Expression rules in scatter files Execution address built-in functions for use in sc ScatterAssert function and load address related fu Symbol related function in a scatter file AlignExpr(expr, align) function GetPageSize() function SizeOfHeaders() function Example of aligning a base address in execution sp Scatter files containing relative base address loa Linker Command-line Options Linker Steering File Command Reference Via File Syntax

ScatterAssert function and load address related functions

8.6.4 ScatterAssert function and load address related functions

The ScatterAssert function allows you to perform more complex size checks than those permitted by the max_size attribute.

The ScatterAssert(expression) function can be used at the top level, or within a load region. It is evaluated after the link has completed and gives an error message if expression evaluates to false.
The load address related functions can only be used within the ScatterAssert function. They map to the three linker defined symbol values:

Table 8-3 Load address related functions

Function Linker defined symbol value
LoadBase(region_name)
Load$$region_name$$Base
LoadLength(region_name)
Load$$region_name$$Length
LoadLimit(region_name)
Load$$region_name$$Limit
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.
The following example shows how to use the ScatterAssert function to write more complex size checks than those permitted by the max_size attribute of the region:
LR1 0x8000
{
    ER0 +0
    {
        *(+RO)
    }
    ER1 +0
    {
        file1.o(+RW)
    }
    ER2 +0
    {
        file2.o(+RW)
    }
    ScatterAssert((LoadLength(ER1) + LoadLength(ER2)) < 0x1000)
                                         ; LoadLength is compressed size
    ScatterAssert((ImageLength(ER1) + ImageLength(ER2)) < 0x2000)
                                         ; ImageLength is uncompressed size
}
ScatterAssert(ImageLength(LR1) < 0x3000) 
                                         ; Check uncompressed size of load region LR1
Non-ConfidentialPDF file icon PDF versionARM DUI0377H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 

Related Knowledgebase Articles

  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.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.