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 DUI0474M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.