2.5 Enable/Disable Code Coverage

By default, Code Coverage is disabled. To enable code coverage, complete the following steps:

To open the Project Properties dialog, select Tools>Analysis>Code Coverage or you can right click on the name of your project in the Projects window and select “Properties.”

  1. Click on "Analysis" under Categories.
  2. Under the Option categories (General) select your choice for "Code Coverage Instrumentation." Selections differ for each MPLAB XC compiler (see the table below).
Table 2-2. Enable Code Coverage Options by Compiler
MPLAB XC C Compiler Enable Options Description
XC8 Disable Disable code coverage.
Enable Enable code coverage.
XC16 Disable Disable code coverage.
Enable Near memory Use Near RAM space for code coverage instrumentation (recommended). If there is a link error, then select Far.
Enable Far memory Use Far RAM space for code coverage instrumentation.
XC32 Disable Disable code coverage.
Enable Enable code coverage.
Figure 2-3. Code Coverage Options - MPLAB XC16 Example