cancel
Showing results for 
Search instead for 
Did you mean: 

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

TJack.2
Associate III

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.

0 REPLIES 0