MPLAB® Code Coverage Overview

The MPLAB® Code Coverage feature provides visibility as to what portions of your code are being executed. Run your test cases to completion for a visual display of coverage.

The MPLAB Code Coverage feature requires the following tools:

  • An MPLAB XC C compiler (either Free or PRO) that supports code coverage output, starting with MPLAB XC8 v2.10, MPLAB XC16 v1.40, and MPLAB XC32 v2.30.
  • The MPLAB Code Coverage (SW006026-COV) license that provides visibility as to what portions of your code are being executed.
  • MPLAB X IDE v5.25 or later, which supports the display of code coverage data from an MPLAB XC C compiler with the MPLAB Code Coverage license.

This manual is written for MPLAB X IDE v5.30 or later.

Code coverage visibility is not available on the command line; you must use MPLAB X IDE.

Code coverage is displayed in the MPLAB X IDE as:

  • Editor text highlighted by colors representing coverage:
    • green = executed,
    • yellow = partially executed,
    • red = not executed.
  • Program memory highlighted by colors representing coverage.
  • A Code Coverage tab with a report displaying color percentages of code covered. This information may be written to an HTML report for later viewing.
MCCinIDE_small.png
Figure 1: Code Coverage - Editor Window and Code Coverage Tab
MCC_ProgramMemoryWindow.png
Figure 2: Code Coverage - Program Memory Window
© 2020 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.