STM32G4 HAL DMA start failed after software reset and Optimization -O3
These's a very strange bug in current verion of STM32G4 HAL library(STM32Cube_FW_G4_V1.6.1) and it took me 2 days to find a workaround.
The problem is:
When normal power on, everything is fine.
When compiler optimization set to -o1, everything is fine.
But if I set complier optimization to -o3, and perform a software reset(__NVIC_SystemReset()), after reset, the HAL function "HAL_SPI_TransmitReceive_DMA" will fail on "HAL_DMA_Start_IT" line.
Since my optimization is set to -o3, I can't dig deeper to find out what exactly happens. And my workaround is individually set stm32g4xx_hal_dma.c file to compile under -o1.
After doing so the problem disappears.
My IDE is uVision V5.41, and ARM Compiler version is V6.22.
