我有些困惑...
我正在进行一个嵌入式项目,使用了STM32 HAL库,该库使用stm32f072rb CMSIS头文件。
HAL声称在此处严格符合ANSI-C标准。
The source code of drivers is developed in Strict ANSI-C, which makes it
independent from the development tools. It is checked with CodeSonarTM static
analysis tool. It is fully documented and is MISRA-C 2004 compliant.
我认为严格的 ANSI-C 指的是 C89,因此我在我的 Makefile 中添加了这些 gcc 标志。
CFLAGS = -std=c89\
-pedantic-errors
但是,当我使用这些标志时,会出现许多错误和警告。如果我删除这些标志,则可以编译。
我对此非常困惑。是我缺少了什么还是他们的文档有误?
以下是启用该标志后的一些GCC编译器错误... 它们在许多STM32 HAL文件中不断重复。
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
error: unknown type name 'inline'
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'NVIC_GetPriority'