Developing a MISRA C Standard Compliance Statement
As part of the model development process, it is important that C code generated by Embedded Coder® from Simulink® and Stateflow® complies with industry coding standards.
When using MISRA C:2012 coding guidelines to evaluate the quality of your generated C code, you are required per section 5.3 of the MISRA C:2012 Guidelines for the Use of C Language in Critical Systems document to prepare a compliance statement for the project being evaluated. To assist you in the development of this compliance statement, MathWorks® evaluates the MISRA C:2012 guidelines against C code generated by using Embedded Coder and provides the following information:
Compliance Summary Tables, which identify the method used to obtain compliance for each rule and directive.
Deviations, which identify rules or directives that are not compliant.
For information about the process MathWorks uses to evaluate generated C code against MISRA C:2012 guidelines, see MathWorks Process for Identifying Violations of MISRA C:2012 Guidelines in Generated C Code.
For additional information about the MISRA™ organization, their coding guidelines, and the MISRA publication timeline, see www.misra.org.uk .
Disclaimer
While adhering to the recommendations in the MISRA C:2012 Compliance and Deviations for Code Generated using Embedded Coder documentation will reduce the risk that an error is introduced during development and not be detected, it is not a guarantee that the system being developed will be safe. Conversely, if some of the recommendations are not followed, it does not mean that the system being developed will be unsafe.
MathWorks Process for Identifying Violations of MISRA C:2012 Guidelines in Generated C Code
To determine any potential violations in the generated code, MathWorks maintains an extensive set of test models that cover the standard usage of compliant blocks. For each release, MathWorks uses these test models with the following products to evaluate the modeling, code generation, and analysis of generated code.
Product | Purpose |
---|---|
Simulink | Create/maintain models. |
Stateflow | Create/maintain models. |
Fixed-Point Designer™ | Create/maintain models. |
Embedded Coder | Generate C code. |
Simulink Check™ | Execute MISRA C:2012 Model Advisor checks.a |
Polyspace® Bug Finder™ | Identify bug/coding defects. Use the checkers for MISRA C:2012 Directives and Rules (Polyspace Bug Finder) to analyze the generated code and provide information about violations. |
a MISRA C:2012 checks are available only when you have a Simulink Check or Embedded Coder license. |
Note
The compliance analysis performed by the Polyspace MISRA C:2012 Checker assesses C code generated by Embedded Coder. No assessment is made of the Embedded Coder tool chain. Handwritten C code and third-party libraries that are used with code generated by Embedded Coder are not considered. Other MISRA C™ code analysis tools can yield different results.