ModusToolbox Power Conversion Middleware
All Data Structures Functions Variables Typedefs Modules Pages
MISRA-C:2012 Compliance

This section describes MISRA-C:2012 compliance and deviations for the Power Conversion Middleware.

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 - deviations that are applicable for particular class of circumstances.
  • Specific Deviations - deviations that are applicable for a single instance in a single file.

Project Deviations are documented in current section below.

Specific deviations are documented in the source code, close to the deviation occurrence. For each deviation a special macro identifies the relevant rule or directive number, and reason.

Verification Environment

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

Project Deviation

The list of deviated required rules is provided in the table below. Advisory rules deviation is not documented, as not required per MISRA specification.

MISRA Rule Rule Description Description of Deviation(s)
Rule 1.2 Language extensions should not be used. The Power Conversion Middleware supports ISO:C99 standard.
Rule 2.5 A project should not contain unused macro declarations. The middleware library provides API to the hardware. The macro is part of API, which is defined for application-level only.
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.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 8.5 An external object or function shall be declared once in one and only one file False positive. 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 8.6 An identifier with external linkage shall have exactly one external definition Transport functions in Power Conversion Middleware core declared as WEAK to enable flexibility and make design extensible. The usage of the WEAK qualifier guarantees that only one definition is used.
Rule 8.7 Functions and objects should not be defined with external linkage if they are referenced in only one translation unit. The Power Conversion Middleware provides API to the hardware. The functions and objects with external linkage are part of API, which are defined for application-level only.
Rule 11.4 A cast shall not remove any const or volatile qualification from the type pointed to by a pointer. The cast from unsigned int to pointer does not have any unintended effect, as it is a consequence of the definition of a structure based on hardware registers.