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"
Directive | Compliance |
---|---|
Dir 1.1 | Noncompliant |
"Compilation and Build"
Directive | Compliance |
---|---|
Dir 2.1 | Noncompliant |
"Requirements Traceability"
Directive | Compliance |
---|---|
Dir 3.1 | Noncompliant |
"Code Design"
Directive | Compliance |
---|---|
Dir 4.1 | Compliant |
Dir 4.3 | Noncompliant |
Dir 4.10 | Noncompliant |
"Standard C Environment"
Rule | Compliance |
---|---|
1.5 | Compliant |
"Unused Code"
Rule | Compliance |
---|---|
2.1 | Compliant |
2.2 | Compliant |
"Comments"
Rule | Compliance |
---|---|
3.1 | Noncompliant: Check for unsupported block names (Embedded Coder) |
3.2 | Noncompliant |
"Character Sets and Lexical Conventions"
Rule | Compliance |
---|---|
4.1 | Noncompliant |
"Identifiers"
Rule | Compliance |
---|---|
5.1 | Compliant |
5.8 | Compliant |
"Declarations and Definitions"
Rule | Compliance |
---|---|
8.2 | Compliant |
8.3 | Compliant |
8.6 | Noncompliant |
8.8 | Compliant |
"Initialization"
Rule | Compliance |
---|---|
9.1 | Compliant |
"Pointer Type Conversion"
Rule | Compliance |
---|---|
11.1 | Noncompliant |
11.3 | Noncompliant |
11.6 | Noncompliant |
11.8 | Compliant |
"Expressions"
Rule | Compliance |
---|---|
12.2 | Noncompliant |
"Side Effects"
Rule | Compliance |
---|---|
13.5 | Compliant: Deviation |
"Control Statement Expressions"
Rule | Compliance |
---|---|
14.3 | Compliant |
"Control Flow"
Rule | Compliance |
---|---|
15.6 | Compliant |
"Functions"
Rule | Compliance |
---|---|
17.3 | Compliant |
"Preprocessing Directives"
Rule | Compliance |
---|---|
20.9 | Compliant |
"Standard Libraries"
Rule | Compliance |
---|---|
21.1 | Compliant |
21.2 | Compliant |
See Also
MISRA C:2012 Compliance Summary Tables (Embedded Coder) | CERT C Compliance Summary Tables (Embedded Coder)