7.4.2 Diagnostic Files

Two valuable files produced by the compiler are:

  • The assembly list file, produced by the assembler.
  • 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. There are many variants to this option, which may be found in the MPLAB® XC16 Assembler, Linker and Utilities User’s Guide (DS50002106). To pass the option from the compiler, see section Options for Assembling.

There is one list file produced for each build. Thus, if you require a list file for each source file, these files must be compiled separately, see sectionMulti-Step Compilation. This is the case if you build using MPLAB IDE. Each list file will be assigned the module name and extension .lst.

The map file shows information relating to where objects were positioned in memory. It is useful for confirming if 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 in the linker application is -Map file, which may be found in the MPLAB® XC16 Assembler, Linker and Utilities User’s Guide (DS50002106). To specify the option from the command-line driver, see section Options for Linking.

One map file is produced when you build a project, assuming that the linker was executed and ran to completion.