11.14.2 _PROGRAM_END

Description:

A symbol defined in program memory to mark the highest address used by a CODE or PSV section.

Include:

libpic30.h

Prototype:

__attribute__((space(prog))) int _PROGRAM_END

Remarks:

In C, the symbol should be referenced with the address operator (&), as in a built-in function call that accepts the address of an object in program memory. Also, this symbol can be used by applications as an end point for checksum calculations.

In assembly language, it should be referenced with an extra underbar character in the prefix.

Default Behavior:

The highest address used by a CODE or PSV section.

Examples:

C code:
 __builtin_tblpage(&_PROGRAM_END)
 __builtin_tbloffset(&_PROGRAM_END)

 _prog_addressT big_addr;
 _init_prog_address(big_addr, &_PROGRAM_END)

Assembly code:

mov #tblpage(__PROGRAM_END),w0
mov #tbloffset(__PROGRAM_END),w1

.pword __PROGRAM_END
.long __PROGRAM_END