Skip to main content
Senior III
June 19, 2026
Solved

Difference between OSWrappers.cpp in target\generated and touchgfx\os

  • June 19, 2026
  • 2 replies
  • 23 views

I’m seeing that there’s the same file OSWrappers.cpp in both target\generated and touchgfx\os

The one in touchgfx\os is slightly different as it contains 


static portBASE_TYPE IdleTaskHook(void* p)
{
if ((int)p) // Idle task sched out
{
touchgfx::HAL::getInstance()->setMCUActive(true);
}
else // Idle task sched in
{
touchgfx::HAL::getInstance()->setMCUActive(false);
}
return pdTRUE;
}

// FreeRTOS specific handlers
extern "C"
{
void vApplicationStackOverflowHook(xTaskHandle xTask,
signed portCHAR* pcTaskName)
{
while (1);
}

void vApplicationMallocFailedHook(xTaskHandle xTask,
signed portCHAR* pcTaskName)
{
while (1);
}

void vApplicationIdleHook(void)
{
// Set task tag in order to have the "IdleTaskHook" function called when the idle task is
// switched in/out. Used solely for measuring MCU load, and can be removed if MCU load
// readout is not needed.
vTaskSetApplicationTaskTag(NULL, IdleTaskHook);
}
}

The one in target\generated seems to be actively used meanwhile I can’t understand when the one in touchgfx\os is used.

Best answer by JohanAstrup

Hello Nico.

The one in touchgfx/os is an old file that is kept only to preserve backward compatibility. However, it is no longer maintained and therefore does not support newer versions of FreeRTOS. That is why you see differences between the two files.
The file in target/generated is the one that is actually used and maintained. The other file can be ignored in all new projects.

Best regards,
Johan

2 replies

nico23Author
Senior III
June 22, 2026

up

JohanAstrupBest answer
ST Technical Moderator
June 22, 2026

Hello Nico.

The one in touchgfx/os is an old file that is kept only to preserve backward compatibility. However, it is no longer maintained and therefore does not support newer versions of FreeRTOS. That is why you see differences between the two files.
The file in target/generated is the one that is actually used and maintained. The other file can be ignored in all new projects.

Best regards,
Johan