espressif / ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
http://bbs.espressif.com
Apache License 2.0
3.35k stars 1.57k forks source link

can't find vApplicationGetTimerTaskMemory function. (GIT8266O-843) #1266

Closed Abdulrahman-Yasser closed 10 months ago

Abdulrahman-Yasser commented 10 months ago

----------------------------- Delete below ----------------------------- I've been facing an error that says

home/abdu/.espressif/tools/xtensa-lx106-elf/esp-2020r3-49-gd5524c1-8.4.0/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: esp-idf/freertos/libfreertos.a(tasks.c.obj):(.literal.vTaskStartScheduler+0x10): undefined reference to `vApplicationGetIdleTaskMemory'
/home/abdu/.espressif/tools/xtensa-lx106-elf/esp-2020r3-49-gd5524c1-8.4.0/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: esp-idf/freertos/libfreertos.a(tasks.c.obj): in function `vTaskStartScheduler':
/home/abdu/Study/IoT/LIB_FILES/ESP8266_RTOS_SDK/components/freertos/freertos/tasks.c:1939: undefined reference to `vApplicationGetIdleTaskMemory'
/home/abdu/.espressif/tools/xtensa-lx106-elf/esp-2020r3-49-gd5524c1-8.4.0/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: esp-idf/freertos/libfreertos.a(timers.c.obj):(.literal.xTimerCreateTimerTask+0xc): undefined reference to `vApplicationGetTimerTaskMemory'
/home/abdu/.espressif/tools/xtensa-lx106-elf/esp-2020r3-49-gd5524c1-8.4.0/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/8.4.0/../../../../xtensa-lx106-elf/bin/ld: esp-idf/freertos/libfreertos.a(timers.c.obj): in function `xTimerCreateTimerTask':
/home/abdu/Study/IoT/LIB_FILES/ESP8266_RTOS_SDK/components/freertos/freertos/timers.c:241: undefined reference to `vApplicationGetTimerTaskMemory'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

INSTRUCTIONS

my Wifi.h :


#pragma once

#include "esp_wifi.h"
// #include <atomic>
#include "freertos/FreeRTOS.h"

#include "freertos/queue.h"
#include <freertos/task.h>
#include "freertos/semphr.h"
#include "nvs_flash.h"
#include <esp_log.h>

#define pdSECOND pdMS_TO_TICKS(1000)

namespace WIFI
{

class Wifi
{
public:
    enum class state_e
    {
        NOT_INITIALIZED,
        INITIALIZED,
        WAITING_FOR_CREDENTIALS,
        READY_TO_CONNECT,
        CONNECTING,
        WAITING_FOR_IT,
        CONNECTED,
        DISCONNECTED,
        ERROR
    };

    esp_err_t init(void);   // Set everything up
    esp_err_t begin(void);  // Start Wifi, connect, etc
    Wifi(void);
    state_e get_state(void);
    const char* get_MAC(void){ return mac_add_cstr; }
private:
    void state_machine(void);

    esp_err_t _get_MAC(void);
    static char mac_add_cstr[13];
    // static std::atomic_bool first_call;
    static SemaphoreHandle_t first_call_mutx;
    static StaticSemaphore_t first_call_mutx_buffer;
    static bool first_call;
};

}

wifi.cpp :

#include "Wifi.h"

namespace WIFI
{

char Wifi::mac_add_cstr[]{};

// static std::atomic_bool Wifi::first_call{false};
SemaphoreHandle_t Wifi::first_call_mutx{nullptr};
StaticSemaphore_t first_call_mutx_buffer{0};
bool Wifi::first_call{true};

Wifi::Wifi(void){
    if(!first_call_mutx) 
    {
        first_call_mutx = xSemaphoreCreateMutexStatic(&first_call_mutx_buffer);
        configASSERT(first_call_mutx);
        configASSERT(pdPASS == xSemaphoreGive(first_call_mutx));
    }

    if(first_call && pdPASS == xSemaphoreTake(first_call_mutx, pdSECOND)){
        if (ESP_OK != _get_MAC()) esp_restart();
        first_call  = false;
        xSemaphoreGive(first_call_mutx);
    }
}

esp_err_t Wifi::_get_MAC(void)
{
    // it never get destroyed
    uint8_t mac_byte_buffer[6]{};

    const esp_err_t status{esp_efuse_mac_get_default(mac_byte_buffer)};

    if(ESP_OK == status){
        snprintf(mac_add_cstr, sizeof(mac_add_cstr), "%02X%02X%02X%02X%02X%02X",
        mac_byte_buffer[0], mac_byte_buffer[1], mac_byte_buffer[2],
        mac_byte_buffer[3], mac_byte_buffer[4], mac_byte_buffer[5]);
    }
    return status;
}
}

cmake : I've tried with and without REQUIRES

set(SOURCES Wifi.cpp)

idf_component_register(SRCS ${SOURCES}
                    INCLUDE_DIRS .
                    REQUIRES freertos esp_common esp_event nvs_flash  )

Environment

-vscode -Nodemcu

Problem Description

I've tried to search for the function that cause the problem (vApplicationGetTimerTaskMemory) But i only found an extern vApplicationGetTimerTaskMemory. in timer.c

Abdulrahman-Yasser commented 10 months ago

NVM, I've just read the comment

    /* If static allocation is supported then the application must provide the
    following callback function - which enables the application to optionally
    provide the memory that will be used by the timer task as the task's stack
    and TCB. */