To set up a batch file to call PC-lint, separate the lint files from the rest of your build and project, create a lint sub-folder inside your project root directory with a do_lint.bat batch file:
The following listing shows the content of do_lint.bat file:
@rem The arguments for this batch file: @rem %1: The path to the project folder @rem %2: The path to the CodeWarrior installation folder @rem ------------------------------------------------------ @rem Path to my project folder SET PROJ_PATH=%1 @rem Path to CodeWarrior installation folder (which is e.g. "C:\Freescale\CW MCU v10.2\eclipse\..\MCU") SET CW_PATH=%2 @rem Path to lint-nt.exe SET LINT_EXE=C:\lint\lint-nt.exe @rem Path to my lint configuration files SET LOCAL_LNT_FILES=C:\Freescale\PC-lint\fsl_lnt @rem Path to my local lint folder inside the project SET PROJ_LINT_PATH=%PROJ_PATH%\lint @rem Lint configuration files and includes SET LNT_INCLUDES=-i"%LOCAL_LNT_FILES%" "%LOCAL_LNT_FILES%\co- mwhc08.lnt" -i%LOCAL_LNT_FILES% @rem --------------- Run PC-lint --------------------------- %LINT_EXE% %LNT_INCLUDES% %PROJ_LINT_PATH%\proj_options.lnt %PROJ_LINT_PATH%\proj_files.lnt -vf
The batch file is called from eclipse with two arguments ( %1 and %2): with the path to the project folder and the path to the CodeWarrior installation folder. Assign them to local variables ( PROJ_PATH and CW_PATH) so you can use them inside the .lnt files. To know where your lint compiler is, use the LINT_EXE. If you store your lint configuration files outside of the PC-lint installation folder, then you have to defined a path variable for this: LOCAL_LINT_FILES. The PROJ_LINT_PATH contains the project sub-folder with all your batch and lint files for the project. In LNT_INCLUDES specify your compiler lint configuration file, plus where lint shall search for your lint configuration files.