CMSIS-Core (Cortex-M)  Version 5.1.2
CMSIS-Core support for Cortex-M processor-based devices
 All Data Structures Files Functions Variables Enumerations Enumerator Groups Pages
MISRA-C Deviations

CMSIS-Core (Cortex-M) uses the common coding rules for CMSIS components that are documented under Introduction.

CMSIS-Core (Cortex-M) violates the following MISRA-C:2004 rules:

  • Required Rule 8.5, object/function definition in header file.
    Violated since function definitions in header files are used for function inlining'.
  • Advisory Rule 12.4, Side effects on right hand side of logical operator.
    Violated because volatile is used for core register definitions.
  • Advisory Rule 14.7, Return statement before end of function.
    Violated to simplify code logic.
  • Required Rule 18.4, declaration of union type or object of union type: '{...}'.
    Violated since unions are used for effective representation of core registers.
  • Advisory Rule 19.4, Disallowed definition for macro.
    Violated since macros are used for assembler keywords.
  • Advisory Rule 19.7, Function-like macro defined.
    Violated since function-like macros are used to generate more efficient code.
  • Advisory Rule 19.16, all preprocessing directives must be valid.
    Violated to set default settings for macros.

CMSIS-Core (Cortex-M) violates the following MISRA-C:2012 rules:

  • Directive 4.9, function-like macro defined.
    Violated since function-like macros are used to generate more efficient code.
  • Rule 1.3, multiple use of '#/##' operators in macro definition.
    Violated since function-like macros are used to generate more efficient code.
  • Rule 11.4, conversion between a pointer and integer type.
    Violated because of core register access.
  • Rule 11.6, cast from unsigned long to pointer.
    Violated because of core register access.
  • Rule 13.5, side effects on right hand side of logical operator.
    Violated because of shift operand is used in macros and functions.
  • Rule 14.4, conditional expression should have essentially Boolean type.
    Violated since macros with several instructions are used.
  • Rule 15.5, return statement before end of function.
    Violated to simplify code logic.
  • Rule 20.10, '#/##' operators used.
    Violated since function-like macros are used to generate more efficient code.
  • Rule 21.1, reserved to the compiler.
    Violated since macros with leading underscores are used.

<device>.h files generated by SVDConv.exe violate the following MISRA-C:2004 rules:

  • Advisory Rule 20.2, Re-use of C90 identifier pattern.
    Violated since CMSIS macros begin with '__'. Since CMSIS is developed and verified with various compilers this approach is acceptable and avoids conflicts with user symbols.
  • Advisory Rule 19.1, Declaration before #include.
    Violated since Interrupt Number Definition Type (IRQn_Type) must be defined before including the core header file.