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

Expression rules in scatter files

8.6.2 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.
Non-ConfidentialPDF file icon PDF versionARM DUI0377H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  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.