Microchip Technology SW006021-1N 用户手册
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 80
2012 Microchip Technology Inc.
4.3.4
Compilation of Assembly Source
Since the code generator performs many tasks that were traditionally performed by the
linker, there could be complications when assembly source is present in a project.
Assembly files are traditionally processed after C code, but it is necessary to have this
performed first so that specific information contained in the assembly code can be
conveyed to the code generator.
linker, there could be complications when assembly source is present in a project.
Assembly files are traditionally processed after C code, but it is necessary to have this
performed first so that specific information contained in the assembly code can be
conveyed to the code generator.
The specific information passed to the code generator is discussed in more detail in
Section 5.12.3 “Interaction Between Assembly and C Code”.
Section 5.12.3 “Interaction Between Assembly and C Code”.
When assembly source is present, the order of compilation is as shown in Figure 4-4.
FIGURE 4-4:
COMPILATION SEQUENCE WITH ASSEMBLY FILES
Any assembly source files are first assembled to form object files. These files, along
with any other objects files that are part of the project, are then scanned by the com-
mand-line driver and information is then passed to the code generator when it
subsequently builds the C files, as has been described earlier.
with any other objects files that are part of the project, are then scanned by the com-
mand-line driver and information is then passed to the code generator when it
subsequently builds the C files, as has been described earlier.
4.3.4.1
INTERMEDIATE FILES AND ASSEMBLY SOURCE
The intermediate file format associated with assembly source files is the same as that
used in traditional compilers; i.e., an object file (.obj extension). Assembly files are
never passed to the code generator and so the code generator technology does not
alter the way these files are compiled.
used in traditional compilers; i.e., an object file (.obj extension). Assembly files are
never passed to the code generator and so the code generator technology does not
alter the way these files are compiled.
The -C option (see Section 4.8.1 “-C: Compile to Object File”) is used to generate
object files and halt compilation after the assembly step.
object files and halt compilation after the assembly step.
4.3.5
Printf Check
An extra execution of the code generator is performed prior to the actual code genera-
tion phase. This pass is part of the process by which the printf library function is
customized, see Section 5.11.1 “The printf Routine” for more details.
tion phase. This pass is part of the process by which the printf library function is
customized, see Section 5.11.1 “The printf Routine” for more details.
This pass is only associated with scanning the C source code for printf placeholder
usage and you will see the code generator being executed if you select the verbose
option when you build, see Section 4.8.15 “-V: Verbose Compile”.
usage and you will see the code generator being executed if you select the verbose
option when you build, see Section 4.8.15 “-V: Verbose Compile”.
C file
C file
library
files
preprocess
&
parse
p-
code
code
generation
assemble
preprocess
&
parse
p-
code
ASM
file
OBJ
file
link
assemble
driver