cancel
Showing results for 
Search instead for 
Did you mean: 

threadx does not allow BSP code to initialize

dvescovi
Associate II

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. 

4 REPLIES 4
Andrew Neil
Super User

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.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Souhaib MAZHOUD
ST Employee

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.

Unfortunately, that kind of defeats the whole purpose of using STM32CubeMX.... I want to do less work ... not more.;)

Agreed - but it is a workaround.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.