Vault 7: Projects

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

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 74 2012-2013 Microchip Technology Inc.
5.2 INVOKING THE COMPILER
The compiler is invoked and run on the command line as specified in the next section.
Additionally, environmental variables and input files used by the compiler are discussed
in the following sections.
5.2.1 Drive Command-Line Format
The basic form of the compiler command line is:
xc16-gcc [options] files
where:
options: See Section 5.7 Driver Option Descriptions for available options.
files: See Section 5.2.3 Input File Types for details.
It is assumed in this manual that the compiler applications are either in the consoles
search path, see Section 5.2.2 Environment Variables, or the full path is specified
when executing any application.
It is conventional to supply options (identified by a leading dash -) before the file
names, although this is not mandatory.
The files may be any mixture of C and assembler source files, and precompiled inter-
mediate files, such as relocatable object (.o) files. The order of the files is not import-
ant, except that it may affect the order in which code or data appears in memory.
For example, to compile, assemble and link the C source file hello.c, creating a relo-
catable object output, hello.elf.
xc16-gcc -mcpu=30f2010 -o hello.elf hello.c
5.2.2 Environment Variables
The variables in this section are optional, but, if defined, they will be used by the
compiler. The compiler driver, or other subprogram, may choose to determine an
appropriate value for some of the following environment variables if they are unset. The
driver, or other subprogram, takes advantage of internal knowledge about the
installation of the compiler. As long as the installation structure remains intact, with all
subdirectories and executables remaining in the same relative position, the driver or
subprogram will be able to determine a usable value.
Note: Command line options and file name extensions are case-sensitive.
TABLE 5-1: COMPILER-RELATED ENVIRONMENTAL VARIABLES
Variable Definition
XC16_C_INCLUDE_-
PATH
PIC30_C_IN-
CLUDE_PATH
This variables value is a semicolon-separated list of directories, much
like PATH. When the compiler searches for header files, it tries the
directories listed in the variable, after the directories specified with -I
but before the standard header file directories.
If the environment variable is undefined, the preprocessor chooses an
appropriate value based on the standard installation. By default, the
following directories are searched for include files:
<install-path>\include and
<install-path>\support\h
XC16_COMPILER_
PATH
PIC30_COMPILER_
PATH
The value of the variable is a semicolon-separated list of directories,
much like PATH. The compiler tries the directories thus specified when
searching for subprograms, if it cant find the subprograms using
PIC30_EXEC_PREFIX.

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh