I come from developing using ESP-IDF with PlatformIO, after encountering some unsolvable issues when trying to use some IDF components, I tried them examples in IDF and worked very well.
Now I brought all my code from the PlatformIO project to a new ESP-IDF project, using the hello_world as template.
Some more context, I'm developing in VSCode, using the ESP-IDF extension, version of IDF: 5.4.2. Target: ESP32S3.
Here is the project folder after porting all code:

Every component, except the rak3172 and the led_strip, were "libs" on the Platformio project. To add them as component I used the "+Create ESP-IDF Component" and copy the code into it.
Each CMakeLists.txt of them components is like the following:
Code: Select all
idf_component_register(SRCS "gp8211s.cpp"
INCLUDE_DIRS "include"
PRIV_REQUIRES freertos driver)
target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++11)Code: Select all
# SRCS
set(COMPONENT_SRCS
"main.cpp"
"lora_gpe.cpp"
"ble_blacklist.cpp"
"ble_scan.cpp"
"ble_fota.cpp"
"energia.cpp"
"low_power.cpp"
"luz_ambiente.cpp"
"ssl_db.cpp"
"ssl_listener.cpp"
"ssl_proceso.cpp"
"ssl_sender.cpp"
)
#Includes
set(COMPONENT_ADD_INCLUDEDIRS
"include")
# Requires
list(APPEND COMPONENT_REQUIRES esp_timer)
list(APPEND COMPONENT_REQUIRES freertos)
list(APPEND COMPONENT_REQUIRES driver)
list(APPEND COMPONENT_REQUIRES spiffs)
list(APPEND COMPONENT_REQUIRES esp_common)
list(APPEND COMPONENT_REQUIRES esp_rom)
list(APPEND COMPONENT_REQUIRES esp_system)
list(APPEND COMPONENT_REQUIRES nvs_flash)
list(APPEND COMPONENT_REQUIRES esp_event)
list(APPEND COMPONENT_REQUIRES bt)
# Components, also included in the requires
list(APPEND COMPONENT_REQUIRES aes_lib)
list(APPEND COMPONENT_REQUIRES bl0942)
list(APPEND COMPONENT_REQUIRES calendario_nuclear)
list(APPEND COMPONENT_REQUIRES cJSON)
list(APPEND COMPONENT_REQUIRES configs_gpe)
list(APPEND COMPONENT_REQUIRES ESP32-RAK3172-4.2_Dev)
list(APPEND COMPONENT_REQUIRES gp8211s)
list(APPEND COMPONENT_REQUIRES gpio_gpe)
list(APPEND COMPONENT_REQUIRES gps)
list(APPEND COMPONENT_REQUIRES led_strip)
list(APPEND COMPONENT_REQUIRES opt3004)
list(APPEND COMPONENT_REQUIRES utils)
idf_component_register(SRCS ${COMPONENT_SRCS}
INCLUDE_DIRS ${COMPONENT_ADD_INCLUDEDIRS}
#requires for the project
REQUIRES ${COMPONENT_REQUIRES}
)Code: Select all
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(SSL-IDF)Code: Select all
esptool.py v4.9.0
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
Generated C:/Users/Pepe/Documents/GitHub/SSL-IDF/build/bootloader/bootloader.bin
[115/115] C:\Windows\system32\cmd.exe /C "cd /D C:\Users\Pepe\Documents\GitHub\SSL-IDF\build\bootloader\esp-idf\esptool_py && C:\Users\Pepe\.espressif\python_env\idf5.4_py3.11_env\Scripts\python.exe C:/Users/Pepe/esp/v5.4.2/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 C:/Users/Pepe/Documents/GitHub/SSL-IDF/build/bootloader/bootloader.bin"
Bootloader binary size 0x54e0 bytes. 0x2b20 bytes (34%) free.
[1203/1205] Linking CXX executable SSL-IDF.elf
FAILED: SSL-IDF.elf
C:\Windows\system32\cmd.exe /C "cd . && C:\Users\Pepe\.espressif\tools\xtensa-esp-elf\esp-14.2.0_20241119\xtensa-esp-elf\bin\xtensa-esp32s3-elf-g++.exe -mlongcalls -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32S3=0 -Wl,--Map=C:/Users/Pepe/Documents/GitHub/SSL-IDF/build/SSL-IDF.map -Wl,--no-warn-rwx-segments -Wl,--orphan-handling=warn -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T esp32s3.peripherals.ld -T esp32s3.rom.ld -T esp32s3.rom.api.ld -T esp32s3.rom.bt_funcs.ld -T esp32s3.rom.libgcc.ld -T esp32s3.rom.wdt.ld -T esp32s3.rom.version.ld -T esp32s3.rom.ble_cca.ld
-T esp32s3.rom.ble_test.ld -T esp32s3.rom.newlib.ld -T memory.ld -T sections.ld @CMakeFiles\SSL-IDF.elf.rsp -o SSL-IDF.elf && cd ."
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.cpp.obj):(.literal._Z19main_generar_llavesv+0x2c): undefined reference to `AES_init_ctx_iv(AES_ctx*, unsigned char const*, unsigned char const*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.cpp.obj):(.literal._Z19main_generar_llavesv+0x30): undefined reference to `AES_CBC_encrypt_buffer(AES_ctx*, unsigned char*, unsigned long)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.cpp.obj): in function `main_generar_llaves()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/main.cpp:413:(.text._Z19main_generar_llavesv+0x68): undefined reference to `AES_init_ctx_iv(AES_ctx*, unsigned char const*, unsigned char const*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/main.cpp:416:(.text._Z19main_generar_llavesv+0x8f): undefined reference to `AES_CBC_encrypt_buffer(AES_ctx*, unsigned char*, unsigned long)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj):(.literal._Z30ssl_proceso_task_cambio_estadoPv+0x28): undefined reference to `gpio_gpe_set_pin(unsigned char, bool)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj):(.literal._Z18ssl_proceso_init_2v+0x20): undefined reference to `gps_task(void*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj):(.literal._Z22ssl_proceso_init_pinesv+0x8): undefined reference to `gpio_gpe_init_pin(gpio_gpe_pin_t*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj):(.literal._Z23ssl_proceso_modo_manualP15ssl_db_config_t+0x10): undefined reference to `gpio_gpe_get_pin(unsigned char, bool*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj):(.literal._Z44ssl_proceso_cb_recalcular_alarmas_calendariov+0x20): undefined reference to `cn_sunrise(int, int, int, bool)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj):(.literal._Z44ssl_proceso_cb_recalcular_alarmas_calendariov+0x24): undefined reference to `cn_sunset(int, int, int, bool)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj): in function `ssl_proceso_task_cambio_estado(void*)':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_proceso.cpp:735:(.text._Z30ssl_proceso_task_cambio_estadoPv+0x3a): undefined reference to `gpio_gpe_set_pin(unsigned char, bool)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj): in function `ssl_proceso_init_pines()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_proceso.cpp:527:(.text._Z22ssl_proceso_init_pinesv+0x10): undefined reference to `gpio_gpe_init_pin(gpio_gpe_pin_t*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj): in function `ssl_proceso_modo_manual(ssl_db_config_t*)':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_proceso.cpp:636:(.text._Z23ssl_proceso_modo_manualP15ssl_db_config_t+0x46): undefined reference to `gpio_gpe_get_pin(unsigned char, bool*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj): in function `ssl_proceso_modo_luz_ambiente(ssl_db_config_t*)':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_proceso.cpp:669:(.text._Z29ssl_proceso_modo_luz_ambienteP15ssl_db_config_t+0x42): undefined reference to `gpio_gpe_get_pin(unsigned char, bool*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj): in function `ssl_proceso_cb_recalcular_alarmas_calendario()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_proceso.cpp:947:(.text._Z44ssl_proceso_cb_recalcular_alarmas_calendariov+0x87): undefined reference to `cn_sunrise(int, int, int, bool)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_proceso.cpp:948:(.text._Z44ssl_proceso_cb_recalcular_alarmas_calendariov+0x9b): undefined reference to `cn_sunset(int, int, int, bool)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_proceso.cpp.obj): in function `ssl_proceso_set_estado_inicial()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_proceso.cpp:716:(.text._Z30ssl_proceso_set_estado_inicialv+0x7): undefined reference to `gpio_gpe_get_pin(unsigned char, bool*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_db.cpp.obj):(.literal._Z16ssl_db_cargar_dbv+0x18): undefined reference to `configs_gpe_get_configs(char*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_db.cpp.obj):(.literal._Z11ssl_db_initv+0x30): undefined reference to `configs_gpe_init()'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_db.cpp.obj):(.literal._Z11ssl_db_initv+0x34): undefined reference to `configs_gpe_set_configs(char*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_db.cpp.obj): in function `ssl_db_cargar_db()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_db.cpp:1228:(.text._Z16ssl_db_cargar_dbv+0x6): undefined reference to `configs_gpe_get_configs(char*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_db.cpp.obj): in function `ssl_db_init()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_db.cpp:1292:(.text._Z11ssl_db_initv+0x3): undefined reference to `configs_gpe_init()'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_db.cpp:169:(.text._Z11ssl_db_initv+0x97): undefined reference to `configs_gpe_set_configs(char*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_db.cpp.obj): in function `ssl_db_set_config(ssl_db_config_t*)':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_db.cpp:509:(.text._Z17ssl_db_set_configP15ssl_db_config_t+0x2da): undefined reference to `configs_gpe_set_configs(char*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_db.cpp.obj): in function `ssl_db_set_estado_lorawan_dl(ssl_db_estado_lorawan_dl_t*)':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_db.cpp:900:(.text._Z28ssl_db_set_estado_lorawan_dlP26ssl_db_estado_lorawan_dl_t+0x1b0): undefined reference to `configs_gpe_set_configs(char*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(energia.cpp.obj):(.literal._Z12energia_taskPv+0x2c): undefined reference to `bl0942_init(bl0942_config_t*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(energia.cpp.obj):(.literal._Z12energia_taskPv+0x30): undefined reference to `bl0942_get_consumo(bl0942_data_t*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(energia.cpp.obj): in function `energia_task(void*)':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/energia.cpp:67:(.text._Z12energia_taskPv+0x8e): undefined reference to `bl0942_init(bl0942_config_t*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/energia.cpp:84:(.text._Z12energia_taskPv+0x108): undefined reference to `bl0942_get_consumo(bl0942_data_t*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(energia.cpp.obj): in function `energia_get_new_data()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/energia.cpp:114:(.text._Z20energia_get_new_datav+0x4c): undefined reference to `bl0942_get_consumo(bl0942_data_t*)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_listener.cpp.obj):(.literal._Z16ssl_listener_gpsv+0x14): undefined reference to `cn_init(float, float, float)'
C:/Users/Pepe/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(ssl_listener.cpp.obj): in function `ssl_listener_gps()':
C:/Users/Pepe/Documents/GitHub/SSL-IDF/main/ssl_listener.cpp:199:(.text._Z16ssl_listener_gpsv+0xad): undefined reference to `cn_init(float, float, float)'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
* The terminal process "C:\Users\Pepe\.espressif\tools\ninja\1.12.1\ninja.EXE" terminated with exit code: 1.
Besides looking for information in forums, I tried with some IAs, but so far I couldn't resolve the linker issue.
I hope someone can give me some pointers on how to resolve this.