Using PCLint with MPLAB X IDE

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:
Tools > Options > Embedded > PCLint > Options > UserOptionFile

3

Get the file co-xc8.lnt (modified 22Jul2015) from www.gimpel.com

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 file empty.c with -v option and 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.), then these steps must be repeated.

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
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.