cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with MX-generated code when BSP and ThreadX both enabled for Nucleo board

nicgreenway
Associate II

I have a project on a H563ZI Nucleo board, and noticed an issue when I enable both the Board Support Package (BSP) options and ThreadX.

The MX-generated code in main.c places the BSP initialisation after the call to MX_ThreadX_Init()  - see snippet below.  This means the BSP code is unreachable and the components are not initialised.

The workaround is simple (copy the BSP code into the USER CODE 2 section), but it should probably be looked at.

 

Snippet of automatically MX-generated code from main.c:

 

/* USER CODE END 2 */

 

MX_ThreadX_Init();

 

/* Initialize leds */

BSP_LED_Init(LED_GREEN);

BSP_LED_Init(LED_YELLOW);

BSP_LED_Init(LED_RED);

 

/* Initialize USER push-button, will be used to trigger an interrupt each time it's pressed.*/

BSP_PB_Init(BUTTON_USER, BUTTON_MODE_EXTI);

 

/* Initialize COM1 port (115200, 8 bits (7-bit data + 1 stop bit), no parity */

BspCOMInit.BaudRate = 115200;

BspCOMInit.WordLength = COM_WORDLENGTH_8B;

BspCOMInit.StopBits = COM_STOPBITS_1;

BspCOMInit.Parity = COM_PARITY_NONE;

BspCOMInit.HwFlowCtl = COM_HWCONTROL_NONE;

if (BSP_COM_Init(COM1, &BspCOMInit) != BSP_ERROR_NONE)

{

Error_Handler();

}

 

/* We should never get here as control is now taken by the scheduler */

 

/* Infinite loop */

/* USER CODE BEGIN WHILE */

2 REPLIES 2
Souhaib MAZHOUD
ST Employee

Hello @nicgreenway 

Thank you for bringing this issue to our attention. An internal ticket has been escalated internally (196203 for internal follow-up) and it will be fixed as soon as possible.

Thx

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.

marouncz
Associate

It has been 7 months since this issue has been posted, new version of STM32CubeIDE was released recently, but still not fixed. (Encountered the same problem with NUCLEO-U545 BSP and THREADX)