Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual
Product codes
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 282
2012 Microchip Technology Inc.
If present, the minimum value, min, is preceded by a + sign. It sets a minimum value
for the link or load address. The address will be calculated as described below, but if it
is less than the minimum then it will be set equal to the minimum.
for the link or load address. The address will be calculated as described below, but if it
is less than the minimum then it will be set equal to the minimum.
The link and load addresses are either numbers, or the names of other psects, classes,
or special tokens.
or special tokens.
If the link address is a negative number, the psect is linked in reverse order with the top
of the psect appearing at the specified address minus one. Psects following a negative
address will be placed before the first psect in memory.
of the psect appearing at the specified address minus one. Psects following a negative
address will be placed before the first psect in memory.
If a psect’s link address is omitted, it will be derived from the top of the previous psect.
For example, in the following:
For example, in the following:
-Ptext=100h,data,bss
the text psect is linked at 100h (its load address defaults to the same). The data
psect will be linked (and loaded) at an address which is 100 HEX plus the length of the
text
psect will be linked (and loaded) at an address which is 100 HEX plus the length of the
text
psect, rounded up as necessary if the data psect has a reloc value associated
with it (see Section 6.4.9.3.11 “Reloc”). Similarly, the bss psect will concatenate with
the data psect. Again:
the data psect. Again:
-Ptext=-100h,data,bss
will link in ascending order bss, data then text with the top of the text psect
appearing at address 0ffh.
appearing at address 0ffh.
If the load address is omitted entirely, it defaults to the same as the link address. If the
slash / character is supplied, but no address is supplied after it, the load address will
concatenate with the previous psect. For example:
slash / character is supplied, but no address is supplied after it, the load address will
concatenate with the previous psect. For example:
-Ptext=0,data=0/,bss
will cause both text and data to have a link address of zero; text will have a load
address of zero, and data will have a load address starting after the end of text. The
bss
address of zero, and data will have a load address starting after the end of text. The
bss
psect will concatenate with data in terms of both link and load addresses.
The load address may be replaced with a dot character, “.”. This tells the linker to set
the load address of this psect to the same as its link address. The link or load address
may also be the name of another (previously linked) psect. This will explicitly
concatenate the current psect with the previously specified psect, for example:
the load address of this psect to the same as its link address. The link or load address
may also be the name of another (previously linked) psect. This will explicitly
concatenate the current psect with the previously specified psect, for example:
-Ptext=0,data=8000h/,bss/. -Pnvram=bss,heap
This example shows text at zero, data linked at 8000h but loaded after text; bss
is linked and loaded at 8000h plus the size of data, and nvram and heap are concat-
enated with bss. Note here the use of two -P options. Multiple -P options are
processed in order.
is linked and loaded at 8000h plus the size of data, and nvram and heap are concat-
enated with bss. Note here the use of two -P options. Multiple -P options are
processed in order.
If -A options (see Section 7.2.1 “-Aclass =low-high,...”) have been used to specify
address ranges for a class then this class name may be used in place of a link or load
address, and space will be found in one of the address ranges. For example:
address ranges for a class then this class name may be used in place of a link or load
address, and space will be found in one of the address ranges. For example:
-ACODE=8000h-BFFEh,E000h-FFFEh
-Pdata=C000h/CODE
This will link data at C000h, but find space to load it in the address ranges associated
with the CODE class. If no sufficiently large space is available in this class, an error will
result. Note that in this case the data psect will still be assembled into one contiguous
block, whereas other psects in the class CODE will be distributed into the address
ranges wherever they will fit. This means that if there are two or more psects in class
CODE
with the CODE class. If no sufficiently large space is available in this class, an error will
result. Note that in this case the data psect will still be assembled into one contiguous
block, whereas other psects in the class CODE will be distributed into the address
ranges wherever they will fit. This means that if there are two or more psects in class
CODE
, they may be intermixed in the address ranges.
Any psects allocated by a -P option will have their load address range subtracted from
the address ranges associate with classes in the same memory space. This allows a
range to be specified with the -A option without knowing in advance how much of the
lower part of the range, for example, will be required for other psects.
the address ranges associate with classes in the same memory space. This allows a
range to be specified with the -A option without knowing in advance how much of the
lower part of the range, for example, will be required for other psects.