Main Content

Check MISRA C2023 compliance on Generated Code

R2026b

mathworks.misra.checkPolyspaceMISRA2023Compliance

Since R2026b

Dependencies: Simulink® Check™ and Polyspace®

Usage: General Modeling

Description

The check detects violations of the MISRA C:2023 industry standard in your model. Use the check in Model Advisor to analyze your model for MISRA C:2023 rule violations using Polyspace.

You can specify the directory for generated code, and results are displayed in a table format within the Model Advisor. For each violation, the check provides a link to the corresponding line in the generated code. It also maps the violation back to the relevant block in the Simulink model for tracing and resolving issues.

This check reports only the Mandatory and Required categories of Polyspace violations.

Elements under review:

  • Generated code files

Check Parameters

Use the Model Advisor Configuration Editor to define the scope of the analysis by specifying the input parameters.

ParameterDescription
Generated Code Directory

Specify the directory that contains the generated code. The check uses this path to run Polyspace analysis on the relevant files. If you leave this field empty, the check verifies whether code has been generated for the model at least once. If code generation results are available, the check uses the directory specified in the most recent code generation report. Otherwise, the check reports an error and requires you to generate code before running the analysis.

Recommended Actions and Results

Review the violations that are flagged by the check and the recommended action for fixing the issue. After applying the changes, save the model and rerun the check analysis.

Modeling ConditionRecommended Action
Violations are found during Polyspace analysis.Resolve the violations and rerun Polyspace.

Capabilities and Limitations

  • Does not support exclusions

  • Does not support sharing justifications between Model Advisor and Polyspace. Justifications added in one tool do not appear in the other.

Version History

Introduced in R2026b