5.15.1.1 Program Space Psects
The following psects reside in program memory.
checksum- A psect that is used to mark the position of a checksum that has been
requested using the
-mchecksumoption. See Checksum Option for more information. The checksum value is added after the linker has executed so you will not see the contents of this psect in the assembly list file, nor specific information in the map file. Do not change the default linker options relating to this psect. cinit- The psect used by the C initialization runtime startup code. Code in this psect is output by the code generator along with the generated code for the C program. This psect can be linked anywhere within a program memory page, provided it does not interfere with the requirements of other psects.
config- The psect used to store the Configuration Words. This psect must be stored in a special location in the HEX file. Do not change the default linker options relating to this psect.
const- The PIC18-only psect used to hold objects that are declared
constand string literals which are not modifiable. Used when the total amount ofconstdata in a program exceeds 64k. This psect can be linked anywhere on a 2-byte address boundary (enforced by the psect'srelocvalue of 2) within a program memory page, provided it does not interfere with the requirements of other psects. eeprom(PIC18:eeprom_data)- The psect used to store initial values in EEPROM memory. Do not change the default linker options relating to this psect.
end_init- The psect used by the C initialization runtime startup code for
Baseline and Mid-range devices. This psect holds code which transfers control to
the
main()function. idata- The psect containing the ROM image of any initialized variables. The class name associated with these psects represents the class of the corresponding RAM-based data psects, to which the content of these psects will be copied. These psects can be linked at any address within a program memory page, provided that they do not interfere with the requirements of other psects.
idloc- This psect is used to store the ID location words. This psect must be stored in a special location in the HEX file. Do not change the default linker options relating to this psect.
init- The psect used by assembly code in the runtime startup assembly module.
The code in this and
cinitdefine the runtime startup code. If no interrupt code is defined, the Reset vector code can “fall through” into this psect. It is recommended that the linker options for this psect are not changed. intcodeandintcodelo- The psect that contains the executable code for the high-priority (default) and low-priority interrupt service routines, respectively, linked to interrupt vector at address 0x8 and 0x18. Do not change the default linker options relating to these psects. See Codeoffset Option if moving code when using a bootloader.
intentry- The psect that contains the entry code for the interrupt service
routine which is linked to the interrupt vector. This code saves the necessary
registers and jumps to the main interrupt code in the case of Mid-range devices; for
Enhanced Mid-range devices this psect will contain the interrupt function body. PIC18
devices use the
intcodepsects. This psect must be linked at the interrupt vector. Do not change the default linker options relating to this psect. See the-mcodeoffsetoption Codeoffset Option if you want to move code when using a bootloader. ivt0xn- The psect that contains the vector table located at address
nfor devices that use interrupt vector tables or that are operating in legacy mode, see Interrupt Service Routines. jmp_tab- The Baseline only psect used to store jump addresses and function return values. Do not change the default linker options relating to this psect.
maintext- The psect used to hold the assembly code for the
main()function. The code formain()is segregated as it contains the program entry point. Do not change the default linker options relating to this psect as the runtime startup code can “fall through” into this psect. mediumconst- The PIC18-only psect used to hold objects that are declared
constand string literals. Used when the total amount ofconstdata in a program exceeds 255 bytes, but is less than 64k. This psect can be linked anywhere in the lower 64k of program memory, provided it does not interfere with the requirements of other psects. For PIC18 devices, the location of this psect must be above the highest RAM address. powerup- The psect that contains executable code for a user-supplied powerup routine. Do not change the default linker options relating to this psect.
reset_vec- The psect used to hold code associated with the Reset vector.
Do not
change the default linker options relating to this psect. See
the
-mcodeoffsetoption Codeoffset Option, if you want to move code when using a bootloader. reset_wrap- The Baseline psect that contains code that is executed after the oscillator calibration location at the top of program memory has been loaded. Do not change the default linker options relating to this psect.
smallconst- The psect that holds objects that are declared
constand string literals. Used when the total amount ofconstdata in a program is less than 255 bytes. This psect can be linked anywhere in the program memory, provided it does not cross a 0x100 address boundary and it does not interfere with the requirements of other psects. For PIC18 devices, the location of this psect must be above the highest RAM address. strings- The psect used for
constobjects. It also includes all unnamed string literals. This psect can be linked anywhere in the program memory, provided it does not cross a 0x100 address boundary or interfere with the requirements of other psects. stringtextn- The
stringtextnpsects (wherenis a decimal number) are used forconstobjects when compiling for Enhanced Mid-range devices. These psects can be linked anywhere in the program memory, provided they do not interfere with the requirements of other psects. textn- These psects (where
nis a decimal number) contain all other executable code that does not require a special link location. These psects can be linked anywhere on a 2-byte address boundary (enforced by the psect'srelocvalue of 2) within any program memory page, provided they do not interfere with the requirements of other psects. Note that the compiler imposes pseudo page boundaries on some PIC18 devices to work around published errata. Check the defaultCODElinker class for the presence of pages, and their size, in the executable memory. temp- The psect that contains compiler-defined temporary variables. This psect must be linked in common memory, but can be placed at any address in that memory, provided it does not interfere with other psects.
xxx_text- The psects for functions that have been made absolute; i.e., placed at
an address.
xxxwill be the assembly symbol associated with the function. For example if the functionrv()is made absolute, code associated with it will appear in the psect called_rv_text. As these psects are already placed at the address indicated in the C source code, the linker options that position them should not be changed. xxx_const- The psects used for
constobjects that has been made absolute; i.e., placed at an address.xxxwill be the assembly symbol associated with the object. For example, if the arraynbais made absolute, values stored in this array will appear in the psect called_nba_const. As these psects are already placed at the address indicated in the C source code, the linker options that position them should not be changed.
