hal: stm32cube: Fix warning when SPI STM32F0 LL API is compiled
Current implementation of LL_SPI_TransmitData16 on F0 family
generates following warning:
"warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]"
Besides being forbidden by rule, this cast is not needed, as register is
16 bits wide. Modification has been tested on F0 SoC.
stm32yyxx_ll_spi.h being included in soc.h file, warning is generated
at each compiled object, this commit allows a clean build.
This issue is referenced in ST and tracked under
reference 13359. Code will be updated on upcoming stm32cube updates.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
diff --git a/ext/hal/st/stm32cube/stm32f0xx/README b/ext/hal/st/stm32cube/stm32f0xx/README
index d7a9aab4..6eeb406 100644
--- a/ext/hal/st/stm32cube/stm32f0xx/README
+++ b/ext/hal/st/stm32cube/stm32f0xx/README
@@ -1 +1,15 @@
The current version supported in Zephyr for STM32F0 Cube is V1.9.0
+
+Patch List:
+===========
+
+*Current implementation of LL_SPI_TransmitData16 on F0 family
+ generates following warning:
+ "warning: dereferencing type-punned pointer will break strict-aliasing
+ rules [-Wstrict-aliasing]"
+ Besides being forbidden by rule, this cast is not needed, as register is
+ 16 bits wide. Modification has been tested on F0 SoC.
+ stm32yyxx_ll_spi.h being included in soc.h file, warning is generated
+ at each compiled object, this commit allows a clean build.
+Impacted files:
+ drivers/include/stm32f0xx_ll_spi.h
diff --git a/ext/hal/st/stm32cube/stm32f0xx/drivers/include/stm32f0xx_ll_spi.h b/ext/hal/st/stm32cube/stm32f0xx/drivers/include/stm32f0xx_ll_spi.h
index 26a33f5..78ad768 100644
--- a/ext/hal/st/stm32cube/stm32f0xx/drivers/include/stm32f0xx_ll_spi.h
+++ b/ext/hal/st/stm32cube/stm32f0xx/drivers/include/stm32f0xx_ll_spi.h
@@ -1385,7 +1385,7 @@
*/
__STATIC_INLINE void LL_SPI_TransmitData16(SPI_TypeDef *SPIx, uint16_t TxData)
{
- *((__IO uint16_t *)&SPIx->DR) = TxData;
+ SPIx->DR = TxData;
}
/**