5.5.2 Diagnostic Files
Two valuable files produced by the compiler are the assembly list file, produced by the assembler, and the map file, produced by the linker.
The assembly list file contains the mapping between the original source code and the generated assembly code. It is useful for information such as how C source was encoded, or how assembly source may have been optimized. It is essential when confirming if compiler-produced code that accesses objects is atomic, and shows the region in which all objects and code are placed.
The option to create a listing file in the assembler is
-a
(or -Wa,-a
if passed to the driver). There are many
variants to this option, which may be found in the MPLAB®
XC32 Assembler, Linker and Utilities User’s Guide (DS50002186). To pass the option
from the compiler, see 5.7.9 Options for Assembling.
There is one list file produced for each build. There is one assembler
listing file for each translation unit. This is a pre-link assembler listing so it will not
show final addresses. Thus, if you require a list file for each source file, these files
must be compiled separately, see 5.2.3 Multi-Step C Compilation. This is the case if you build using
MPLAB X IDE. Each list file will be assigned the module name and extension
.lst
.
The map file shows information relating to where objects are positioned in memory. It is useful for confirming that user-defined linker options were correctly processed, and for determining the exact placement of objects and functions.
The linker option to create a map file is -Map
file
(or -Wl,-Map=file
, if passed to the driver), which
can be found in the MPLAB®
XC32 Assembler, Linker and Utilities User’s Guide (DS50002186). To pass the option
from the compiler driver, see 5.7.10 Options for Linking.
There is one map file produced when you build a project, assuming the linker was executed and ran to completion.