11.12.1 _PROGRAM_END
Description:
A symbol defined in program memory to mark the highest address used by a CODE 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 section.
Examples:
C code:
int big_addr;
extern int _PROGRAM_END __attribute__((far));
int main() {
big_addr = _PROGRAM_END;
}
Assembly code:
.section .nbss,bss,near
.global _big_addr
.align 4
_big_addr: .space 4
.section .text,code
.align 4
.global _main
_main:
mov.sl #__PROGRAM_END,w0
mov.l w0,_big_addr
movs.l #0,w0
return