Help to connect an external compiled library libalgobsec.a to the ESP-IDF and PlatformIO project (maybe this is essential).
I created a driver library with the following structure (maybe this is wrong):
I tried to do it by analogy with viewtopic.php?f=13&t=12633&p=50373&hilit=bsec#p50373, unfortunately it did not help. CMake is a dark forest for me.
CMakeLists.txt:
Code: Select all
set(COMPONENT_ADD_INCLUDEDIRS inc)
register_component()
target_link_libraries(${COMPONENT_TARGET} "-L${CMAKE_CURRENT_LIST_DIR}/esp32")
target_link_libraries(${COMPONENT_TARGET} algobsec)
Code: Select all
COMPONENT_SRCDIRS := .
COMPONENT_ADD_INCLUDEDIRS := inc
LIBS := algobsec
COMPONENT_ADD_LDFLAGS := -lbt -L $(COMPONENT_PATH)/esp32 \
$(addprefix -l,$(LIBS))
ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/esp32/lib%.a,$(LIBS))
COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES)
COMPONENT_SUBMODULES += esp32
Code: Select all
Linking .pio\build\esp32dev\firmware.elf
c:/users/razzhivinav/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libc3a/libreBSEC68x.a(reBSEC68x.o):(.literal._ZN7BSEC68x11sensorResetEv+0x4): undefined reference to `bsec_init'
c:/users/razzhivinav/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libc3a/libreBSEC68x.a(reBSEC68x.o):(.literal._ZN7BSEC68x11sensorResetEv+0x8): undefined reference to `bsec_get_version'
c:/users/razzhivinav/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32dev/libc3a/libreBSEC68x.a(reBSEC68x.o): in function `BSEC68x::sensorReset()':
C:/PlatformIO/libs/sensors/reBSEC68x/reBSEC68x.cpp:377: undefined reference to `bsec_init'
c:/users/razzhivinav/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:/PlatformIO/libs/sensors/reBSEC68x/reBSEC68x.cpp:380: undefined reference to `bsec_get_version'