You copied the Doc URL to your clipboard.

Expression evaluation in scatter files

The linker can carry out simple expression evaluation with a restricted set of operators, The operators are +, -, *, /, AND, OR, and parentheses. The implementation of OR and AND follows C operator precedence rules.

Example of using expression evaluation

Use the directives:

#define BASE_ADDRESS 0x8000
#define ALIAS_NUMBER 0x2
#define ALIAS_SIZE 0x400


The scatter file might contain:

LOAD_FLASH AN_ADDRESS    ; start address

After preprocessing, this evaluates to:

LOAD_FLASH ( 0x8000 + ( 0x2 * 0x400 ))  ; start address

After evaluation, the linker parses the scatter file to produce the load region:

LOAD_FLASH 0x8800 ; start address