Skip to main content
TJack.2
Associate III
December 29, 2020
Question

[SOLVED] Undefined HAL_StatusTypeDef when compiling HAL drivers, hundreds of times.

  • December 29, 2020
  • 0 replies
  • 3233 views

All the drivers reported this and related errors, as if stm32xx_hal_def.h were just not included.  It turned out to be because I had included stm32xx_hal_gpio.h in my program, which needed to access the GPIOs directly.

This header does #include stm32_hal_def.h which eventually goes on to call down all the configured driver headers, BEFORE completing itself. When invoked 'normally' through .._hal.h this recursion is blocked by the #ifndef at the beginning of each file, as long as they are processed in sequence. Taking any one of them out of order throws this obscure error.

So the solution is to always include stm32f4xx_hal.h for direct access to any peripheral, rather than the individual header.

This topic has been closed for replies.