Linking Failed when using vTaskGetRunTimeStats (esp32 on PlatformIO)

Im having trouble with vTaskGetRunTimeStats() on PlatformIO.
Has anyone used the FreeRTOS API vTaskGetRunTimeStats() to measure task execution time on ESP32? I have defined the necessary macros and functions as per the documentation, but it seems able to compile successfully while encountering a linking error: undefined reference to ‘vTaskGetRunTimeStats’.

Please set the following in your FreeRTOSConfig.h:

#define configGENERATE_RUN_TIME_STATS 1
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
#define configUSE_TRACE_FACILITY 1

Thank you! I added those lines in FreeRTOSConfig.h, but still failed.


by the way, I saw these in FreeRTOSConfig.h, I don’t know wether it is able to influence the definition outside or not.

I think you need to set them using idf.py menuconfig: Project Configuration - ESP32 - — ESP-IDF Programming Guide latest documentation

1 Like

I‘ll try this after installing ESP-IDF.