Skip to main content
Associate
June 18, 2026
Question

FreeRTOS & H755ZI: many pxPortInitialiseStack() at port.c in call stack

  • June 18, 2026
  • 2 replies
  • 73 views

I am testing STM32H755 MPU using the nucleo-144 (STM32H755ZI).

I used the STM32CubeMX tool to automatically generate a basic FreeRTOS example and added an ledTask to toggle an LED.

 

void ledTaskProc(void *argument)
{
/* USER CODE BEGIN ledTaskProc */
/* Infinite loop */
for(;;)
{

if (BspButtonState == BUTTON_PRESSED)
{
/* Update button state */
BspButtonState = BUTTON_RELEASED;
/* -- Sample board code to toggle leds ---- */
if ( 0 == led_select )
BSP_LED_Toggle(LED_GREEN);
else if ( 1 == led_select )
BSP_LED_Toggle(LED_YELLOW);
else
BSP_LED_Toggle(LED_RED);

led_select++;
if ( led_select >= LED_NUM )
led_select = 0;

/* ..... Perform your action ..... */
}
else
osDelay(10);

}
/* USER CODE END ledTaskProc */
}

The operation proceeds without any issues.

However, as shown in the image, if I set a breakpoint, I see many nested pxPortInitialiseStack() calls in the call stack.

What kind of error could this be? This is not typically seen; is it possible to remove them?

 

2 replies

ST Technical Moderator
June 18, 2026

Hello ​@Cheolhyeon Cho 

What you see is usually **not a real error**, but probably a **debugger call-stack unwinding artifact**.  
In FreeRTOS, `pxPortInitialiseStack()` is used to build the initial stack frame of each task, and when you stop on a breakpoint the debugger may incorrectly reconstruct the task stack and show many repeated `pxPortInitialiseStack()` entries.

If the application runs correctly and you do not see faults or stack overflow, this can generally be ignored. 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om
Associate
June 19, 2026

Hi, Saket.

Thanks for your quick reply.

 

I understand.

I haven't seen this before.

 

Is there any way to prevent this unnecessary pxPortInitialiseStack() from being displayed anymore?

 

I added the following items to FreeRTOSConfig.h.

/* USER CODE BEGIN Defines */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
#define configTASK_RETURN_ADDRESS NULL
/* USER CODE END Defines */

https://community.st.com/stm32cubeide-mcus-28/freertos-backtrace-problem-159746 

 

Is this a complete solution?

 

Cheolhyeon