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.