Microchip Technology SW006022-2N Data Sheet
MPLAB
®
XC16 C Compiler User’s Guide
DS52071B-page 50
2012 Microchip Technology Inc.
3.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.
Additionally, environmental variables and input files used by the compiler are discussed
in the following sections.
3.2.1
Drive Command-Line Format
The basic form of the compiler command line is:
xc16-gcc [options] files
where:
options
: See Section 3.7 “Driver Option Descriptions” for available options.
files
: See Section 3.2.3 “Input File Types” for details.
It is assumed in this manual that the compiler applications are either in the console’s
search path, see Section 3.2.2 “Environment Variables”, or the full path is specified
when executing any application.
search path, see Section 3.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.
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 impor-
tant, except that it may affect the order in which code or data appears in memory.
mediate files, such as relocatable object (.o) files. The order of the files is not impor-
tant, 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.out.
catable object output, hello.out.
xc16-gcc -mcpu=30f2010 -o hello.out hello.c
3.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.
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 3-1:
COMPILER-RELATED ENVIRONMENTAL VARIABLES
Variable
Definition
XC16_C_INCLUDE_P
ATH
PIC30_C_INCLUDE_
PATH
This variable’s 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
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 can’t find the subprograms using
PIC30_EXEC_PREFIX
much like PATH. The compiler tries the directories thus specified when
searching for subprograms, if it can’t find the subprograms using
PIC30_EXEC_PREFIX
.