Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
XC8 Command-line Driver
 2012 Microchip Technology Inc.
DS52053B-page 75
4.3
THE COMPILATION SEQUENCE
When you compile a project, there are many internal applications that are called to do 
the work. This section looks at when these internal applications are executed and how 
this relates to the build process of multiple source files. This section should be of 
particular interest if you are using a make system to build projects.
4.3.1
The Compiler Applications
The main internal compiler applications and files are illustrated in Figure 4-1.
You can consider the large underlying box to represent the whole compiler, which is 
controlled by the command line driver, xc8. You may be satisfied just knowing that C 
source files (shown on the far left) are passed to the compiler and the resulting output 
files (shown here as a HEX and COFF debug file on the far right) are produced; how-
ever, internally there are many applications and temporary files being produced. An 
understanding of the internal operation of the compiler, while not necessary, does 
assist with using the tool.
To simplify the compiler design, some of the internal applications come in a PIC18 and 
PIC10/12/16 variant. The appropriate application is executed based on the target 
device. In fact, the xc8 driver delegates the build commands to one of two com-
mand-line drivers: PICC or PICC18. This operation is transparent and xc8 may be 
considered as “the driver” which does all the work.
The driver will call the required compiler applications. These applications are shown as 
the smaller boxed inside the large driver box. The temporary file produced by each 
application can also be seen in this diagram.
FIGURE 4-1:
COMPILER APPLICATIONS AND FILES
.as
preprocessor 
parser
code
generator 
assembler 
.c
.pre
.p1
.obj
processed 
files (module)
p-code 
files
assembly file
relocatable
object file
C source
files
or 
p
linker 
objtohex 
cromwell 
hexmate 
parser
code
generator 
assembler 
linker 
objtohex 
cromwell 
.obj
absolute
object file
.
hex
hex file
.cof
debug file
.
hex
hex file
.c
.
h
Command-line driver
.lpp
p-code 
libraries
.as
assembly 
source
files
.obj
relocatable
object files
.hex
hex
files
.lib
object 
libraries
.p1
p-code
files