6.1.9.40 Psect Directive

The PSECT directive declares or resumes a program section.

The directive takes as argument a name and, optionally, a comma-separated list of flags. The allowed flags specify attributes of the psect. They are listed in the Table 6-10 table.

The psect name is in a separate name space to ordinary assembly symbols, so a psect can use the same identifier as an ordinary assembly identifier. However, a psect name cannot be one of the assembler directives, keywords, or psect flags.

Once a psect has been declared, it can be resumed later by another PSECT directive; however, the flags need not be repeated and will be propagated from the earlier declaration. An error is generated if two PSECT directives for the same psect are encountered with contradictory flags, the exceptions being that the reloc, size and limit flags can be respecified without error.

Table 6-10. Psect Flags
FlagMeaning
abspsect is absolute.
bitpsect holds bit objects.
class=nameSpecify class name for psect.
delta=sizeSize of an addressing unit.
globalpsect is global (default).
inlinepsect contents (function) can be inlined when called.
keeppsect will not be deleted after inlining.
limit=addressUpper address limit of psect (PIC18 only).
localpsect is unique and will not link with others having the same name.
lowdatapsect will be entirely located below the 0x1000 address.
merge=allowAllow or prevent merging of this psect.
noexecFor debugging purposes, this psect contains no executable code.
notepsect does not contain any data that should appear in the program image.
optim=optimizationsspecify optimizations allowable with this psect.
ovrldpsect will overlap same psect in other modules.
purepsect is to be read-only.
reloc=boundaryStart psect on specified boundary.
size=maxMaximum size of psect.
space=areaRepresents area in which psect will reside.
split=allowAllow or prevent splitting of this psect.
with=psectPlace psect in the same page as specified psect.

Some examples of the use of the PSECT directive follow:

; swap output to the psect called fred
PSECT fred
; swap to the psect bill, which has a maximum size of 100 bytes and which is global
PSECT bill,size=100h,global
; swap to joh, which is an absolute and overlaid psect that is part of the CODE linker class,
; and whose content has a 2-byte word at each address
PSECT joh,abs,ovrld,class=CODE,delta=2