Contents

Step 1: Set Up Project

In the Polyspace user interface, select File > New Project.

To add source code for analysis, do one of the following:

Copy the example files example.c and include.h from MATLAB_Install\polyspace\examples\cxx\Code_Prover_Example\sources to a new folder. Change the read-only status of the files. Add the folder to your project as both source and include folder. MATLAB_Install is the location of your MATLAB installation such as C:\Program Files\MATLAB\R2017a.

Add your own source code to the project.

Step 2: Configure Project and Run Verification

On the Project Browser pane, select the node below the Configuration node in your project.

The default analysis options appear on the Configuration pane. Retain the default options or change them to your requirements. For example, to check for coding rule violations, select Coding Rules & Code Metrics and specify your options. For more information on an option, place your cursor on the option and select More Help.

Click the Run Code Prover button.

Step 3: Review Results

After verification, the results open on the Results List pane. From the grouping dropdown, select None. Select each result to view the source code location on the Source pane and further information about the result on the Result Details pane. For more information about a result, on the Result Details pane, click the question mark button.

Review each result and determine whether you want to fix your code or add comments justifying the result.

MATLAB and Simulink are registered trademarks of The MathWorks, Inc. Please see www.mathworks.com/trademarks for a list of other trademarks owned by The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective owners.