STM32F30xx Standard Peripheral Library
The value of an expression of integer
type shall not be implicitly converted
to a different underlying type.
The value of a complex expression of
integer type shall only be casted to a
type that is not wider and of the same
signedness as the underlying type of
the expression.
A 'U' suffix shall be applied to all
constants of 'unsigned' type
The "stdint.h" defined
types are used to be
CMSIS compliant.
Conversions shall not be performed
between a pointer to object and any
type other than an integral type,
another pointer to object type or a
pointer to void.
Needed when
addressing memory
mapped registers
A cast should not be performed
between a pointer type and an
integral type.
Needed when
addressing memory
mapped registers
#include statements in a file shall
only be preceded by other
preprocessor directives or comments
This rule was violated
to be in line with the
CMSIS architecture.
How to check that your code is MISRA-C 2004 compliant
The default IAR project template provided with the STM32F30xx Standard Peripheral
Library is already pre-configured for MISRA-C 2004 compliance. Then, the user has to
enable the MISRA-C 2004 checker if needed.
To enable the IAR MISRA-C 2004 checker, go to Project->Options (ALT+F7) and then in
"General Options" Category select the "MISRA-C:2004" tab and check the "Enable MISRA-
C" box. With the default EWARM template project, all violated rules described above are
unchecked.
To use the IAR MISRA-C Checker to verify that your code is MISRA-C 2004 compliant,
please follow the following steps:
1. Enable the IAR MISRA-C 2004 Checker
2. Uncomment the "USE_FULL_ASSERT" inside the STM32f30x_conf.h file
Only the STM32F30xx standard peripherals driver are MISRA-C 2004 Compliant.
[1] MISRA-C 2004 Guidelines for the use of the C language in critical systems, Motor
Industry Software Reliability Association, October 2004