Skip to content

xTaskGetHandle is not available to be used #4746

Closed
@VoLinhTruc

Description

@VoLinhTruc

Hardware:

Board: ESP32 Dev Module
Core Installation version: 1.0.4
IDE name: Arduino IDE and Platform.io
Flash Frequency: 80Mhz
PSRAM enabled: yes
Upload Speed: 115200
Computer OS: Windows 10

Description:

I think all API supported by SDK can be used in Arduino core.
I found xTaskGetHandle API is described here but I cannot used it in Arduino IDE and in PlatformIO IDE (in VSCode).
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html

#include "Arduino.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"


void setup() {
  // put your setup code here, to run once:

	TaskHandle_t task_handle_from_name = xTaskGetHandle(key_ptr);

}

void loop() {
  // put your main code here, to run repeatedly:

}

Debug Messages:

undefined reference to `xTaskGetHandle'

Activity

RafigRzayev

RafigRzayev commented on Jan 27, 2021

@RafigRzayev

If I am not mistaken, there are other features as well which are available in RTOS API and are not usable in Arduino by default. As I remember there is a file where you can specifically edit which RTOS features you want to be enabled. Though maybe you will need to compile new libraries. Here are the notes from https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html#_CPPv414xTaskGetHandlePKc :

TaskHandle_txTaskGetHandle(const char *pcNameToQuery)
Note
This function takes a relatively long time to complete and should be used sparingly.
Return
The handle of the task that has the human readable name pcNameToQuery. NULL is returned if no matching name is found. INCLUDE_xTaskGetHandle must be set to 1 in FreeRTOSConfig.h for pcTaskGetHandle() to be available.

Kiznoh

Kiznoh commented on Jan 27, 2021

@Kiznoh

Hi @VoLinhTruc,
unfortunetly the function xTaskGetHandle is not avaible in ESP-IDF v3.3 which Arduino-esp32 is currently based on.

VoLinhTruc

VoLinhTruc commented on Jan 28, 2021

@VoLinhTruc
ContributorAuthor

Hi @VoLinhTruc,
unfortunetly the function xTaskGetHandle is not avaible in ESP-IDF v3.3 which Arduino-esp32 is currently based on.

Thank you, sir.
I hope I can use that function in future. That function is the very useful function to get the Task handle by string from user.

VoLinhTruc

VoLinhTruc commented on Jan 28, 2021

@VoLinhTruc
ContributorAuthor

I got the answer, so the issue is closed now.

stodge

stodge commented on Feb 20, 2021

@stodge

The version of FreeRTOS provided is V8.2.0 from 2015. The latest version of FreeRTOS is V10.4.3. Will FreeRTOS ever be upgraded? Or can't the ESP32 support it?

capedra

capedra commented on Jul 17, 2021

@capedra

@ivankravets @me-no-dev
That's exactly what I have been looking for......
https://www.freertos.org/vTaskGetInfo.html

maxgerhardt

maxgerhardt commented on Sep 7, 2021

@maxgerhardt
Contributor

Compiling the sketch

#include <Arduino.h>

void setup(){
    Serial.begin(115200);
    TaskStatus_t xTaskDetails;
     // Use the handle to obtain further information about the task.
    vTaskGetInfo( NULL, // get info for *this* thread
               &xTaskDetails,
               pdTRUE, // Include the high water mark in xTaskDetails.
               eInvalid ); // Include the task state in xTaskDetails.
}


void loop(){}

with Arduino-ESP32 2.0.0 still leads to the result

C:\Users\Max\Documents\Arduino\sketch_sep07a/sketch_sep07a.ino:7: undefined reference to `vTaskGetInfo'
collect2.exe: error: ld returned 1 exit status
exit status 1

Any update on enabling that in precompiled ESP-IDF libraries? Per ESP-IDF docs the function is available there.

reopened this on Sep 7, 2021
Maksons

Maksons commented on Nov 12, 2021

@Maksons

I do not use Arduino but in plane ESP-IDF it is still problem .
I find espressif/esp-idf#5519 which report that with FreeRTOS 10 xTaskGetHandle should be by default, but do not work form me, not found still.

I overcome problem by solution given on ESP forum :

INCLUDE_xTaskGetHandle must be set to 1 in FreeRTOSConfig.h for xTaskGetHandle() to be available.

For that I need copy and modify freertos component in local code base.
@igrr could INCLUDE_xTaskGetHandle 1 be by default for FreeRTOS or possible to selected in configuration ?

mishaturnbull

mishaturnbull commented on Nov 12, 2021

@mishaturnbull

Same here. I've been modifying the value in the FreeRTOS header to use the function, but this means anybody else who wants to compile my code has to then go do the same. Any chance we could get it to be a menuconfig item?

p.s. @Maksons, how you are copying & modifying FreeRTOS component? Do you just copy the component from the esp-idf components folder into your project's components -- does that override the default component from esp-idf?

Thanks!!

Maksons

Maksons commented on Nov 15, 2021

@Maksons

@mishaturnbull
Yes, I copy components from esp-idf folder to project's components .
Yes, local one override original one. It is described in :
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#multiple-components-with-the-same-name

igrr

igrr commented on Apr 5, 2022

@igrr
Member

INCLUDE_xTaskGetHandle is set to 1 in IDF release/v4.4, so this feature should be available in arduino-esp32 v2.0.0 and later:
https://github.com/espressif/esp-idf/blob/c29343eb94d2f2ca17b3a5b38c82452e556147f2/components/freertos/include/esp_additions/freertos/FreeRTOSConfig.h#L255

34 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      xTaskGetHandle is not available to be used · Issue #4746 · espressif/arduino-esp32