Hello all.
I am using the esp_modem component in my project, and I am having problems when using the esp_modem_set_command_mode() and esp_modem_resume_data_mode() functions. I have seen that they are C functions derived from their C++ counterparts set_command_mode() and resume_data_mode().
I do not know why but the linker does not found these functions, nor search for their C++ counterparts.
Brief, the problem I am facing is that the linker does not find either of them and my project does not build.
I copy the error lines below.
Thank you for your help.
Regards,
Germán.
---
FAILED: MQTTSerie.elf
cmd.exe /C "cd . && C:\Espressif\tools\xtensa-esp32-elf\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address @CMakeFiles\MQTTSerie.elf.rsp -o MQTTSerie.elf && cd ."
c:/espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/modem/libmodem.a(modem.c.obj):(.literal.modem_dataSuspend+0x4): undefined reference to `esp_modem_set_command_mode'
c:/espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/modem/libmodem.a(modem.c.obj):(.literal.modem_dataResume+0x4): undefined reference to `esp_modem_resume_data_mode'
c:/espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/modem/libmodem.a(modem.c.obj): in function `modem_dataSuspend':
C:/Users/germa/Documents/ESP44/MQTTNuevo/components/modem/modem.c:278: undefined reference to `esp_modem_set_command_mode'
c:/espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/modem/libmodem.a(modem.c.obj): in function `modem_dataResume':
C:/Users/germa/Documents/ESP44/MQTTNuevo/components/modem/modem.c:295: undefined reference to `esp_modem_resume_data_mode'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
esp_modem program build problem
esp_modem program build problem
Last edited by Mermaja on Sat Dec 23, 2023 11:30 pm, edited 1 time in total.
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: esp_modem program build problem
Does your "modem" component declare a dependency on "esp_modem" in its CMakeLists.txt?
Re: esp_modem program build problem
This is CMakelists.txt for my modem component. Everything has been working for months, until I used the two functions I mentioned.
idf_component_register(SRCS "modem.c" INCLUDE_DIRS "include" REQUIRES "driver" "esp_event" "esp_netif" "esp_modem")
Thank you for your answer.
idf_component_register(SRCS "modem.c" INCLUDE_DIRS "include" REQUIRES "driver" "esp_event" "esp_netif" "esp_modem")
Thank you for your answer.
Re: esp_modem program build problem
Solved. Weird enough, I tried and it was the reason. The two functions are missing from esp_modem_c_api.cpp
I created them
extern "C" esp_err_t esp_modem_resume_data_mode(esp_modem_dce_t *dce_wrap)
{
if (dce_wrap == nullptr || dce_wrap->dce == nullptr) {
return ESP_ERR_INVALID_ARG;
}
return command_response_to_esp_err(dce_wrap->dce->resume_data_mode());
}
extern "C" esp_err_t esp_modem_set_command_mode(esp_modem_dce_t *dce_wrap)
{
if (dce_wrap == nullptr || dce_wrap->dce == nullptr) {
return ESP_ERR_INVALID_ARG;
}
return command_response_to_esp_err(dce_wrap->dce->set_command_mode());
}
And now it is solved.
Please, esp_modem developers, can you fix it?
Regards.
I created them
extern "C" esp_err_t esp_modem_resume_data_mode(esp_modem_dce_t *dce_wrap)
{
if (dce_wrap == nullptr || dce_wrap->dce == nullptr) {
return ESP_ERR_INVALID_ARG;
}
return command_response_to_esp_err(dce_wrap->dce->resume_data_mode());
}
extern "C" esp_err_t esp_modem_set_command_mode(esp_modem_dce_t *dce_wrap)
{
if (dce_wrap == nullptr || dce_wrap->dce == nullptr) {
return ESP_ERR_INVALID_ARG;
}
return command_response_to_esp_err(dce_wrap->dce->set_command_mode());
}
And now it is solved.
Please, esp_modem developers, can you fix it?
Regards.
Who is online
Users browsing this forum: No registered users and 98 guests