Sterling
DIIDevHeads IoT Integration Server
•Created by Sterling on 8/6/2024 in #firmware-and-baremetal
Compilation Issues with STM32 HAL Libraries in Strict ANSI-C Mode
Good day everyone, I'm in a bit of a hit and miss on something guys.
I have an embedded project that starts as a blank project with an empty
main()
function, including only the STM32 HAL and CMSIS. This project uses the STM32 HAL libraries, which in turn use the stm32f072rb
CMSIS header files.
The HAL documentation states that it is written in Strict ANSI-C:
"The source code of drivers is developed in Strict ANSI-C, which makes it independent of the development tools. It is checked with the CodeSonarTM static analysis tool, fully documented, and MISRA-C 2004 compliant."
I understand Strict ANSI-C to mean C89, so I added the following GCC flags to my Makefile:
However, when I compile with these flags, I receive numerous errors and warnings. Without these flags, the code compiles without issues.
I'm very confused about this. Am I missing something, or is there a mistake in their documentation?
Here are some of the GCC compiler errors with the flags enabled, which appear repeatedly across many STM32 HAL files:
3 replies