# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MPLAB XC16 C-Compiler

- 1
- 2
…
- 105
- 106
- 107
- 108
- 109
…
- 365
- 366

MPLAB
®
XC16 C COMPILER
USERS GUIDE
 2012-2013 Microchip Technology Inc. DS50002071C-page 107
Chapter 6. Device-Related Features
6.1 INTRODUCTION
The MPLAB XC16 C Compiler provides some features that are purely device-related.
 Device Support
 Device Header Files
 Stack
 Configuration Bit Access
 Using SFRs in MCUs
 Bit-Reversed and Modulo Addressing
6.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).
To determine the device support for your version of the compiler, consult the file
Readme_XC16.html in the docs subfolder of the compiler installation folder. For
example:
C:\Program Files (x86)\Microchip\xc16\v1.10\docs\Readme_XC16.html
6.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.
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.
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.
For information about assembly include files (*.inc), see the assembler
documentation.
6.3.1 Register Definition Files
The processor header files described in Section 6.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 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:

- 1
- 2
…
- 105
- 106
- 107
- 108
- 109
…
- 365
- 366