在 Simulink 中进行 Code Prover 分析
使用 Polyspace® 标识 Simulink 模型中潜在的 Bug、运行时错误以及编码标准违规。在验证和确认过程的两个不同步骤中使用 Polyspace。
在生成代码之前,请检测并解决模型中的自定义代码可能引入的问题。C function 块、C caller 块和 S function 块中包含自定义代码。请参阅Run Polyspace Analysis on Custom Code in Simulink Models。
在生成代码后,分析生成的代码,找出模型中可能没有发现的特定于代码的问题,例如,由于模型的未测试部分或不正确的代码生成选项而导致的错误。请参阅对通过 Embedded Coder 生成的代码运行 Polyspace 分析。
在集成 Polyspace 和 MATLAB® 后,您可以直接从 Simulink 工具条运行 Polyspace 分析,也可以使用 MATLAB 脚本自动执行 Polyspace 分析。请参阅Integrate Polyspace with MATLAB and Simulink和Run Polyspace Analysis by Using MATLAB Scripts。另外,还可以从 Simulink 模型生成选项文件,并在系统命令行中使用这些选项文件对生成的代码运行 Polyspace 分析。请参阅Run Polyspace Analysis on Generated Code by Using Packaged Options Files。
函数
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 |
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 |
类
polyspace.ModelLinkOptions | Create a project configuration object for running Polyspace analysis on generated code |
属性
pslinkoptions Properties | Properties for the pslinkoptions object |
polyspace.ModelLinkOptions Properties | Customize Polyspace analysis of generated code with options object properties |
模型设置
主题
设置
- 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 when Integrating Polyspace with MATLAB and Simulink
Troubleshoot why Polyspace fails to integrate with MATLAB and Simulink.
分析生成的代码
- 对通过 Embedded Coder 生成的代码运行 Polyspace 分析
检查通过 Embedded Coder® 生成的代码是否存在 Bug、运行时错误或编码违规情况。
- 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.
分析自定义代码
- 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.
高级配置
- 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.
如何分析生成的代码
- 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.
- Default Polyspace Options for Code Generated with TargetLink
Some Polyspace options such as macro definitions and paths to include folders are set by default.