Main Content

MISRA C Compliance for C2000 Peripherals and Generated Code

MathWorks® evaluates C code generated by device driver blocks in C2000™ Microcontroller Blockset. The results from this effort are available in these compliance summary tables. These tables also identify methods used to obtain compliance:

  • Compliant: Compliance to the rule/directive is achieved through adherence to the code generation process, modeling guidelines, or Model Advisor checks.

  • Noncompliant - The rule or directive might not be fully satisfied due to guideline applicability limitations, modeling constraints, or intended deviations.

  • Deviation: The rule or directive is not compliant.

These tables align with the published MISRA™ C:2023 document. The MISRA C:2023 standard consolidates these guidelines:

  • MISRA C:2012 rules and directives.

  • Clarifications added in technical corrigendum 1 (TC1) and technical corrigendum 2 (TC2).

  • New rules and modifications added in amendment 1 (AMD1), amendment 2 (AMD2), amendment 3 (AMD3), and amendment 4 (AMD4).

You can use these tables when preparing the MISRA compliance statement for your project, as required per section 5.3 of the MISRA C:2012 Guidelines for the Use of C Language in Critical Systems document. The tables do not include MISRA C:2012 Amendment 4, as C2000 Microcontroller Blockset does not generate code that includes multi-threading and atomic operations.

Note

The generated code from C2000 Microcontroller Blockset is compliant with a large subset of these coding guidelines. The noncompliant status of a rule/directive in these tables does not come under mandatory and required categories identified for automatically generated code. The evaluation does not include user-defined functions.

"Literals and constants"

RuleCompliance
7.5Compliant

"Initialization"

RuleCompliance
9.1

Compliant

9.7

Compliant

"Expressions"

RuleCompliance
12.5

Compliant

"Functions"

RuleCompliance
17.3

Compliant

17.4

Compliant

17.6

Compliant

17.9

Compliant

"Pointers and arrays"

RuleCompliance
18.10Compliant

"Overlapping storage"

RuleCompliance
19.1Compliant

"Standard Libraries"

RuleCompliance
21.13

Compliant

21.17

Compliant

21.18

Noncompliant

21.19

Compliant

21.20

Compliant

21.22

Compliant

"Resources"

RuleCompliance
22.2

Compliant

22.4

Compliant

22.5

Compliant

22.6

Compliant

22.12

Compliant

22.14

Compliant

22.20

Compliant

See Also

(Embedded Coder) | (Embedded Coder)