You can refer to any Application Template available on TouchGFX Designer but for instance you can look at the Application Template STM32F746G-DISCO with the TouchGFX Demo 1. This will tell you how both on the hardware development and GUI development side you implement the MCU load.
Here's a few extra pointers to look for in any of the demos that Alexandre mentioned.
This code is required in FreeRTOSConfig.h
/* USER CODE BEGIN Defines */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
#define traceTASK_SWITCHED_OUT() xTaskCallApplicationTaskHook( pxCurrentTCB, (void*)1 )
#define traceTASK_SWITCHED_IN() xTaskCallApplicationTaskHook( pxCurrentTCB, (void*)0 )
/* USER CODE END Defines */
If you're using FreeRTOS - this code is required in your OSWrappers.cpp. We don't have examples for other OS.
// 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);
}
}
Then some MCU Instrumentation is required in order to get the clocl cycle count for a particular MCU family, in this case F7 - TouchGFX HAL will call these functions if instrumentation is configured.