Verify Generated Code Using Polyspace Code Prover
If you generate C or C++ code from models using Embedded Coder, you can check the generated code for run-time errors. Polyspace Code Prover proves code correctness, finds run-time errors, and checks for MISRA-C compliance in generated and handwritten code.
This example contains a demo model from which you can generate code and then analyze the generated code.
Open and explore the example model. The model contains a controller subsystem, which itself contains many subsystems. One of the subsystems has some issues that can lead to run-time errors in the generated code.
Generate and Analyze Code
Generate code from the controller subsystem or one of the subsystems underneath. Then, run Polyspace Code Prover on the generated code. You can trace back from run-time errors found in the generated code to corresponding blocks in the model. You can also check for coding rule violations and add annotations on blocks to justify the violations. For details, see Analyze Code Generated from Simulink Subsystem.
The controller subsystem also contains an S-Function block. You can separately analyze the C code that the S-Function block refers to. For details, see Analyze S-Function Code.