8.6.4 Expression rules in scatter files

Expressions follow the C-Precedence rules.

Expressions are made up of the following:
  • Decimal or hexadecimal numbers.
  • Arithmetic operators: +, -, /, *, ~, OR, and AND
    The OR and AND operators map to the C operators | and & respectively.
  • Logical operators: LOR, LAND, and !
    The LOR and LAND operators map to the C operators || and && respectively.
  • Relational operators: <, <=, >, >=, and ==
    Zero is returned when the expression evaluates to false and nonzero is returned when true.
  • Conditional operator: Expression ? Expression1 : Expression2
    This matches the C conditional operator. If Expression evaluates to nonzero then Expression1 is evaluated otherwise Expression2 is evaluated.

    Note

    When using a conditional operator in a +offset context on an execution region or load region description, the final expression is considered relative only if both Expression1 and Expression2, are considered relative. For example:
    er1 0x8000
    {
        …
    }
    er2 ((ImageLimit(er1) < 0x9000) ? +0 : +0x1000)    ; er2 has a relative address
    {
        …
    }
    er3 ((ImageLimit(er2) < 0x10000) ? 0x0 : +0)       ; er3 has an absolute address
    {
        …
    }
  • Functions that return numbers.
All operators match their C counterparts in meaning and precedence.
Expressions are not case-sensitive and you can use parentheses for clarity.
Related concepts
8.6.1 Methods of specifying numeric constants for expression evaluation
8.6.3 Expression usage in scatter files
8.6.5 Execution address built-in functions for use in scatter files
8.6.6 ScatterAssert function and load address related functions
8.6.7 Symbol related function in a scatter file
8.3.6 Considerations when using a relative address +offset for a load region
8.4.5 Considerations when using a relative address +offset for execution regions
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
Non-ConfidentialPDF file icon PDF versionARM DUI0377G
Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved.