8.6.6 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
Related concepts
8.6.1 Methods of specifying numeric constants for expression evaluation
8.6.3 Expression usage in scatter files
8.6.4 Expression rules in scatter files
8.6.5 Execution address built-in functions for use in scatter files
8.6.7 Symbol related function in a scatter file
8.6.11 Example of aligning a base address in execution space but still tightly packed in load space
Related reference
8.2 Syntax of a scatter file
8.3.2 Syntax of a load region description
8.4.2 Syntax of an execution region description
6.3.3 Load$$ execution region symbols
Non-ConfidentialPDF file icon PDF versionARM DUI0377G
Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved.