This page describes MISRA-C:2012 compliance and deviations for the PDL.
MISRA stands for Motor Industry Software Reliability Association. The MISRA specification covers a set of 10 mandatory rules, 110 required rules and 39 advisory rules that apply to firmware design and has been put together by the Automotive Industry to enhance the quality and robustness of the firmware code embedded in automotive devices.
The MISRA specification defines two categories of deviations (see section 5.4 of the MISRA-C:2012 specification):
Project Deviations are documented in current section below.
Specific deviations are documented in the driver source code, close to the deviation occurrence. For each deviation a special macro identifies the relevant rule or directive number, and reason.
This section provides MISRA compliance analysis environment description.
Component | Name | Version |
---|---|---|
Test Specification | MISRA-C:2012 Guidelines for the use of the C language in critical systems | March 2013 |
MISRA Checking Tool | Coverity Static Analysis Tool | 2022.12.0 |
The list of deviated required rules is provided in the table below. Advisory rules deviation is not documented, as not required per MISRA specification.
Rule ID | Rule Description | Description of Deviation(s) |
---|---|---|
Rule 3.1 | The character sequences /* and // shall not be used within a comment. | Using of the special comment symbols is need for Doxygen comment support, it does not have any impact. |
Rule 5.5 | Identifiers shall be distinct from macro names. | This rule applies to ISO:C90 standard. PDL conforms to ISO:C99 that does not require this limitation. |
Rule 5.6 | A typedef name shall be a unique identifier. | During the code analysis, the same source files are compiled multiple times with device-specific options. All typedef names are actually unique for each specific run. |
Rule 5.8 | Identifiers that define objects or functions with external linkage shall be unique. | During the code analysis, the same source files are compiled multiple times with device-specific options. All object and function identifiers are actually unique for each specific run. |
Rule 11.8 | A cast shall not remove any const or volatile qualifications from the type pointed by a pointer. | Drivers access hardware register by macro, which is used for both read and write access. In that case remove of const qualification does not have any unintended effect, as it is a consequence of the macro usage. |
Rule 21.1 | #define and #undef shall not be used on a reserved identifier or reserved macro name. | PDL header files contain preprocessor guard macros with leading underscores. PDL uses CMSIS macros with leading underscores and therefore inherits its MISRA violations. |
Rule 21.2 | A reserved identifier or macro name shall not be declared. | Some PDL macros begin with '__'. The PDL is verified with various compilers and avoids conflicts with the standard library names. |