Before executing PCLint:
Create a user option file, named myOptions.lnt, in the folder C:\lint, containing these instructions:
Inside MPLAB X IDE, select the created user option file:
Tools > Options > Embedded > PCLint > Options > UserOptionFile
Get the file co-xc8.lnt (modified 22Jul2015) from www.gimpel.com
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.
Add the following two lines to co-xc8.lnt:
-header(lint-cmac.h) // preprocessor macro definitions
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.