22.3 Linker-Defined Symbols
The 16-bit linker defines several symbols that may be used in your C code development. Please see the MPLAB® XC16 Assembler, Linker and Utilities User’s Guide (DS50002106) for more information.
A useful address symbol, _PROGRAM_END
, is defined in
program memory to mark the highest address used by a CODE
or
PSV
section. It should be referenced with the address operator (&)
in a built-in function call that accepts the address of an object in program memory. This
symbol can be used by applications as an end point for checksum calculations.
For example:
unsigned int end_page, end_offset;
_prog_addressT big_addr;
end_page = __builtin_tblpage(&_PROGRAM_END);
end_offset = __builtin_tbloffset(&_PROGRAM_END);
_init_prog_address(big_addr, _PROGRAM_END);