Keil uVision Static Analysis Quick Start

MichaelCMichaelC Posts: 22 admin
edited May 30 in C/C++test

In this post, I will go over how to get started with using C++test static analysis on Keil uVision projects. In this example, I will be using the C++test example MDK-ARM Sensor project. This can be found within ${CPPTEST_HOME}/Examples/Embedded/MDK-ARM/Sensor.

In this post I will use the following:
C++test 10.4.2 Professional Standalone Edition
Keil uVision 5

Note: some of the images within the post have been significantly reduced in size. Right-click on each of the images and select "Open image in new tab"

This tutorial works on older versions of C++test and Keil uVision 4:

  1. Copy the Example Folder into a new location.
  2. Open your uVision IDE.
  3. Go to File -> Open and navigate to the MDK-ARM Sensor project and open the Sensor.uvproj
  4. Right-Click on the Top level of your project and select "Options for Target" go to the Output Tab and make sure that the "Create Batch File" option is enabled.
  5. Go to Project -> Build Target. Your project should build without any errors and a new batch file should be generated in the project directory.
  6. Open your Command Prompt.
  7. Navigate to the MDK-ARM Sensor Project File and run the following command

cpptesttrace --cpptesttraceProjectName=Sensor --cpptesttraceOutputFile=Sensor.bdf --cpptesttraceResponseFileOption="--Via" "C++test - Simulator.BAT

The cpptesttrace executable will trace throughout all of the project settings specified within the generated batch file and generate a bdf.
8. Open C++test. You can either open C++test from the command line or on the C++test shortcut on your Desktop. From the command line, you can open C++test by running cpptest.exe
9. Import the Sensor.bdf. This can be done by going to New -> Other -> C/C++test -> Create project from a build data file.

  1. Click on the top left to select have C++test point to the Sensor.bdf file then select Finish

The Sensor project will now appear within the Navigator view.

  1. Select the Top of the project.
  2. Go to Parasoft -> Test Configurations -> Builtin -> Static Analysis -> Effective C++.
  3. Select Run Test

You should see that 62/62 files have been scanned with 865 Tasks Reported

Review your Quality Tasks View to review the violations reported from C++test.

This concludes the Quick Start guide for Static Analysis with Keil uVision. Happy Testing!

Sign In or Register to comment.