5.2 Assembler-provided Psects
The PIC Assembler provides psect definitions (tabulated below), can be used to hold
code and data, if required. These psects are available once you include
<xc.inc>
into your source file and have names that resemble
the MPASM directive that creates similar sections in the MPASM assembler. For example,
to have instructions placed into the code
psect, use the
following.#include <xc.inc>
PSECT code
;place instructions here
The linker class associated with each of these psects and the device families for which they are defined are indicated in the table. The linker classes shown are also already predefined by the PIC Assembler, so you do not need to define them.
You can instead use psects and linker classes that you define, if required. In situations where a psect must reside at a specific location, you must use a unique psect so that it can be linked independently to others. See 4.9.47 Psect Directive and 6.1.19 P: Position Psect.
Psect name | Linker class | Target device families | Purpose |
---|---|---|---|
code |
CODE |
All | To hold executable code |
edata |
EEDATA |
All | To hold data in EEPROM |
data |
STRCODE |
Baseline, Mid-range | To hold data in program memory |
data |
CONST |
PIC18 | To hold data in program memory |
udata |
RAM |
All | To hold objects allocatable anywhere in GPR |
udata_acs |
COMRAM |
PIC18 | To hold objects allocatable in the Access bank GPR |
udata_bankn |
BANKN |
All | To hold object allocatable in a particular data memory bank |
udata_shr |
COMMON |
Baseline, Mid-range | To hold objects allocatable in common memory |