SLAU131Y October 2004 – June 2021
Memory range origin and length can use expressions of integer constants with the following operators:
Binary operators: | * / % + - << >> == = < <= > >= & | && || | |
Unary operators: | - ~ ! |
Expressions are evaluated using standard C operator precedence rules.
No checking is done for overflow or underflow, however, expressions are evaluated using a larger integer type.
Preprocess directive #define constants can be used in place of integer constants. Global symbols cannot be used in Memory Directive expressions.
Three address operators reference memory range properties from prior memory range entries:
START(MR) | Returns start address for previously defined memory range MR. | |
SIZE(MR) | Returns size of previously defined memory range MR. | |
END(MR) | Returns end address for previously defined memory range MR. |
/********************************************************/
/* Sample command file with MEMORY directive */
/********************************************************/
file1.c.obj file2.c.obj /* Input files */
--output_file=prog.out /* Options */
#define ORIGIN 0x00000000
#define BUFFER 0x00000200
#define CACHE 0x0001000
MEMORY
{
FAST_MEM (RX): origin = ORIGIN + CACHE length = 0x00001000 + BUFFER
SLOW_MEM (RW): origin = end(FAST_MEM) length = 0x00001800 - size(FAST_MEM)
EXT_MEM (RX): origin = 0x10000000 length = size(FAST_MEM) - CACHE