Hi,
I am trying to use the Bosch BSEC library and the e-series device for an IOT project. The BSEC library is closed source and requires a static library to be linked during the compile. Does anybody have experience with this.
I have noted several previous attempts of people trying to do this, and I have tried following the steps on their posts, with no success.
https://community.particle.io/t/use-bosch-bme680-bsec-arduino-library-in-particle-workbench/52517
https://community.particle.io/t/bsec-sensor-library/41166
I am running Particle Workbench v1.13.8
E-series OS version 2.0.0
The errors I get are;
Executing task in folder hivesense: make -f 'C:\Users\Ben\.particle\toolchains\buildscripts\1.10.0\Makefile' compile-user -s <
:::: COMPILING APPLICATION
************ Variables
************** PROJECT_ROOT: ..
************** SOURCE_PATH: d:/firmware/particle_hivesense/hivesense/
************** USRSRC: src
************
************ Libraries
************
************ Bosch BSEC BME68x driver
************** include dir: d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bme68x/
************
************
************ BSEC version 2.0.6.1, 04302021
************** include dir: d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/
************** algo library: d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/cortex-m3/libalgobsec.a
************
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ../../../build/target/user/platform-10-m/hivesense/\libuser.a(hivesense.o): in function `Bsec::getVersion()':
d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.h:186: undefined reference to `bsec_get_version'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.h:186: undefined reference to `bsec_get_version'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.h:186: undefined reference to `bsec_get_version'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.h:186: undefined reference to `bsec_get_version'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ../../../build/target/user/platform-10-m/hivesense/\libuser.a(bsec.o): in function `Bsec::beginCommon()':
d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.cpp:121: undefined reference to `bsec_init'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.cpp:125: undefined reference to `bsec_get_version'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ../../../build/target/user/platform-10-m/hivesense/\libuser.a(bsec.o): in function `Bsec::updateSubscription(bsec_virtual_sensor_t*, unsigned char, float)':
d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.cpp:151: undefined reference to `bsec_update_subscription'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ../../../build/target/user/platform-10-m/hivesense/\libuser.a(bsec.o): in function `Bsec::setConfig(unsigned char const*)':
d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.cpp:274: undefined reference to `bsec_set_configuration'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ../../../build/target/user/platform-10-m/hivesense/\libuser.a(bsec.o): in function `Bsec::processData(long long, bme68x_data const&)':
d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.cpp:335: undefined reference to `bsec_do_steps'
c:/users/ben/.particle/toolchains/gcc-arm/9.2.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ../../../build/target/user/platform-10-m/hivesense/\libuser.a(bsec.o): in function `Bsec::run()':
d:/firmware/particle_hivesense/hivesense/lib/bsec2/src/bsec.cpp:173: undefined reference to `bsec_sensor_control'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../../../build/module.mk:232: d:/firmware/particle_hivesense/hivesense/target/2.0.0/electron/hivesense.elf] Error 1
make[1]: *** [../build/recurse.mk:12: modules/electron/user-part] Error 2
make: *** [C:\Users\Ben\.particle\toolchains\buildscripts\1.10.0\Makefile:68: compile-user] Error 2
The terminal process "C:\Users\Ben\.particle\toolchains\buildtools\1.1.1\bin\bash.exe '-c', 'make -f 'C:\Users\Ben\.particle\toolchains\buildscripts\1.10.0\Makefile' compile-user -s'" terminated with exit code: 2.
Press any key to close the terminal.
I have made a build.mk file as suggested in one of the posts. Its contents is;
# From https://docs.particle.io/faq/particle-tools/local-build/photon/#including-additional-header-directories
# Standard behavior must be included here (So says particle)
INCLUDE_DIRS += $(SOURCE_PATH)/$(USRSRC) # add user sources to include path
CPPSRC += $(call target_files,$(USRSRC_SLASH),*.cpp)
CSRC += $(call target_files,$(USRSRC_SLASH),*.c)
APPSOURCES=$(call target_files,$(USRSRC_SLASH),*.cpp)
APPSOURCES+=$(call target_files,$(USRSRC_SLASH),*.c)
# Project-specific stuff goes after the Particle boilerplate above.
#export COMPILE_LTO=n
export MODULAR=y
$(info ************ Variables)
$(info ************** PROJECT_ROOT: ${PROJECT_ROOT})
$(info ************** SOURCE_PATH: ${SOURCE_PATH})
$(info ************** USRSRC: ${USRSRC})
########## Libraries
$(info ************)
$(info ************ Libraries)
$(info ************)
$(info ************ Bosch BSEC BME68x driver)
bme68x_dir = $(SOURCE_PATH)lib/bsec2/src/bme68x/
$(info ************** include dir: $(bme68x_dir))
INCLUDE_DIRS += $(bme68x_dir)
CPPSRC += $(call target_files,$(bme68x_dir),*.cpp)
APPSOURCES += $(call target_files,$(bme68x_dir),*.cpp)
$(info ************)
$(info ************)
$(info ************ BSEC version 2.0.6.1, 04302021)
bsec_lib = ${SOURCE_PATH}lib/bsec2/src/cortex-m3/libalgobsec.a
bsec_lib_no_a = ${SOURCE_PATH}lib/bsec2/src/cortex-m3/libalgobsec
bsec_dir = ${SOURCE_PATH}lib/bsec2/src/
$(info ************** include dir: $(bsec_dir))
$(info ************** algo library: $(bsec_lib))
INCLUDE_DIRS += $(bsec_dir)
LIBS += $(bsec_lib_no_a)
LIB_DEPS += $(bsec_lib)
$(info ************)
My Particle Workbench file structure is;
From what I can gather the libalgobsec.a is not being linked and therefore the error message undefined reference to
bsec_get_version’`
Any help would be muchly appreciated.
Cheers,
Ben.