For STM32H7 BSP boards, initialize RCC_...TypeDef structs as empty #1931
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following how ST's CubeMX/CubeIDE tools generate RCC init structs and general best practice for usage of a struct like this, instances of
RCC_ClkInitTypeDef
,RCC_OscInitTypeDef
, andRCC_PeriphClkInitTypeDef
should all be initialized as empty with= {0};
. I've confirmed that failing to do this for theRCC_PeriphClkInitTypeDef
in the stm32h723nucleo example causes some undefined behavior when implementing a TUSB stack on my own STM32H723 board (I didn't use the example directly but I lifted the contents of theboard_stm32h7_clock_init()
function and tested both with/without initializing the struct).From looking at the examples, the initialization may not be needed in all cases since the subsequent population of struct members is sufficient to eliminate any issues, but just to be consistent I applied the change to all occurrences of the aforementioned structs in the STM32H7 BSP examples.
This is my first PR on Github so apologies in advance if I've made any errors; I know this is a fairly minor set of changes but thought it would be good to include.