UM1581
However if you want to keep this functionality in your final application, reuse the
assert_param macro defined within the library to test the parameter values before calling
the library functions.
1.1.6
MISRA-C 2004 compliance
The C programming language is growing in importance for embedded systems. However,
when it comes to developing code for safety-critical applications, this language has many
drawbacks. There are several unspecified, implementation-defined, and undefined aspects
of the C language that make it unsuited for developing safety-critical systems.
The Motor Industry Software Reliability Association‟s Guidelines for the use of the C
language in critical systems (MISRA-C 2004 [1] ) describe a subset of the C language well
suited for developing safety-critical systems.
The STM32F30xx standard peripheral drivers (STM32f30xx_StdPeriph_Driver) have been
developed to be MISRA-C 2004 compliant.
The following section describes how the StdPeriph_Driver complies with MISRA-C 2004
(as described in section 4.4 Claiming compliance of the standard [1]):
A compliance matrix has been completed which shows how compliance has been
enforced.
The whole STM32F30xx_StdPeriph_Driver C code is compliant with MISRA-C 2004
rules. Deviations are documented.
A list of all instances of rules not being followed is being maintained, and for each
instance there is an appropriately signed-off deviation.
All the issues listed in section 4.2 "The programming language and coding context of
the standard" [1], that need to be checked during the firmware development phase,
have been addressed during the development of the STM32F30xx standard
peripherals driver and appropriate measures have been taken.
Compliance matrix
The compliance of the STM32F30xx standard peripherals driver
(STM32F30xx_StdPeriph_Driver) with MISRA-C 2004 has been checked using the IAR
C/C++ Compiler for ARM. MISRA compliance applies only to STM32F30xx standard
peripherals driver source file. Examples and project files are not MISRA compliant.
Two options are available for checking MISRA compliance:
The compiler: IAR C/C++ Compiler for ARM V6.40
Manual checking (code review)
The following table lists the MISCRA-C 2004 rules that are frequently violated in the code.
MISRA-C
2004 rule
number
1.1
5.1
Table 3: MSIRA-C 2004 compliance matrix
Required/Advisory
Required
Compiler is configured to allow
extensions - all code shall conform to
ISO 9899 standard C, with no
extensions permitted
Required
Identifiers (internal and external)
shall not rely on significance of more
than 31 characters
DocID023800 Rev 1
STM32F30xx Standard Peripheral Library
Summary
Reason
IAR compiler
extensions are enabled.
This was allowed to
support new CMSIS
types.
Some long parameters
names are defined for
code readability.
21/584
Need help?
Do you have a question about the STM32F31xx and is the answer not in the manual?