Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
Compiler Command-Line Driver
2012-2013 Microchip Technology Inc. DS50002071C-page 79
For example, the files ex1.c and add.c are to be compiled using a make utility. The
command lines that the make utility should use to compile these files might be some-
thing like:
xc16-gcc -mcpu=30f6014 -c ex1.c
xc16-gcc -mcpu=30f6014 -c add.c
xc16-gcc -mcpu=30f6014 -o ex1 ex1.o add.o
The -c option will compile the named file into the intermediate (object) file format, but
not link. Once all files are compiled as specified by the make, then the resultant object
files are linked in the final step to create the final output ex1. The above example uses
the command-line driver, xc16-gcc, to perform the final link step. You can explicitly
call the linker application, xc16-ld, but this is not recommended. When driving the linker
application, you must specify linker options, not driver options. For more on using the
linker, see MPLAB XC16 Assembler, Linker and Utilities Users Guide (DS52106).
When compiling debug code, the object module format (OMF) must be consistent for
compilation, assembly and linking. The ELF/DWARF format is used by default but the
COFF format may also be selected using -omf=coff or the environmental variable
XC16_OMF.
5.3.4 Assembly Compilation
A mix of C and assembly code can be compiled together using the compiler (Figure ).
For more details, see Chapter 16. Mixing C and Assembly Code.
Additionally, the compiler may be used to generate assembly code (.s) from C code
(.c) using the -S option. The assembly output may then be used in subsequent com-
pilation using the command-line driver.
Protego_Release_01_05-Related-OEM-Documentation-MPLAB-XC16-C-Compiler.pdf