To help assess the quality of software code used in electronic control units, the Motor Industry Software Reliability Association (MISRA) introduced guidelines for using C code in software running in automobiles and aircraft. In 1998, MIRA Ltd. published MISRA C (MISRA C:1998) to provide a restricted subset of a standardized, structured language that met Safety Integrity Level (SIL) 2 and higher.
Since then, there have been several updates to the standard, including MISRA C:2004, the MISRA AC AGC standard in the context of automatic code generation, MISRA C++:2008 for C++, and the MISRA C:2012 standard.
For more information about MISRA C, see www.misra.org.uk
Simulink®, Stateflow®, and Embedded Coder® are widely used to generate embedded software for MISRA C®. Polyspace® code verification products are used to analyze handwritten or generated code for MISRA C compliance. Polyspace Bug Finder™ supports the detection of MISRA-C: 2004, MISRA-C++:2008, MISRA C:2012, and MISRA AC AGC coding rules.
You can configure a model or subsystem so that the code generator is most likely to produce MISRA C: 2012 compliant code using the Code Generation Advisor. The generated code can be checked for MISRA compliance using Polyspace, and the results can be traced back to the model. You can annotate at the model level to provide justifications for any deviations.
Learn more about generating code that complies with MISRA:
To assist users further in their efforts to achieve MISRA C compliance, MathWorks provides MISRA Support Table using Embedded Coder with Simulink and Stateflow models.
The MISRA C analysis package includes:
- Documentation with rules summary and detailed examples
- Simulink models