Using PCLint with MPLAB X IDE

Complete before executing PCLint.

 Step-by-Step

1

Create a user option file, named myOptions.lnt, in the folder C:\lint, containing these instructions:

-i"C:\lint"
au-misra3.lnt
co-xc8.lnt

2

Inside MPLAB® X IDE, select the created user option file by navigating to Tools > Options > Embedded > PCLint > Options > UserOptionFile.

3

Get the co-xc8.lnt file (modified 22Jul2015) from the the Gimpel website.

Files

Before you start using this file, please perform these simple steps:
1) Include the path(s) to your header files.

  • Run MPLAB XC8 to compile the empty.c file with -v option. Copy any -I argument from the output to include-path.lnt (in the same directory where co-xc8.lnt exists).
  • Don't forget to use the -i lint option. ex: -i"include-path".
  • Note that any other include directories should be added explicitly.

2) Next, include the preprocessor macro definitions specific to the chip you are using.

  • From the output you get in step one, copy all arguments starting with -D to lint-cmac.h in the same directory as co-xc8.lnt.
  • Edit the file to have the form: #define macro_name value // each definition on a separate line

To do the above steps run xc8 —CHIP=16F1619 -v -v test.c > out.txt from the command prompt and then create lint-cmac.h and include-path.lnt.

These steps must be done every time the project configuration is changed.

4

Add the following two lines to co-xc8.lnt:

-header(lint-cmac.h) // preprocessor macro definitions
include-path.lnt

5

Click on the project, then click on Lint this project.

Anytime anything in the project properties is changed (e.g., include path, change of device, compiler version, etc.), these steps must be repeated.

© 2024 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.