PC-lint Manuel for MAXQ

Abstract

This article is a step-by-step guide to successfully add Gimpel Software's PC-lint version 9 as a tool in an IAR C compiler for MAXQ® version 2.20I.

Introduction

To provide ongoing support for MAXQ microcontrollers and development of application firmware, Analog Devices is simplifying the integration of PC-lint from Gimpel Software into an IAR Embedded Workbench® C compiler.

Many developers use the popular static code analyzer, PC-lint, during code development. This article guides you to successfully add PC-lint version 9 as a tool in an IAR C compiler for MAXQ version 2.20I.

Integration Procedure

  1. Install a copy of PC-lint version 9 to its default directory of C:\lint and install a copy of the IAR Embedded Workbench software with the C compiler for MAXQ version 2.20I on the PC.
  2. Download PC-LintFiles.zip
  3. This .zip consists of the following five files which are required to integrate PC-lint into an IAR Embedded Workbench project:

       
    co-iar.lnt //Compiler Options for IAR C
    LIN.bat //Batch file used by IAR to call PC-lint explicitly
    Std.lnt //Standard lint options including header locations
    options.lnt //Error suppression options
    au-misra2.lnt //MISRA 2004 author options

    These files are a good example of how PC-lint can be configured. Once you are familiar with PC-lint, these files can be adjusted to suit your own policies. Perform the following steps for each project with PC-lint.

    1. Unzip PC-LintFiles.zip into your IAR project root directory. The project root directory is the folder which contains the .ewp file for your IAR project. This example is located in C:\Users\John.Doe\MyProject. Figure 1 shows these five files in the IAR project root directory which also contains various *.C and *.H files, along with the *.ewp file.

    Figure 1. IAR project root directory.

    Figure 1. IAR project root directory.

    1. Upon starting a new project, two of these five files need to be modified to reflect your project's directory. First, open LIN.bat with a text editor and replace the example directory with your IAR project root directory, as seen in Figure 2. Save this updated file.
    2. Note: any directories that contain spaces or other nonstandard punctuation need to be in quotes.

      c:\lint\Lint-nt.exe <YOUR_IAR_DIRECTORY_HERE>\std.lnt %1

      Figure 2. Batch file.

      Figure 2. Batch file.

    1. The second file to modify is Std.lnt. PC-lint needs to know where all the #include files for the IAR project are located. This is done with the "-i" directive in the Std.lnt file. Open Std.lnt with a text editor. Add all folders that contain an included file from the IAR project in the format shown in Figure 3. The first directory, C:\Users\John.Doe\MyProject, contains all files that have been created by the developer for the project. Replace the example directory with your IAR project root directory. The second directory, C:\Program Files (x86)\IAR Systems\Embedded Workbench 4.0\MAXQ\inc, contains device-specific files provided by Analog Devices that do not need to be edited and will be located in a similar directory of IAR Systems, depending on where IAR project was installed. Check where IAR Systems was installed and update the directories in this file. The last directory contains the stdio.h file and will be located in a similar directory of IAR Systems. After updating these directories, save this file.
    2. Note: any directories that contain spaces or other nonstandard punctuation need to be in quotes.

      Figure 3. Std.lnt file.

      Figure 3. Std.lnt file.

    1. Open your IAR project. From the task bar select Tools > Configure Tools > New. Fill in these parameters and check the box for Redirect to Output Window. Figure 4 shows how the end result should look. Once completed, select OK.
    2.    
      Menu Text: PC-lint Project
      Command: $PROJ_DIR$\LIN.BAT
      Argument: "$PROJ_DIR$\*.c"

      Figure 4. IAR Configure Tools menu.

      Figure 4. IAR Configure Tools menu.

    1. The IAR project will now have a tool named PC-lint Project under Tools. When selected, PC-lint will run its analysis on the project and output the results in the Tool output window.
    2. Once PC-lint is successfully integrated to the IAR Embedded Workbench Tools menu, you can adjust the error suppression and functionality of PC-lint by editing the options.lnt file. See the PC-lint manual available at www.gimpel.com/html/pcl.htm. (See the PC-lint reference manual provided with the software or visit the support site at www.gimpel.com/html/support.htm for more information on error suppression.)

    Troubleshooting Help

    1. If PC-lint shows an error that it is unable to locate source code or header files, go back and check all your directories. Remember that directories with spaces and other punctuation need to be in quotes. Also, make sure that all folders containing #include files are listed.
    2. If PC-Lint cannot locate files contained in the PC-LintFiles.zip which were unzipped into your IAR project root directory, then a direct path can be added in the Std.lnt file to point to the unfound file.

    Summary

    PC-lint is a widely used static code analyzer. This tool can be incorporated into the IAR Embedded Workbench software and utilized when developing firmware for Analog Devices' MAXQ microcontrollers. This step-by-step guide and the required files for the MAXQ make the integration simple.