Техническая Спецификация для Microchip Technology SW006022-2N
MPLAB
®
XC16 C COMPILER
USER’S GUIDE
2012 Microchip Technology Inc.
DS52071B-page 85
Chapter 4. Device-Related Features
4.1
INTRODUCTION
The MPLAB XC16 C Compiler provides some features that are purely device-related.
• Stack
• Using SFRs in MCUs
4.2
DEVICE SUPPORT
As discussed in Chapter 1. “Compiler Overview”, the compiler supports all Microchip
16-bit devices; dsPIC30/33 digital signal controls (DSCs) and PIC24 microcontrollers
(MCUs).
16-bit devices; dsPIC30/33 digital signal controls (DSCs) and PIC24 microcontrollers
(MCUs).
To determine the device support for your version of the compiler, consult the release
notes file, README.html, in the installation folder. For MPLAB IDE users, select
Help>Release Notes.
notes file, README.html, in the installation folder. For MPLAB IDE users, select
Help>Release Notes.
4.3
DEVICE HEADER FILES
One header file that is typically included in each C source file you will write is xc.h, a
generic header file that will include other device- and architecture-specific header files
when you build your project.
generic header file that will include other device- and architecture-specific header files
when you build your project.
Inclusion of this file will allow access to SFRs via special variables, as well as macros
which allow special memory access or inclusion of special instructions.
which allow special memory access or inclusion of special instructions.
Avoid including chip-specific header files into your code, as this will reduce portability.
However, device-specific compiler header files are stored in the support\family\h
directory for reference.
However, device-specific compiler header files are stored in the support\family\h
directory for reference.
For information about assembly include files (*.inc), see the assembler
documentation.
documentation.
4.3.1
Register Definition Files
The processor header files described in Section 4.5 “Configuration Bit Access”
name all SFRs for each part, but they do not define the addresses of the SFRs. A sep-
arate set of device-specific linker script files, one per part, is distributed in the
support\family\gld
name all SFRs for each part, but they do not define the addresses of the SFRs. A sep-
arate set of device-specific linker script files, one per part, is distributed in the
support\family\gld
directory. These linker script files define the SFR addresses.
To use one of these files, specify the linker command-line option:
-T p30fxxxx.gld
where xxxx corresponds to the device part number.
For example, assuming that there is a file named app2010.c that contains an appli-
cation for the dsPIC30F2010 part, then it may be compiled and linked using the
following command line:
cation for the dsPIC30F2010 part, then it may be compiled and linked using the
following command line:
xc16-gcc -mcpu=30f2010 -o app2010.out -T p30f2010.gld app2010.c