在 IAR EW 中使用PC-Lint 【转】

以下内容为转自 中国百科,全为英文,回头我看明白了写个中文的。


Using Gimpel’s PC-lint with IAR Embedded Workbench and a MAX

Introduction

To provide ongoing support for MAXQ microcontrollers and development of application firmware, Maxim 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

      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.
      Download PC-LintFiles.zip
      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.

      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.

      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.

Note

      : any directories that contain spaces or other nonstandard punctuation need to be in quotes.

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

Figure 2. Batch file.
Figure 2. Batch file.

      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 Maxim 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

      .

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.

      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.
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.

      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.
    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

    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. 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 Maxim’s MAXQ microcontrollers. This step-by-step guide and the required files for the MAXQ make the integration simple.

IAR Embedded Workbench is a registered trademark of IAR Systems AB.

IAR is a trademark of IAR Systems AB.

MAXQ is a registered trademark of Maxim Integrated Products, Inc

sing Gimpel’s PC-lint with IAR Embedded Workbench and a MAX

Introduction

To provide ongoing support for MAXQ microcontrollers and development of application firmware, Maxim 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

      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.
      Download PC-LintFiles.zip
      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.

      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.

      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.

Note

      : any directories that contain spaces or other nonstandard punctuation need to be in quotes.

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

Figure 2. Batch file.
Figure 2. Batch file.

      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 Maxim 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

      .

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.

      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.
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.

      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.
    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

    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. 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 Maxim’s MAXQ microcontrollers. This step-by-step guide and the required files for the MAXQ make the integration simple.

IAR Embedded Workbench is a registered trademark of IAR Systems AB.

IAR is a trademark of IAR Systems AB.

MAXQ is a registered trademark of Maxim Integrated Products, Inc.

分享到: 更多
版权申明:

本站保留所有原创文章的版权,本站地址:奔跑的博客[http://www.elecbench.com]

原创文章转载时请注明出处,并添加文章所在页面的链接:http://www.elecbench.com/%e5%9c%a8-iar-ew-%e4%b8%ad%e4%bd%bf%e7%94%a8pc-lint-%e3%80%90%e8%bd%ac%e3%80%91/

本站所有 2010年3月4日 以后发表、未标明为“转载”的文章均是本站原创。

发表评论?

1 条评论。

  1. Hello there, You have done a great job. I’ll certainly digg it and personally suggest to my friends. I’m sure they’ll be benefited from this site.

发表评论


(设置自己的个性头像)

*

申请属于你的免费顶级域名