Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

getting undefined reference to `pxCurrentTCB' #1442

Open
joeysmart opened this issue Oct 23, 2024 · 2 comments
Open

getting undefined reference to `pxCurrentTCB' #1442

joeysmart opened this issue Oct 23, 2024 · 2 comments

Comments

@joeysmart
Copy link

when building with esp-idf v5.3.1 for esp32s3 I am getting:
-devkitm-1/lib751/libESP Async WebServer.a(AsyncWebSocket.cpp.o):(.literal._ZN17AsyncWebLockGuardC5ERK12AsyncWebLock[_ZN17AsyncWebLockGuardC5ERK12AsyncWebLock]+0x0): undefined reference to `pxCurrentTCB'
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32-s3-devkitm-1/firmware.elf] Error 1

seems pxCurrentTCB is now pxCurrentTCBs and is an array (SMP)
is referenced in the class AsyncWebLock
currently I have no idea how to fix it

@sepp89117
Copy link

Hi, I just had the same problem.
Replace

  bool lock() const {
    extern void *pxCurrentTCB;
    if (_lockedBy != pxCurrentTCB) {
      xSemaphoreTake(_lock, portMAX_DELAY);
      _lockedBy = pxCurrentTCB;
      return true;
    }
    return false;
  }

with

  bool lock() const {
    TaskHandle_t currentTask = xTaskGetCurrentTaskHandle();
    if (_lockedBy != currentTask) {
        xSemaphoreTake(_lock, portMAX_DELAY);
        _lockedBy = currentTask;
        return true;
    }
    return false;
  }

in AsyncWebSynchronization.h and it should work.

sepp89117 added a commit to sepp89117/ESPAsyncWebServer that referenced this issue Jan 7, 2025
@qinsmoons
Copy link

when building with esp-idf v5.3.1 for esp32s3 I am getting: -devkitm-1/lib751/libESP Async

Hi, I just had the same problem. Replace

  bool lock() const {
    extern void *pxCurrentTCB;
    if (_lockedBy != pxCurrentTCB) {
      xSemaphoreTake(_lock, portMAX_DELAY);
      _lockedBy = pxCurrentTCB;
      return true;
    }
    return false;
  }

with

  bool lock() const {
    TaskHandle_t currentTask = xTaskGetCurrentTaskHandle();
    if (_lockedBy != currentTask) {
        xSemaphoreTake(_lock, portMAX_DELAY);
        _lockedBy = currentTask;
        return true;
    }
    return false;
  }

in AsyncWebSynchronization.h and it should work.

thanks,it works!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants