Main Content

Bug Finder Analysis in Simulink

Check C/C++ code imported into and generated from Simulink® models for defects

Use Polyspace® from the Simulink Editor or the MATLAB® Command Window to identify potential bugs, runtime errors, and coding standard violations in your Simulink model. Use Polyspace in two different steps of the verification and validation process.

Before generating code, detect and address issues that might be introduced by the custom code in your model. Analyze the custom code in the C function block, the C caller block, and the S function block. See Run Polyspace Analysis on Custom Code in Simulink Models.

After code generation, analyze the generate code for code specific issues that might not be caught in the model, such as errors due to untested parts of model or incorrect code generation options. See Run Polyspace Analysis on Code Generated with Embedded Coder.

After integrating Polyspace and MATLAB, you can run a Polyspace analysis directly from the Simulink Editor, or use MATLAB scripts to automate a Polyspace analysis. See Integrate Polyspace with MATLAB and Simulink and Run Polyspace Analysis by Using MATLAB Scripts. Alternatively, generate options files from Simulink models, and use these options files to run a Polyspace analysis on the generated code in the system command line. See Run Polyspace Analysis on Generated Code by Using Packaged Options Files.

Functions

polyspacesetupIntegrate Polyspace installation with Simulink
pslinkrunCrossReleaseAnalyze C/C++ code generated by R2020b or newer Embedded Coder versions by using a different version of Polyspace that is more recent than the Simulink version (Since R2021a)
pslinkoptionsCreate an options object to customize configuration of a Simulink model, generated code or a S-Function block. Use the object to specify configuration options for these Simulink objects in a Polyspace run from the MATLAB command line
pslinkrunRun Polyspace analysis on model, system, or S-Function
pslinkfunManage model analysis at the command line
polyspacePackNGoGenerate and package options files to run Polyspace analysis on code generated from Simulink model (Since R2020b)
polyspaceArtifactGenerate artifacts to run Polyspace analysis on code generated from Simulink model (Since R2024a)

Classes

polyspace.ModelLinkOptionsCreate a project configuration object for running Polyspace analysis on generated code

Properties

pslinkoptions PropertiesProperties for the pslinkoptions object
polyspace.ModelLinkOptions PropertiesCustomize Polyspace analysis of generated code with options object properties

Model Settings

expand all

Settings from (C)Settings to use for the Polyspace analysis of C code
Settings from (C++)Settings to use for the Polyspace analysis
Project configurationSet advanced configuration options to customize analysis
InputOption to choose whether to constrain Inport block variables
Tunable parametersOption to specify the assumed value of tunable parameter values during the analysis
OutputOption to verify whether output variables are within expected bounds
Model reference verification depthDepth of model reference hierarchy for Polyspace analysis
Model by model verificationOption to analyze each model or referenced model individually
Ignore model referencesOption to ignore specified model references (Since R2023b)
Model reference input/output range verificationOption to verify that input and output of model references are within specified values (Since R2024a)
Output folderPath and folder name for your analysis results
Make output folder name unique by adding a suffixOption to add a unique suffix to the results folder for every Polyspace run
Open results automatically after verificationOption to open analysis results in Polyspace user interface after analysis completes
Add results to current Simulink projectOption to add your Polyspace results to current Simulink project
Product modeChoice between Polyspace Bug Finder and Polyspace Code Prover (Since R2021b)
Use custom project fileOption to use custom configuration from a Polyspace project (.psprj) file
Enable additional file listOption to add additional supporting code files to analysis
Stub lookup tablesOption to stub autogenerated functions that use lookup tables with linear interpolation
Verify all S-function occurrencesOption to analyze all instances of selected S-Function block
Check configuration before verificationOption to check model and code configurations for errors before code analysis

Topics

Setup

Analyze Generated Code

Analyze Custom Code

Advanced Configuration

How Generated Code is Analyzed