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:
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 .
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.
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.
|Fixed-Point Designer™||Create/maintain models.|
Generate C code.
Execute MISRA C:2012 Model Advisor checks.[a]
|Polyspace® Bug Finder™|
Identify bug/coding defects.
Use the Polyspace Bug Finder MISRA C:2012 Checker (Polyspace Bug Finder) to analyze the generated code against the MISRA C:2012 Directives and Rules (Polyspace Bug Finder) and provide information about violations.
|Polyspace Code Prover™|
Prove absence of run-time errors.
Use the Polyspace Code Prover MISRA C:2012 checker (Polyspace Code Prover) to analyze the generated code against the MISRA C:2012 Directives and Rules (Polyspace Code Prover) and provide information about violations.
[a] MISRA C:2012 checks are available only when you have a Simulink Check or Embedded Coder license.
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.