Microchip Technology SW006021-2 User Manual
C Language Features
2012 Microchip Technology Inc.
DS52053B-page 217
This pragma affects the entire module in which it is located, regardless of the position
of the pragma in the file. Any given psect should only be redirected once in a particular
module. That is, you cannot redirect the standard psect for some of the module, then
swap back to using the standard psect for the remainder of the source code. The
pragma should typically be placed at the top of the source file. It is recommended that
the code or variables to be separated be placed in a source file all to themselves so
they are easily distinguished.
of the pragma in the file. Any given psect should only be redirected once in a particular
module. That is, you cannot redirect the standard psect for some of the module, then
swap back to using the standard psect for the remainder of the source code. The
pragma should typically be placed at the top of the source file. It is recommended that
the code or variables to be separated be placed in a source file all to themselves so
they are easily distinguished.
To determine the psect in which the function or object is normally located, define the
function or object in the usual way and without this pragma. Now check the assembly
list file (see 6.5 “Assembly-Level Optimizations”) to determine the psect in which the
function or object is normally positioned. Note that the location of objects and functions
may vary with the target device and compiler options selected.
function or object in the usual way and without this pragma. Now check the assembly
list file (see 6.5 “Assembly-Level Optimizations”) to determine the psect in which the
function or object is normally positioned. Note that the location of objects and functions
may vary with the target device and compiler options selected.
Check either the assembly list file or the map file with the pragma in place to ensure
that the mapping has worked as expected and that the function or variable has been
linked at the address specified.
that the mapping has worked as expected and that the function or variable has been
linked at the address specified.
Consider this crude program that consists of several functions.
#include <xc.h>
void init(void)
{
}
int getInput(void)
{
return PORTA;
}
int masher(int val)
{
return val;
}
void main(void)
{
int input;
init();
while(1) {
input = getInput();
masher(input);
}
}
The programmer decides that the function masher() is to be linked at a particular
address and they do not want to make the function absolute. The programmer first
compiles they code and checked either the assembly list file or map file to find the psect
in which masher is normally found. For example, the map file shows the symbol asso-
ciated with the function and the psect in which it is located.
address and they do not want to make the function absolute. The programmer first
compiles they code and checked either the assembly list file or map file to find the psect
in which masher is normally found. For example, the map file shows the symbol asso-
ciated with the function and the psect in which it is located.
Symbol Table
_getInput text13 07E5
_init text12 07E4
_main maintext 07ED
_masher text14 07E8
...