2025-06-13 6:04 AM
with a standard project with only threadx and bsp code added via STM32CubeMX code generates the MX_ThreadX_Init function in main.c but the BSP initialization functions are below this call.
MX_ThreadX_Init actually starts the kernel task switching (unlike FreeRTOS) so it never returns ... BSP init code is never reached.
Workaround is to move the BSP init code to the user block above the call to MX_ThreadX_Init in main.c.
This should be fixed in MX code generation.
2025-06-13 6:18 AM
Another work around could be to have CubeMX not generate the initialisation calls at all - then you can put them into whatever sequence you like.
2025-06-13 6:28 AM
Hello @dvescovi
Thank you for posting!
The CubeMX team is aware of this problem (as tracked by internal ticket number 196205) and it will be resolved as soon as possible.
BR,
Souhaib
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-06-13 4:38 PM
Unfortunately, that kind of defeats the whole purpose of using STM32CubeMX.... I want to do less work ... not more.;)
2025-06-14 1:33 AM
Agreed - but it is a workaround.