2021-08-21 09:35 AM
Here is the warning....
../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_sd.c:2760:29: warning: 'Init.ClockDiv' may be used uninitialized in this function [-Wmaybe-uninitialized]
2760 | if ((sdmmc_clk / (Init.ClockDiv + 2U)) > SD_NORMAL_SPEED_FREQ)
Solved! Go to Solution.
2021-08-21 01:14 PM
The easiest is to disable this warning (maybe make a separate configuration with all warnings enabled, if you like so).
2021-08-21 01:14 PM
The easiest is to disable this warning (maybe make a separate configuration with all warnings enabled, if you like so).
2021-08-21 01:40 PM
Thank you Pavel A. I found that my configuration has -Wall set. And if I turn that off, the warning goes away. I don't like to see even warnings, but I have decided to leave -Wall set and put up with these questionable ones.
2021-08-22 11:42 PM
Or you could initialize Init.ClockDiv.
Allowing warnings very much leads to developers ignoring them along with futures ones that crop up.
2021-08-23 07:05 AM
This error is in a HAL driver. I don’t see how I can initialize it. The file is overwritten by cubemx.
I’ve also found the warning goes away at higher optimization levels (above debug). Does this imply there really isn’t a problem?
But I agree, I don’t like seeing any warnings. I hope ST sees this and fixes it properly.
2021-08-23 11:08 AM
To be clear, the issue is in CubeMX code generation, not the HAL driver. They are separate, and one is much more robust than the other.
Not initialization ClockDiv is only a problem if it's used.