SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
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 8.5.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 8.6 for more information about referring to linker symbols in C/C++ code.