Main Content

MISRA C Guidelines

The Motor Industry Software Reliability Association (MISRA®[1] ) has established guidelines for the use of the C Language in Critical Systems (MISRA C®).

For information about MISRA C, see

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. A major update based on feedback was published in 2004 (MISRA C:2004), followed by a minor update in 2007 known as Technical Corrigendum (TC1).

In 2007, MIRA Ltd. published the MISRA AC AGC standard, “MISRA AC AGC: Guidelines for the Application of MISRA-C:2004 in the Context of Automatic Code Generation.” MISRA AC AGC does not change MISRA C:2004 rules, rather it modifies the adherence recommendation.

In 2013, MIRA Ltd. published the MISRA C:2012 standard, “Guidelines for the use of the C language in critical systems.” MISRA C:2012 provides improvements based on user feedback and includes guidance on automatic code generation.

Embedded Coder® and Simulink® offer capabilities to minimize the potential for MISRA C rule violations. Capabilities include:

  • Code Generation Advisor, which helps you configure a model or subsystem so that the code generator is most likely to produce MISRA C:2012 compliant code. For more information, see Configure Model for Code Generation Objectives by Using Code Generation Advisor.

  • Model Advisor checks, which you can use as you developed your model or subsystem to increase the likelihood of generating MISRA C:2012 compliant code. To execute the MISRA C:2012 compliance checks your model or subsystem:

    1. Open the Model Advisor.

    2. Navigate to By Task > Modeling Guidelines for MISRA C:2012.

    3. Run the checks in the folder.

    For more information on using the Model Advisor, see Check Your Model Using the Model Advisor.

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. The results of the evaluation are published as:

  • 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 more information, see Developing a MISRA C:2012 Compliance Statement.

[1] MISRA and MISRA C are registered trademarks of MIRA Ltd., held on behalf of the MISRA Consortium.