Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Keil uVision Static Analysis Quick Start

Options
MichaelC
MichaelC Posts: 28 admin
edited August 2019 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.
7b. Alternatively, we can import via Keil Project. Go to File -> New -> Other -> C/C++test -> Import Keil uVision project

Point to the location of your .uvproj or .uvprojx then select next then select the location for the imported project (we recommend using the workspace location if possible)

  • Enabling Use Path Variable to define linker folder locations (if applicable) and re-define the Path Variable Name so that it's easily recognizable and could be shared with other team members.

  • Ensure that Path Variable Value to the hard-coded path of your Keil Project on your machine.

  • In the Project target Settings select Use other build target (if applicable) and select C++test - Simulator

  1. 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
  2. Import the Sensor.bdf. This can be done by going to New -> Other -> C/C++test -> Create project from a build data file.

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