How to enable vTaskList using ESP32, PlatformIO and Arduino framework?

I’m new to FreeRTOS, but have 30+ years experience of writing code for embedded systems. I’ve use a variety of task schedulers during that time.

I am just experimenting at the moment. I’m using FreeRTOS V10.4.3 with an ESP32 dev board. I’d like to see what tasks are running, in addition to those that I explicitly created. If I use vTaskList in my code, it compiles okay, but I get a linker error because it can’t find vTaskList.

The espressif FreeRTOS(IDF) (sorry new user can’t include links) says “configUSE_TRACE_FACILITY and configUSE_STATS_FORMATTING_FUNCTIONS must both be defined as 1 for this function to be available.”

I tried editing “C:\Users\David.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\include\freertos\include\esp_additions\freertos\FreeRTOSConfig.h” to define those two macros as 1, then rebuilt my code in PlatformIO, but that didn’t fix it.

I checked I was editing the FreeRTOSConfig.h that my build uses by putting a deliberate syntax error in that file and checked the build failed to compile due the syntax error.

How do I get it to build so that vTaskList is available to the linker?

TIA for any help.

Setting these 2 configuration constants is the only requirement from FreeRTOS - FreeRTOS-Kernel/tasks.c at main · FreeRTOS/FreeRTOS-Kernel · GitHub.

You should reach out to Espressif to find out how to set them in ESP-IDF. I think you like need to run idf.py menuconfig and select some FreeRTOS option.

Thank you for the advice. I’ll repost my question in the espressif forum.

In addition to what @aggarg mentioned , since you are using FreeRTOS V10.4.3 , you can check if you are using FreeRTOS-Kernel v10.4.3 as well. If yes, in addition to the 2 macros, you should have also set configSUPORT_DYNAMIC_ALLOCATION to 1 , for vTaskList as mentioned here

1 Like

How would I do that? ATM I simply do this in my code:

 Serial.println(tskKERNEL_VERSION_NUMBER);

It think it gets that macro from the FreeRTOS task.h file:

#define tskKERNEL_VERSION_NUMBER       "V10.4.3"

I don’t know whether that is doing what you suggested or not.

How is your vTaskList defined in FreeRTOS tasks.c file ? I mean you can check the preprocessor directives in the code directly. If its uses configSUPORT_DYNAMIC_ALLOCATION, it means you are using v10.4.3.

Ah, the FreeRTOS package for ESP32 doesn’t contains the source code. It only contains the header files.


I didn’t realise that until I checked just now.
I’ve asked over in the espressif forum how I can build it with vTaskList enabled. I’m waiting for my post to be approved by the moderators. It’s the first time I’ve posted in that forum.