21.3 Linker-Defined Symbols

The XC32 linker defines several symbols that may be used in your C code development. Please see the “MPLAB® XC32 Assembler, Linker and Utilities User’s Guide for PIC32A MCU” (DS-50003839) for more information.

A useful address symbol, _PROGRAM_END, is defined in program memory to mark the highest address used by a CODE 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:

int *big_addr;
extern int _PROGRAM_END __attribute__((far));

int main() {
  big_addr = &_PROGRAM_END;
}