7.1.1 A: Define Linker Class Option
The
-Aclass=low[-entry]-high[xcount]
option allows one or more address ranges to be defined as a linker class, which can then
be used to locate psects in memory. Addresses should use the h suffix
to indicate a hexadecimal value.
low and high
address. Ranges do not need to be contiguous. For
example:-ACODE=1020h-5FFEh,8000h-BFFEhspecifies
that the class called CODE represents the two distinct address ranges
shown.-P option and the class name (see P: Position Psect), for
example:-PmyText=CODEwill place the
myText psect somewhere in the memory ranges defined by the
CODE class. Alternatively, any psect that is associated with the
CODE class when it is defined (see Class Flag) will automatically
be linked into this range, unless it is explicitly located by another option.x character. For
example:-ACODE=0h-0FFFFhx16specifies that there
are 16 contiguous ranges, each 64k bytes in size, starting from address zero (0x0-FFFF,
0x10000-1FFFF, etc.). Even though the address ranges are contiguous, no psect will
straddle a boundary between ranges, or in other words psects linked into the class will
be wholly positioned in the range 0x0-FFFF or within the range 0x10000-1FFFF etc.
Linking psects in such a class might yield a different placement to the case where they
were linked into a class defined
by:-ACODE=0h-0FFFFFhfor example, which defines
the same total address range but which does not include 64k boundaries.-A linker option can also specify an entry range, which is typically
used for placement of code psects on Baseline devices. For example, the class called
ENTRY defined as
follows:-AENTRY=00h-0FFh-01FFh,0200h-02FFh-03FEhhas
two ranges, 0x0-1FF and 0x200-3FE. However, the middle address in the option informs the
linker that any psect positioned in these ranges must not start above the second
address, that is, any psect linked into this class must start in the entry ranges 0x0-FF
or 0x200-2FF. A psect may extend beyond the entry range, provided the start address is
located within it. Such classes should be used for Baseline devices, where the reachable
destinations of call instructions are restricted. See the MPLAB® XC8 PIC Assembler User's Guide for Embedded
Engineers for a more thorough example of using such classes.The -A linker option does not specify the memory space
associated with the address range. Once a psect is allocated to a class, the space value
of the psect is then assigned to the class (see Space Flag). Nor does this
option assign a delta value to a class. If required (typically for
Baseline and Mid-range classes used to hold executable code), this must be set with the
linker's -D option (see D: Define Class Delta Value).
