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. When applicable, there are explanatory notes that provide information relevant to compliance methods or actions that you can perform to satisfy the directive or rule.

  • 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. Interprocessor communication (IPC) peripheral is not covered for MISRA C compliance.

"The Implementation"

DirectiveCompliance
Dir 1.1

Noncompliant

"Compilation and Build"

DirectiveCompliance
Dir 2.1

Noncompliant

"Requirements Traceability"

DirectiveCompliance
Dir 3.1

Noncompliant

"Code Design"

DirectiveCompliance
Dir 4.1

Compliant

Dir 4.3

Noncompliant

Dir 4.10Noncompliant

"Standard C Environment"

RuleCompliance
1.5Compliant

"Unused Code"

RuleCompliance
2.1

Compliant

2.2Compliant

"Comments"

RuleCompliance
3.1

Noncompliant: Check for unsupported block names (Embedded Coder)

3.2Noncompliant

"Character Sets and Lexical Conventions"

RuleCompliance
4.1Noncompliant

"Identifiers"

RuleCompliance
5.1

Compliant

5.8

Compliant

"Declarations and Definitions"

RuleCompliance
8.2Compliant
8.3Compliant
8.6Noncompliant
8.8Compliant

"Initialization"

RuleCompliance
9.1

Compliant

"Pointer Type Conversion"

RuleCompliance
11.1Noncompliant
11.3

Noncompliant

11.6Noncompliant
11.8

Compliant

"Expressions"

RuleCompliance
12.2

Noncompliant

"Side Effects"

RuleCompliance
13.5

Compliant:

Deviation

"Control Statement Expressions"

RuleCompliance
14.3

Compliant

"Control Flow"

RuleCompliance
15.6Compliant

"Functions"

RuleCompliance
17.3

Compliant

"Preprocessing Directives"

RuleCompliance
20.9Compliant

"Standard Libraries"

RuleCompliance
21.1

Compliant

21.2

Compliant

See Also

(Embedded Coder) | (Embedded Coder)

Go to top of page