You copied the Doc URL to your clipboard.

ScatterAssert function and load address related functions

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 5. Load address related functions 
FunctionLinker 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 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 LoadRegion

Was this page helpful? Yes No