ESP8266 undefined reference to `smartconfig_stop'

Sysprogs forums Forums VisualGDB ESP8266 undefined reference to `smartconfig_stop'

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #11735
    Yuex.S
    Participant

    undefined reference to `smartconfig_stop’    04SmartConfig    E:\Project\ESP8266\Project\04SmartConfig\04SmartConfig\VisualGDB\Debug\LEDBlink.o    1

    my code

    #ifdef __cplusplus
    extern “C”
    {
    #endif

    #include <esp_common.h>

    #include <freertos/FreeRTOS.h>
    #include <freertos/task.h>
    #include <pin_mux_register.h>
    #include <gpio.h>
    #include <uart.h>

    #include “espressif/espconn.h”
    #include <smartconfig.h>
    #include “lwip/sockets.h”
    #include “lwip/dns.h”
    #include “lwip/netdb.h”

    void user_init(void);

    #ifdef __cplusplus
    }
    #endif

    #ifdef ESP8266_GDBSTUB
    #include <gdbstub.h>
    #endif

    #define RAMFUNC __attribute__((section(“.entry.text”)))

    static void RAMFUNC LEDBlinkTask(void *pvParameters)
    {
    for (int tick = 0;;tick++)
    {
    vTaskDelay(300 / portTICK_RATE_MS);
    gpio_output_conf(0, BIT2, BIT2, 0);
    vTaskDelay(300 / portTICK_RATE_MS);
    gpio_output_conf(BIT2, 0, BIT2, 0);
    }
    }

    void ICACHE_FLASH_ATTR
    smartconfig_done(sc_status status, void *pdata)
    {
    switch (status) {
    case SC_STATUS_WAIT:
    printf(“SC_STATUS_WAIT\n”);
    break;
    case SC_STATUS_FIND_CHANNEL:
    printf(“SC_STATUS_FIND_CHANNEL\n”);
    break;
    case SC_STATUS_GETTING_SSID_PSWD:
    printf(“SC_STATUS_GETTING_SSID_PSWD\n”);
    sc_type *type = pdata;
    if (*type == SC_TYPE_ESPTOUCH) {
    printf(“SC_TYPE:SC_TYPE_ESPTOUCH\n”);
    }
    else {
    printf(“SC_TYPE:SC_TYPE_AIRKISS\n”);
    }
    break;
    case SC_STATUS_LINK:
    printf(“SC_STATUS_LINK\n”);
    struct station_config *sta_conf = pdata;

    wifi_station_set_config(sta_conf);
    wifi_station_disconnect();
    wifi_station_connect();
    break;
    case SC_STATUS_LINK_OVER:
    printf(“SC_STATUS_LINK_OVER\n”);
    if (pdata != NULL) {
    //SC_TYPE_ESPTOUCH
    uint8 phone_ip[4] = { 0 };

    memcpy(phone_ip, (uint8*)pdata, 4);
    printf(“Phone ip: %d.%d.%d.%d\n”, phone_ip[0], phone_ip[1], phone_ip[2], phone_ip[3]);
    break;
    }
    else {
    //SC_TYPE_AIRKISS – support airkiss v2.0
    //airkiss_start_discover();
    }
    smartconfig_stop();
    break;
    }

    }

    static void ICACHE_FLASH_ATTR
    smartconfig_task(void *pvParameters)
    {
    smartconfig_start(smartconfig_done);

    vTaskDelete(NULL);
    }

    //Unless you explicitly define the functions as RAMFUNC, they will be placed in the SPI FLASH and the debugger
    //won’t be able to set software breakpoints there.
    void RAMFUNC user_init(void)
    {
    #ifdef ESP8266_GDBSTUB
    gdbstub_init();
    #endif

    #ifdef ESP8266_GDBSTUB
    #error The LED on the Olimex board is multiplexed with the TXD line used by the GDB stub. In order to use the stub, select a different LED pin below.
    #endif
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
    gpio_output_conf(0, BIT2, BIT2, 0);
    printf(“SDK version:%s\n”, system_get_sdk_version());

    wifi_set_opmode(STATION_MODE);

    xTaskCreate(LEDBlinkTask, (signed char *)”LEDBlinkTask”, 256, NULL, 2, NULL);

    xTaskCreate(smartconfig_task, (signed char *)”smartconfig_task”, 256, NULL, 2, NULL);
    }

    • This topic was modified 7 years, 5 months ago by Yuex.S.
    Attachments:
    You must be logged in to view attached files.
    #11738
    Yuex.S
    Participant

    This is an example of the official website, do not understand why there is this error when writing.

    #11739
    Yuex.S
    Participant

    1>—— 已启动生成: 项目: 04SmartConfig, 配置: Debug VisualGDB ——
    1> LEDBlink.c
    1> Linking ../VisualGDB/Debug/04SmartConfig…
    1>VisualGDB\Debug\LEDBlink.o : error : undefined reference to `smartconfig_stop’
    1> VisualGDB/Debug/LEDBlink.o: In function `smartconfig_done’:
    1>E:\Project\ESP8266\Project\04SmartConfig\04SmartConfig\LEDBlink.c(73): error : undefined reference to `smartconfig_stop’
    1>E:\Project\ESP8266\Project\04SmartConfig\04SmartConfig\LEDBlink.c(78): error : undefined reference to `smartconfig_start’
    1> VisualGDB/Debug/LEDBlink.o: In function `smartconfig_task’:
    1>E:\Project\ESP8266\Project\04SmartConfig\04SmartConfig\LEDBlink.c(79): error : undefined reference to `smartconfig_start’
    1>collect2.exe : error : ld returned 1 exit status
    ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========

    #11744
    support
    Keymaster

    Hi,

    Looks like you are missing a reference to the libsmartconfig.a file. Please try adding it to your project (or adding “smartconfig” to the Library Names field in the Linker Settings).

    #13258
    kostbill
    Participant

    Hello.

    I am having the same problem. However I cannot find where this library is located, I searched my PC and it is not there. Also, when I find it, how am I going to add it to my project?

    If I go to properties->Linker, what should I do next?

    Thanks.

    #13259
    kostbill
    Participant

    OK, did it but I had to download the library from the net. It was not in my PC.

    #13273
    support
    Keymaster

    Hi,

    Our ESP8266 toolchain only includes the libraries shipped with the RTOS and non-OS SDKs; if you want to use external libraries, you indeed need to download them (we recommend saving them outside the toolchain directory to avoid losing them during a toolchain update).

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.