PlatformIO Community

FreeRtos pcTaskGetName

Hello to all,

I would like to use the pcTaskGetName function from FreeRtos however it is not available.
As per the documentation :
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html#_CPPv413pcTaskGetName12TaskHandle_t,
this function does not need any particular setup in FreeRTOSConfig.h to be available (like the case of xTaskGetHandle).
What is wrong ? Is there a mistake in the documentation?
Should I setup a particular include in FreeRTOSConfig.h for it to be available ?

Thanks for your advices on this one.
Sha.

What platformio.ini are you using?

you mean pcTaskGetName(). There is no xTakGetName().

oops sorry
yes pcTaskGetName
bad cut and paste

Works for me in Arduino-ESP32.

[env:esp32]
platform = espressif32
board = esp32dev
monitor_filters = esp32_exception_decoder
framework = arduino
monitor_speed = 115200

with src\main.cpp

#include <Arduino.h>

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.print("Task name: ");
  Serial.println(pcTaskGetTaskName(NULL));
  delay(1000);
}

outputs

Task name: loopTask

Which is correct, the Arduino-ESP32 core creates the task of that name

Your platformio.ini is what?

I have
[env:mini32]

platform = espressif32

board = wemos_d1_mini32

upload_port = 192.168.0.16

This is the full file?

There is no framework = .. line to describe what framework you want to use? Arduino or ESP-IDF?

[platformio]
default_envs =  
       mini32
    ;   mini66
[env]
framework = arduino
upload_speed = 921600
monitor_speed = 115200
lib_extra_dirs = .\lib   
lib_deps = fastled/FastLED@3.3.3
           ESP_VS1053_Library@1.1.2
           ArduinoOTA
           ArduinoJson@6.13.0
           Time-sha@1.5.1
           ;https://github.com/MajicDesigns/MD_Parola@3.3.0
           MD_Parola@3.3.0           
           ;https://github.com/MajicDesigns/MD_MAX72XX@3.2.1
           MD_MAX72xx@3.2.3
           ;https://github.com/knolleary/pubsubclient@2.8
           PubSubClient@2.8
           ;https://github.com/plapointe6/EspHtmlTemplateProcessor@1.2.1
           ;EspHtmlTemplateProcessor@1.2.1           
           https://github.com/JoaoLopesF/RemoteDebug
           ;https://github.com/JoaoLopesF/RemoteDebugger 
[env:mini32]
platform = espressif32
board = wemos_d1_mini32 
upload_port = 192.168.0.16
upload_protocol = espota
board_build.partitions = default.csv
lib_deps =  
    ${env.lib_deps}
    WiFiManager-sha@0.19.0

This looks okay. What is the exact code you’re running that tries to use that function? What is the error message when using “Build”?

Here is the build error:
E:/Data/PlatformIO/Sha_Clock_v52/src/Clock_support.ino:480:50: error: ‘pcTaskGetName’ was not declared in this scope
uxTaskNameArray[3] = pcTaskGetName(xWebHandle);

Again, the function is called pcTaskGetTaskName.

EDIT: Okay the documentation seems to be just wrong about the name of this function. pcTaskGetTaskName is correct, everything else is false.

Maybe it has something to do with the fact that you’re looking at the documentation for the latest ESP-IDF, but the Arduino core is built on a slightly older ESP-IDF version.

Bingo !
I changed the name of the function to pcTaskGetTaskName
it builds with no error

This is a mistake in the doc !!
Thank you so much
Sha