SPRU513Y August 2001 – June 2022 SM320F28335-EP
The LAST operator is similar to the START and END operators that were described previously. However, LAST applies to a memory range rather than to a section. You can use it in a MEMORY directive to define a symbol that can be used at run-time to learn how much memory was allocated when linking the program. See Section 9.6.4.2 for syntax details.
For example, a memory range might be defined as follows:
D_MEM : org = 0x20000020 len = 0x20000000 LAST(dmem_end)
Your C program can then access this symbol at runtime using the _symval operator. For example:
extern char dmem_end;
printf("End of D_MEM memory is %lx\n", _symval(&dmem_end));
See Section 9.7.1 for more information about referring to linker symbols in C/C++ code.