Bug Finder Analysis in Simulink
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
polyspacesetup | Integrate Polyspace installation with Simulink |
pslinkrunCrossRelease | Analyze 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) |
pslinkoptions | Create 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 |
pslinkrun | Run Polyspace analysis on model, system, or S-Function |
pslinkfun | Manage model analysis at the command line |
polyspacePackNGo | Generate and package options files to run Polyspace analysis on code generated from Simulink model (Since R2020b) |
polyspaceArtifact | Generate artifacts to run Polyspace analysis on code generated from Simulink model (Since R2024a) |
Classes
polyspace.ModelLinkOptions | Create a project configuration object for running Polyspace analysis on generated code |
Properties
pslinkoptions Properties | Properties for the pslinkoptions object |
polyspace.ModelLinkOptions Properties | Customize Polyspace analysis of generated code with options object properties |
Model Settings
Topics
Setup
- Integrate Polyspace with MATLAB and Simulink
Integrate Polyspace with MATLAB and Simulink to identify potential bugs, run-time errors, and coding standard violations in your model and code. - Polyspace Support of MATLAB and Simulink from Different Releases
Check how Polyspace supports your release of MATLAB or Simulink. - Fix Issues When Integrating Polyspace with MATLAB and Simulink
Troubleshoot why Polyspace fails to integrate with MATLAB and Simulink.
Analyze Generated Code
- Run Polyspace Analysis on Code Generated with Embedded Coder
Check code generated with Embedded Coder® for bugs, run-time errors or coding rule violations.
- Address Polyspace Results by Annotating Simulink Blocks
Justify Polyspace results by directly annotating blocks in your Simulink model. - Run Polyspace on Code Generated by Using Previous Releases of Simulink
Analyze C/C++ code generated by using previous releases of Simulink with newer releases of Polyspace. - Run Polyspace Analysis on Code Generated with TargetLink
Check code generated from Simulink models for bugs, run-time errors or coding rule violations. - Run Polyspace Analysis on Generated Code by Using Packaged Options Files
Generate Polyspace options files from a Simulink model, and use these options files to analyze generated code by using Polyspace. - Analyze Code Generated as Standalone Code in a Distributed Workflow (Simulink)
Tutorial showing Polyspace analysis of standalone generated code by using packaged options files in a distributed workflow.
Analyze Custom Code
- Run Polyspace Analysis on Custom Code in Simulink Models
Analyze manually written C/C++ code to detect issues that might introduce run-time errors or bugs in the simulation. - Run Polyspace Analysis on S-Function Code
Tutorial showing Polyspace analysis of S-function code from within Simulink. - Run Polyspace Analysis on Custom Code in C Caller Blocks and Stateflow Charts
Tutorial showing Polyspace analysis of custom code in Simulink model. - Run Polyspace Analysis on Custom Code in C Function Block
Tutorial showing Polyspace analysis of custom code in C Function block in Simulink.
Advanced Configuration
- Recommended Model Configuration Parameters for Polyspace Analysis
For better Polyspace results, set the recommended parameters before generating code. - Configure Polyspace Options in Simulink
Configure advanced Polyspace analysis options such as code metric calculations or compiler options. - Reduce Polyspace Analysis Time by Ignoring Specific Referenced Models
Ignore specific model in the reference hierarchy to decrease the time required for a Polyspace analysis.
How Generated Code is Analyzed
- How Polyspace Analysis of Generated Code Works
Polyspace extracts function names from generated code to create amain
function for the analysis. - Default Polyspace Options for Code Generated with Embedded Coder
Some Polyspace options such as macro definitions and paths to include folders are set by default.
- Polyspace Bug Finder Defects Checkers Enabled by Default for Generated Code
Look up list of Bug Finder checkers that are enabled by default when analyzing generated code. - Default Polyspace Options for Code Generated with TargetLink
Some Polyspace options such as macro definitions and paths to include folders are set by default.