SW500008 Microchip Technology, SW500008 Datasheet - Page 92

PICC-18 STD

SW500008

Manufacturer Part Number
SW500008
Description
PICC-18 STD
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500008

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Standard
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015
778-1001
778-1001
Preprocessing
3.12.3.3 The #pragma psect Directive
Normally the object code generated by the compiler is broken into the standard psects as described
in Section 3.9.1. This is fine for most applications, but sometimes it is necessary to redirect variables
or code into different psects when a special memory configuration is desired. Code and data for any
of the standard C psects may be redirected using a #pragma psect directive.
and instructs the code generator that anything that would normally appear in the compiler-generated
psect default_psect, will now appear in a new psect called new_psect. This psect will be
identical to default_psect in terms of its options, however will have a different name. Thus,
this new psect can be explicitly positioned by the linker without affect the original psect’s location.
absbss1, absbss2, then the placeholder %u should be used in the name of the psect at the posi-
tion of the counter, e.g. absbss%u. Any default psect, regardless of the counter value, will match
such a psect name.
redirected once in a particular module. All psect redirections for a particular module should be
placed at the top of the source file, below any #include statements and above any other declarations.
78
The general form of this pragma looks like:
If the name of the default psect that is being redirected contains a counter, e.g. absbss0,
This pragma remains in force until the end of the module and any given psect should only be
Note that the warning level must be set to -1 or below for this option to have any visible
effect. See Section 2.4.54.
#pragma psect default_psect=new_psect
T
A particular function, called read_port(), needs to be located at the absolute address
0x400 in a program. Using the #pragma psect directive in the source code, and adding
a new linker option can do this. First write the function in the usual way. Place the
function definition in a separate module. There is obvioulsy something special about
this function so a module all to itself is probably a good idea anyway.
unsigned char read_port(void)
{
}
UT RIAL
return PORTA;
C Language Features

Related parts for SW500008