Use Bosch BME680 BSEC Arduino Library in Particle Workbench?

Hi there,

I’m trying to use the Bosch BME680 BSEC Arduino Library (https://github.com/BoschSensortec/BSEC-Arduino-library) in an Argon project. I extracted the library to the lib folder of my project, however on compiling I’m getting the following errors:

> Executing task: make -f 'C:\Users\Kaeltis\.particle\toolchains\buildscripts\1.7.1\Makefile' compile-user -s <


Creating c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/platform_user_ram.ld ...
../../../build/target/user/platform-12-m/bme680datalogger/\libuser.a(bsec.o): In function `Bsec::beginCommon()':  
c:/Users/Kaeltis/Documents/Particle/bme680datalogger/lib/BSEC/src/bsec.cpp:131: undefined reference to `bsec_init'
../../../build/target/user/platform-12-m/bme680datalogger/\libuser.a(bsec.o): In function `Bsec::getVersion()':   
c:/Users/Kaeltis/Documents/Particle/bme680datalogger/lib/BSEC/src/bsec.cpp:237: undefined reference to `bsec_get_version'
../../../build/target/user/platform-12-m/bme680datalogger/\libuser.a(bsec.o): In function `Bsec::updateSubscription(bsec_virtual_sensor_t*, unsigned char, float)':
c:/Users/Kaeltis/Documents/Particle/bme680datalogger/lib/BSEC/src/bsec.cpp:153: undefined reference to `bsec_update_subscription'
../../../build/target/user/platform-12-m/bme680datalogger/\libuser.a(bsec.o): In function `Bsec::readProcessData(long long, bsec_bme_settings_t)':
c:/Users/Kaeltis/Documents/Particle/bme680datalogger/lib/BSEC/src/bsec.cpp:297: undefined reference to `bsec_do_steps'
../../../build/target/user/platform-12-m/bme680datalogger/\libuser.a(bsec.o): In function `Bsec::run()':
c:/Users/Kaeltis/Documents/Particle/bme680datalogger/lib/BSEC/src/bsec.cpp:172: undefined reference to `bsec_sensor_control'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../../../build/module.mk:235: c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.elf] Error 1
make[1]: *** [../build/recurse.mk:12: modules/argon/user-part] Error 2
make: *** [C:\Users\Kaeltis\.particle\toolchains\buildscripts\1.7.1\Makefile:49: compile-user] Error 2
The terminal process terminated with exit code: 2

I’m guessing it’s because the particle workbench does not support the “ldflags” setting in the library’s property file (“compiler.libraries.ldflags” in arduinos platform.txt) and therefore does not link the libalgobsec.a library.

Is there a way to add this ldflag on a per-project basis or would I have to modify one of the deviceos makefiles? I tried messing with a couple of the ones in “modules\argon” but had no success.

I also found this old-ish post BSEC Sensor Library but could not get their solutions to work with the argon and particle workbench.

I have changed the category to Particle Workbench as the core of the question revolves around how to do that in Workbench irrespective of the reason why or for what library you need that feature.

This is a question best addressed by @m_m I think.

short-answer is: probably not. longer answer, w/ possible hacky work-around here:

Perhaps I’m missing the point, but is there a reason you aren’t using the Adafruit_BME680 library (included in Particle libraries)?

I managed to get the linker to use the library following this post: BSEC Sensor Library
However as soon as I do that, with a clean environment, the second time the platform_user_ram.ld file is generated, it includes format as a string, which breaks it:

> Executing task: make -f 'C:\Users\Kaeltis\.particle\toolchains\buildscripts\1.7.1\Makefile' compile-user -s <


Creating c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/platform_user_ram.ld ...
Creating c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/platform_user_ram.ld ...
c:/users/kaeltis/.particle/toolchains/gcc-arm/5.3.1/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld.exe:platform_user_ram.ld:1: syntax error
collect2.exe: error: ld returned 1 exit status
make[2]: *** [makefile:55: c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger_fi.elf] Error 1
make[1]: *** [../build/recurse.mk:12: modules/argon/user-part] Error 2
make: *** [C:\Users\Kaeltis\.particle\toolchains\buildscripts\1.7.1\Makefile:49: compile-user] Error 2
The terminal process terminated with exit code: 2

platform_user_ram.ld:

_user_part_static_ram_size = ( 0xformat + 0x00000970 + 16 );

@nrobinson2000 the Adafruit library doesn’t support all the proprietary features like temp/pressure compensation and calculating the IAQ level

1 Like

Could you try enabling verbose compiler output?

Here’s the verbose output:

[...]
Building target: c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.elf
Invoking: ARM GCC C++ Linker
mkdir -p c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/
C:/Users/Kaeltis/.particle/toolchains/gcc-arm/5.3.1/bin/arm-none-eabi-g++ -DSTM32_DEVICE -DnRF52840 -DNRF52840_XXAA -DPLATFORM_THREADING=1 -DPLATFORM_ID=12 -DPLATFORM_NAME=argon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00C -DUSBD_PID_CDC=0xC00C -g3 -gdwarf-2 -Os -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DSOFTDEVICE_PRESENT=1 -DS140 -DINCLUDE_PLATFORM=1 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-config-project.h\" -DENABLE_FEM=1 -DNRF_802154_PROJECT_CONFIG=\"openthread-platform-config.h\" -DRAAL_SOFTDEVICE=1 -D_WIZCHIP_=W5500 -fno-builtin -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DLFS_CONFIG=lfs_config.h -DSYSTEM_VERSION_STRING=1.4.0 -DRELEASE_BUILD -Werror -I../../../user/inc -I../../../dynalib/inc -I../../../services/inc -I../../../third_party/nanopb/nanopb -I../../../hal/inc -I../../../hal/shared -I../../../hal/src/argon -I../../../hal/network/lwip/esp32 -I../../../hal/src/nRF52840 -I../../../hal/src/armv7 -I../../../hal/src/nRF52840 -I../../../hal/src/nRF52840/lwip -I../../../hal/src/nRF52840/freertos -I../../../hal/src/nRF52840/openthread -I../../../hal/src/nRF52840/mbedtls -I../../../hal/src/nRF52840/littlefs -I../../../hal/network/api -I../../../hal/network/lwip -I../../../hal/network/lwip/posix -I../../../hal/network/openthread -I../../../hal/network/lwip/wiznet -I../../../hal/network/ncp -I../../../hal/network/ncp/at_parser -I../../../third_party/lwip/lwip/src/include -I../../../third_party/freertos/freertos/FreeRTOS/Source/include -I../../../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/GCC/nrf52 -I../../../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/CMSIS/nrf52 -I../../../third_party/openthread/openthread/include -I../../../third_party/openthread/openthread/src/core -I../../../third_party/openthread/openthread/examples/platforms -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/hal -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch/raal -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch/raal/softdevice -I../../../third_party/wiznet_driver/wiznet_driver/Ethernet -I../../../gsm0710muxer/gsm0710muxer/include -I../../../system/inc -I../../../third_party/miniz/miniz -I../../../rt-dynalib/inc -I../../../wiring/inc -I../../../modules/shared/nRF52840/inc -I../../../platform/shared/inc -I../../../third_party/nrf5_sdk -I../../../third_party/nrf5_sdk/nrf5_sdk/components/toolchain/cmsis/include -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/include -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/src/prs -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/util -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/crc32 -I../../../third_party/nrf5_sdk/nrf5_sdk/integration/nrfx/legacy -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log/src -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/queue -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/mbr/nrf52840/headers -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140 -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fifo -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_fifo -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/strerror -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_flags -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc/acm -I../../../third_party/nrf5_sdk/nrf5_sdk/components/ble/common -I../../../third_party/nrf5_sdk/nrf5_sdk/components/ble/nrf_ble_gatt 
-I../../../third_party/nrf5_sdk/nrf5_sdk/components/ble/ble_advertising -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/t2t_lib -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/platform -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/generic/message -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/generic/record -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/lauchapp -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/text -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/uri -I../../../third_party/nrf5_sdk/nrf5_sdk/external/nrf_cc310/include -I../../../third_party/nrf5_sdk/nrf5_sdk/external/utf_converter -I../../../third_party/littlefs/littlefs -I../../../platform/MCU/nRF52840/inc -I../../../modules/shared/nRF52840/inc/user-part -I. -MD -MP -MF c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.elf.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0xD4000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,1,1401 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/user_export.o c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/module_info.o c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/user_module.o c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/newlib_stubs.o  --output c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.elf -Wl,--whole-archive ../../../user/applications/argon-BME680/libalgobsec.a -Wl,--no-whole-archive -nostartfiles -Xlinker --gc-sections -L../../../build/arm/linker/nrf52840  -L../../../build/target/user/platform-12-m/bme680datalogger/ -L../../../build/target/services-dynalib/platform-12-m/ -L../../../build/target/hal-dynalib/platform-12-m/ -L../../../build/target/system-dynalib/platform-12-m/ -L../../../build/target/rt-dynalib/platform-12-m/ -L../../../build/target/wiring/platform-12-m/ -L../../../build/target/communication-dynalib/platform-12-m/ -L../../../build/target/platform/platform-12-m/ -L../../../build/target/nrf5_sdk/platform-12-m/ -L../../../build/target/littlefs/platform-12-m/ -L../../../build/target/wiring_globals/platform-12-m/ -L../../../user/applications/argon-BME680/ -L../../../build/target/nrf5_sdk/platform-12-m -L../../../build/target/littlefs/platform-12-m -L../../../build/arm/linker -Wl,--whole-archive -luser -lhal-dynalib -lservices-dynalib 
-lsystem-dynalib -lrt-dynalib -lwiring -lcommunication-dynalib -lplatform -lwiring_globals -lnrf5_sdk -llittlefs -Wl,--no-whole-archive  -lnosys --specs=nano.specs -L../../../modules/argon/system-part1 -L. -Lc:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/ -T./linker.ld -Wl,--defsym,USER_FIRMWARE_IMAGE_SIZE=0x20000 -Wl,--defsym,USER_FIRMWARE_IMAGE_LOCATION=0xD4000 -Wl,-Map,c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.map -Wl,--defsym,__STACKSIZE__=2048 -Wl,--defsym,__STACK_SIZE=2048

rm -f c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/platform_user_ram.ld
mkdir -p c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/
make -f ../../../modules/shared/nRF52840/build_linker_script.mk INTERMEDIATE_ELF=c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.elf
make[3]: Entering directory '/cygdrive/c/Users/Kaeltis/.particle/toolchains/deviceOS/1.4.0/firmware-1.4.0/modules/argon/user-part'
Creating c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/platform_user_ram.ld ...
make[3]: Leaving directory '/cygdrive/c/Users/Kaeltis/.particle/toolchains/deviceOS/1.4.0/firmware-1.4.0/modules/argon/user-part'

Generating the final ELF file...
mkdir -p c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/
C:/Users/Kaeltis/.particle/toolchains/gcc-arm/5.3.1/bin/arm-none-eabi-g++ -DSTM32_DEVICE -DnRF52840 -DNRF52840_XXAA -DPLATFORM_THREADING=1 -DPLATFORM_ID=12 -DPLATFORM_NAME=argon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD00C -DUSBD_PID_CDC=0xC00C -g3 -gdwarf-2 -Os -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DSOFTDEVICE_PRESENT=1 -DS140 -DINCLUDE_PLATFORM=1 -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-config-project.h\" -DENABLE_FEM=1 -DNRF_802154_PROJECT_CONFIG=\"openthread-platform-config.h\" -DRAAL_SOFTDEVICE=1 -D_WIZCHIP_=W5500 -fno-builtin -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DLFS_CONFIG=lfs_config.h -DSYSTEM_VERSION_STRING=1.4.0 -DRELEASE_BUILD -Werror -I../../../user/inc -I../../../dynalib/inc -I../../../services/inc -I../../../third_party/nanopb/nanopb -I../../../hal/inc -I../../../hal/shared -I../../../hal/src/argon -I../../../hal/network/lwip/esp32 -I../../../hal/src/nRF52840 -I../../../hal/src/armv7 -I../../../hal/src/nRF52840 -I../../../hal/src/nRF52840/lwip -I../../../hal/src/nRF52840/freertos -I../../../hal/src/nRF52840/openthread -I../../../hal/src/nRF52840/mbedtls -I../../../hal/src/nRF52840/littlefs -I../../../hal/network/api -I../../../hal/network/lwip -I../../../hal/network/lwip/posix -I../../../hal/network/openthread -I../../../hal/network/lwip/wiznet -I../../../hal/network/ncp -I../../../hal/network/ncp/at_parser -I../../../third_party/lwip/lwip/src/include -I../../../third_party/freertos/freertos/FreeRTOS/Source/include -I../../../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/GCC/nrf52 -I../../../third_party/nrf5_sdk/nrf5_sdk/external/freertos/portable/CMSIS/nrf52 -I../../../third_party/openthread/openthread/include -I../../../third_party/openthread/openthread/src/core -I../../../third_party/openthread/openthread/examples/platforms -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/hal -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch/raal -I../../../third_party/openthread/openthread/third_party/NordicSemiconductor/drivers/radio/rsch/raal/softdevice -I../../../third_party/wiznet_driver/wiznet_driver/Ethernet -I../../../gsm0710muxer/gsm0710muxer/include -I../../../system/inc -I../../../third_party/miniz/miniz -I../../../rt-dynalib/inc -I../../../wiring/inc -I../../../modules/shared/nRF52840/inc -I../../../platform/shared/inc -I../../../third_party/nrf5_sdk -I../../../third_party/nrf5_sdk/nrf5_sdk/components/toolchain/cmsis/include -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/include -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/mdk -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/hal -I../../../third_party/nrf5_sdk/nrf5_sdk/modules/nrfx/drivers/src/prs -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/util -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/crc32 -I../../../third_party/nrf5_sdk/nrf5_sdk/integration/nrfx/legacy -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/log/src -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/experimental_section_vars -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/delay -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/queue -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/common -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/mbr/nrf52840/headers -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140 -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers -I../../../third_party/nrf5_sdk/nrf5_sdk/components/softdevice/s140/headers/nrf52 -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fifo -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_fifo -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/strerror -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/fstorage -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/atomic_flags -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc -I../../../third_party/nrf5_sdk/nrf5_sdk/components/libraries/usbd/class/cdc/acm -I../../../third_party/nrf5_sdk/nrf5_sdk/components/ble/common -I../../../third_party/nrf5_sdk/nrf5_sdk/components/ble/nrf_ble_gatt 
-I../../../third_party/nrf5_sdk/nrf5_sdk/components/ble/ble_advertising -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/t2t_lib -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/platform -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/generic/message -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/generic/record -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/lauchapp -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/text -I../../../third_party/nrf5_sdk/nrf5_sdk/components/nfc/ndef/uri -I../../../third_party/nrf5_sdk/nrf5_sdk/external/nrf_cc310/include -I../../../third_party/nrf5_sdk/nrf5_sdk/external/utf_converter -I../../../third_party/littlefs/littlefs -I../../../platform/MCU/nRF52840/inc -I../../../modules/shared/nRF52840/inc/user-part -I. -MD -MP -MF c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger_fi.elf.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -Wundef -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0xD4000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=6 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,1,1401 -DMODULE_DEPENDENCY2=0,0,0 -D_WINSOCK_H -D_GNU_SOURCE c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/user_export.o c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/module_info.o c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/user_module.o c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon//obj/./src/newlib_stubs.o  --output c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger_fi.elf -Wl,--whole-archive ../../../user/applications/argon-BME680/libalgobsec.a -Wl,--no-whole-archive -nostartfiles -Xlinker --gc-sections -L../../../build/arm/linker/nrf52840  -L../../../build/target/user/platform-12-m/bme680datalogger/ -L../../../build/target/services-dynalib/platform-12-m/ -L../../../build/target/hal-dynalib/platform-12-m/ -L../../../build/target/system-dynalib/platform-12-m/ -L../../../build/target/rt-dynalib/platform-12-m/ -L../../../build/target/wiring/platform-12-m/ -L../../../build/target/communication-dynalib/platform-12-m/ -L../../../build/target/platform/platform-12-m/ -L../../../build/target/nrf5_sdk/platform-12-m/ -L../../../build/target/littlefs/platform-12-m/ -L../../../build/target/wiring_globals/platform-12-m/ -L../../../user/applications/argon-BME680/ -L../../../build/target/nrf5_sdk/platform-12-m -L../../../build/target/littlefs/platform-12-m -L../../../build/arm/linker -Wl,--whole-archive -luser -lhal-dynalib -lservices-dynalib -lsystem-dynalib -lrt-dynalib -lwiring -lcommunication-dynalib -lplatform -lwiring_globals -lnrf5_sdk -llittlefs -Wl,--no-whole-archive  -lnosys --specs=nano.specs -L../../../modules/argon/system-part1 -L. -Lc:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/ -T./linker.ld -Wl,--defsym,USER_FIRMWARE_IMAGE_SIZE=0x20000 -Wl,--defsym,USER_FIRMWARE_IMAGE_LOCATION=0xD4000 -Wl,-Map,c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.map -Wl,--defsym,__STACKSIZE__=2048 -Wl,--defsym,__STACK_SIZE=2048
c:/users/kaeltis/.particle/toolchains/gcc-arm/5.3.1/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld.exe:platform_user_ram.ld:1: syntax error
collect2.exe: error: ld returned 1 exit status
make[2]: *** [makefile:55: c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger_fi.elf] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/Kaeltis/.particle/toolchains/deviceOS/1.4.0/firmware-1.4.0/modules/argon/user-part'
make[1]: *** [../build/recurse.mk:12: modules/argon/user-part] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/Kaeltis/.particle/toolchains/deviceOS/1.4.0/firmware-1.4.0/main'
make: *** [C:\Users\Kaeltis\.particle\toolchains\buildscripts\1.7.1\Makefile:49: compile-user] Error 2
The terminal process terminated with exit code: 2

Since the platform_user_ram.ld is created by modules\shared\nRF52840\build_linker_script.mk I modified it to echo the line that greps for DATA_SECTION_LEN:

DATA_SECTION_LEN  = $(shell arm-none-eabi-objdump -h --section=.data $(INTERMEDIATE_ELF) | grep .data)
TEST  := $(DATA_SECTION_LEN)
DATA_SECTION_LEN := 0x$(word 3,$(DATA_SECTION_LEN))
...
@echo $(TEST)

This is the output:
c:/Users/Kaeltis/Documents/Particle/bme680datalogger/target/1.4.0/argon/bme680datalogger.elf: file format elf32-littlearm 5 .data 0000006c 20028400 000e0f58 00018400 2**2

This is the output from an “empty” project and clean deviceos:
4 .data 00000068 2003e374 000d52c0 0000e374 2**2

This seems to be where “format” is coming from, but why is the formatting of that line different when I use the library? I can get it to compile if I change

DATA_SECTION_LEN := 0x$(word 3,$(DATA_SECTION_LEN))
to
DATA_SECTION_LEN := 0x$(word 7,$(DATA_SECTION_LEN))

in modules\shared\nRF52840\build_linker_script.mk, which is an awful workaround, but I don’t get why the output changes.

@Kaeltis, I had hacked together the adafruit library to get it working ONLY with BSEC v1.4.6.0 you can find the instructions to get it working with offline compiler in this post

Thanks, I already followed your post, but using the official BSEC Arduino library I linked in the first post instead of the Adafruit one, it really helped a lot.

I’m still not sure why it requires modifying modules\shared\nRF52840\build_linker_script.mk though.