6.1.9.39 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
Flag Meaning
abs psect is absolute.
bit psect holds bit objects.
class=name Specify class name for psect.
delta=size Size of an addressing unit.
global psect is global (default).
inline psect contents (function) can be inlined when called.
keep psect will not be deleted after inlining.
limit=address Upper address limit of psect (PIC18 only).
local psect is unique and will not link with others having the same name.
lowdata psect will be entirely located below the 0x1000 address.
merge=allow Allow or prevent merging of this psect.
noexec For debugging purposes, this psect contains no executable code.
note psect does not contain any data that should appear in the program image.
optim=optimizations specify optimizations allowable with this psect.
ovrld psect will overlap same psect in other modules.
pure psect is to be read-only.
reloc=boundary Start psect on specified boundary.
size=max Maximum size of psect.
space=area Represents area in which psect will reside.
split=allow Allow or prevent splitting of this psect.
with=psect Place 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