Question
STM32F0 HAL bug: no __IO (volatile) keyword for PPP_HandleTypeDef.State
Posted on January 25, 2015 at 21:06
Hi,
I have been tracking down a bug in my application that only appeared with certain optimisation options with gcc 4.9.3.It turns out the problem is that in the STM32F0 drivers the ''State'' member of the SPI_HandleTypeDef struct (and also the UART equivalent at least, I've not checked others) is not marked as __IO (which is a macro for volatile) even though it is modified by HAL_SPI_IRQHandler.This can cause calls to functions like HAL_SPI_GetState to be optimised incorrectly.I can see that State is correctly declared __IO in the STM32F4 drivers. I can also see that v1.2.0 of the STM32F0 drivers added __IO for the ErrorCode member but seems to have missed it for State.Could someone from ST confirm this is a mistake, presumably to be fixed in the next release?Thanks. #bug #hal #stm32f0