Vault 7: Projects

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

Common C Interface
2012-2013 Microchip Technology Inc. DS50002071C-page 31
2.5 ANSI STANDARD EXTENSIONS
The following topics describe how the CCI provides device-specific extensions to the
standard.
2.5.1 Generic Header File
A single header file <xc.h> must be used to declare all compiler- and device-specific
types and SFRs. You must include this file into every module to conform with the CCI.
Some CCI definitions depend on this header being seen.
2.5.1.1 EXAMPLE
The following shows this header file being included, thus allowing conformance with the
CCI, as well as allowing access to SFRs.
#include <xc.h>
2.5.1.2 DIFFERENCES
Some 8-bit compilers used <htc.h> as the equivalent header. Previous versions of
the 16- and 32-bit compilers used a variety of headers to do the same job.
2.5.1.3 MIGRATION TO THE CCI
Change:
#include <htc.h>
used previously in 8-bit compiler code, or family-specific header files as in the following
examples:
#include <p32xxxx.h>
#include <p30fxxxx.h>
#include <p33Fxxxx.h>
#include <p24Fxxxx.h>
#include "p30f6014.h"
to:
#include <xc.h>
2.5.2 Absolute addressing
Variables and functions can be placed at an absolute address by using the __at()
construct qualifier. Stack-based (auto and parameter) variables cannot use the
__at() specifier.
2.5.2.1 EXAMPLE
The following shows two variables and a function being made absolute.
const char keys[] __at(123) = { r, s, u, d};
__at(0x1000)int modify(int x) {
return x * 2 + 3;
}
2.5.2.2 DIFFERENCES
The 8-bit compilers have used an @ symbol to specify an absolute address.
The 16- and 32-bit compilers have used the address attribute to specify an objects
address.

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh