Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 236
 2012 Microchip Technology Inc.
5.15.3
Default Linker Classes
The linker uses classes to represent memory ranges. For an introductory guide to 
psects and linker classes, see Section 5.15.1 “Program Sections”.
The classes are defined by linker options, see Section 7.2.1 “-Aclass =low-high,...” 
passed to the linker by the compiler driver. Psects are typically allocated space in the 
class they are associated with. The association is made using the class flag of the 
PSECT
 directive, see Section 6.4.9.3.3 “Class”. Alternatively, a psect may be explic-
itly placed into a class using a linker option, see Section 7.2.19 “-Pspec”.
Classes may represent a single memory range, or multiple ranges. Even if two ranges 
are contiguous, the address where one range ends and the other begins forms a 
boundary and psects placed in the class can never cross such boundaries. You will see 
classes that cover the same addresses, but will be divided into different ranges and 
have different boundaries. This is to accommodate psects whose contents were com-
piled under assumptions about where they would be located in memory.
Memory allocated from one class will also be reserved from other classes that specify 
the same memory. To the linker, there is no significance to a class name or the memory 
it defines.
Memory will be subtracted from these classes if using the --ROM or --RAM options, see 
Section 4.8.49 “--ROM: Adjust ROM Ranges” and Section 4.8.48 “--RAM: Adjust 
RAM Ranges”
, t
o reserve memory. When specifying a debugger, such as an ICD, see 
Section 4.8.23 “--DEBUGGER: Select Debugger Type”, memory may also be 
removed from the ranges associated with some classes so that this memory is not used 
by your program.
Although you can manually adjust the ranges associated with a class, this is not rec-
ommended. Never change or remove address boundaries specified by a class 
definition option.
Below are the linker classes that may be defined by the compiler. Not all classes may 
be present for each device.
5.15.3.1
PROGRAM MEMORY CLASSES
CODE
 consists of ranges that map to the pages on the target device. Thus, it is typi-
cally used for psects containing executable code. On baseline devices, it can 
only be used by code that is accessed via a jump table.
ENTRY
 is used mainly by baseline devices for psects containing executable code that 
is accessed via a CALL instruction (calls can only be to the first half of a 
page). The class is defined in such a way that it is the size of a page, but 
psects it holds will be positioned so that they start in the first half of the page.
This class is also used in mid-range devices and will consist of many ranges, 
each 0x100 words long and aligned on a 0x100 boundary. Thus, it is useful 
for psects whose contents cannot span a 0x100 word boundary.
STRING
 consists of ranges that are 0x100 words long and aligned on a 0x100 bound-
ary. Thus, it is useful for psects whose contents cannot span a 0x100 word 
boundary.
STRCODE
 defines a single memory range that covers the entire program memory. It 
is useful for psects whose content can appear in any page and can cross 
page boundaries.
CONST
 consists of ranges that are 0x100 words long and aligned on a 0x100 bound-
ary. Thus, it is useful for psects whose contents cannot span a 0x100 word 
boundary.