| |||
| Home > Formal syntax of the scatter file > Expression rules in scatter files | |||
Expressions follow the C-Precedence rules and 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 evaluates
to nonzero then Expression is
evaluated otherwise Expression1 is
evaluated.Expression2
When using a conditional operator in a + context
on an execution region or load region description, the final expression
is considered relative only if both offset and Expression1,
are considered relative. For example:Expression2
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.