I'm trying to use this driver for my SCD40 sensor and I'm currently getting a "undefined reference to crc8". After the module installation, this is what I did.
cd %HOMEPATH%/199workspace/modules/sensirion_driver/samples/sensor
west build -p always -b xiao_ble scd4x
And this is the complete error:
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x
-- CMake version: 3.29.0
-- Using NCS Toolchain 2.6.20240304.889616714482 for building. (C:/ncs/toolchains/cf2149caf2/cmake)
-- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: C:/Users/angel/199workspace/zephyr/.cache
-- Zephyr version: 3.5.99 (C:/Users/angel/199workspace/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: xiao_ble
-- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/cf2149caf2/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/Users/angel/199workspace/zephyr/boards/arm/xiao_ble/xiao_ble.dts
-- Found devicetree overlay: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/app.overlay
-- Generated zephyr.dts: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/dts.cmake
Parsing C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/Kconfig
Loaded configuration 'C:/Users/angel/199workspace/zephyr/boards/arm/xiao_ble/xiao_ble_defconfig'
Merged configuration 'C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/prj.conf'
Configuration saved to 'C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/.config'
Kconfig header saved to 'C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/Users/angel/199workspace/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
CONFIG_USB_DEVICE_VID has default value 0x2FE3.
This value is only for testing and MUST be configured for USB products.
CMake Warning at C:/Users/angel/199workspace/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
CONFIG_USB_DEVICE_PID has default value 0x100.
This value is only for testing and MUST be configured for USB products.
-- Configuring done (8.6s)
-- Generating done (0.6s)
-- Build files have been written to: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build
←[92m-- west build: building application
[2/172] Generating include/generated/version.h
-- Zephyr version: 3.5.99 (C:/Users/angel/199workspace/zephyr), build: v3.5.99-ncs1
[45/172] Building C object CMakeFiles/app.dir/src/main.c.obj
C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/src/main.c:23:6: warning: return type of 'main' is not 'int' [-Wmain]
23 | void main(void)
| ^~~~
[167/172] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/zephyr_pre0.map
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\ncs\toolchains\cf2149caf2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarchcommon.a zephyr/arch/arch/arm/core/libarcharmcore.a zephyr/arch/arch/arm/core/cortex_m/libarcharmcore__cortex_m.a zephyr/arch/arch/arm/core/mpu/libarcharmcorempu.a zephyr/lib/libc/picolibc/libliblibcpicolibc.a zephyr/lib/libc/common/libliblibccommon.a zephyr/soc/soc/arm/nordic_nrf/libsocarmnordic_nrf.a zephyr/drivers/usb/device/libdriversusbdevice.a zephyr/drivers/usb/common/nrf_usbd_common/libdriversusbcommonnrf_usbd_common.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdriversconsole.a zephyr/drivers/gpio/libdriversgpio.a zephyr/drivers/hwinfo/libdrivershwinfo.a zephyr/drivers/i2c/libdriversi2c.a zephyr/drivers/pinctrl/libdriverspinctrl.a zephyr/drivers/sensor/nrf5/libdriverssensornrf5.a zephyr/drivers/serial/libdriversserial.a zephyr/drivers/timer/libdriverstimer.a modules/ncs-example-application/drivers/sensor/sen55/lib..ncs-example-applicationdriverssensorsen55.a modules/nrf/lib/fatal_error/lib..nrflibfatal_error.a modules/nrf/drivers/hw_cc3xx/lib..nrfdrivershw_cc3xx.a modules/sensirion_drivers/drivers/sensor/scd4x/lib..modulessensirion_driversdriverssensorscd4x.a modules/hal_nordic/nrfx/libmodules__hal_nordicnrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -LC:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_DOUBLE_PRINTF_SCANF C:/Users/angel/199workspace/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/soft-float/no-interrupts/libnrf_cc310_platform_0.9.19.a --specs=picolibc.specs -lc -lgcc && C:\WINDOWS\system32\cmd.exe /C "cd /D C:\Users\angel\199workspace\modules\sensirion_drivers\samples\sensor\build\zephyr && "C:\Program Files\CMake\bin\cmake.exe" -E true""
c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: modules/sensirion_drivers/drivers/sensor/scd4x/lib..modulessensirion_driversdriverssensor__scd4x.a(scd4x.c.obj): in function scd4x_compute_crc': C:/Users/angel/199workspace/modules/sensirion_drivers/drivers/sensor/scd4x/scd4x.c:33: undefined reference tocrc8'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\Users\angel\199workspace\modules\sensirion_drivers\samples\sensor\build'
I'm trying to use this driver for my SCD40 sensor and I'm currently getting a "undefined reference to crc8". After the module installation, this is what I did.
cd %HOMEPATH%/199workspace/modules/sensirion_driver/samples/sensor west build -p always -b xiao_ble scd4x
And this is the complete error:
-- west build: generating a build system Loading Zephyr default modules (Zephyr base). -- Application: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x -- CMake version: 3.29.0 -- Using NCS Toolchain 2.6.20240304.889616714482 for building. (C:/ncs/toolchains/cf2149caf2/cmake) -- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter -- Cache files will be written to: C:/Users/angel/199workspace/zephyr/.cache -- Zephyr version: 3.5.99 (C:/Users/angel/199workspace/zephyr) -- Found west (found suitable version "1.2.0", minimum required is "0.14.0") -- Board: xiao_ble -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk) -- Found Dtc: C:/ncs/toolchains/cf2149caf2/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/Users/angel/199workspace/zephyr/boards/arm/xiao_ble/xiao_ble.dts -- Found devicetree overlay: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/app.overlay -- Generated zephyr.dts: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/zephyr.dts -- Generated devicetree_generated.h: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/dts.cmake Parsing C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/Kconfig Loaded configuration 'C:/Users/angel/199workspace/zephyr/boards/arm/xiao_ble/xiao_ble_defconfig' Merged configuration 'C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/prj.conf' Configuration saved to 'C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/.config' Kconfig header saved to 'C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/include/generated/autoconf.h' -- Found GnuLd: c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38") -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- The ASM compiler identification is GNU -- Found assembler: C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe CMake Warning at C:/Users/angel/199workspace/zephyr/subsys/usb/device/CMakeLists.txt:22 (message): CONFIG_USB_DEVICE_VID has default value 0x2FE3.
This value is only for testing and MUST be configured for USB products.
CMake Warning at C:/Users/angel/199workspace/zephyr/subsys/usb/device/CMakeLists.txt:28 (message): CONFIG_USB_DEVICE_PID has default value 0x100.
This value is only for testing and MUST be configured for USB products.
-- Configuring done (8.6s) -- Generating done (0.6s) -- Build files have been written to: C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build ←[92m-- west build: building application [2/172] Generating include/generated/version.h -- Zephyr version: 3.5.99 (C:/Users/angel/199workspace/zephyr), build: v3.5.99-ncs1 [45/172] Building C object CMakeFiles/app.dir/src/main.c.obj C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/scd4x/src/main.c:23:6: warning: return type of 'main' is not 'int' [-Wmain] 23 | void main(void) | ^~~~ [167/172] Linking C executable zephyr\zephyr_pre0.elf FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/zephyr_pre0.map C:\WINDOWS\system32\cmd.exe /C "cd . && C:\ncs\toolchains\cf2149caf2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarchcommon.a zephyr/arch/arch/arm/core/libarcharmcore.a zephyr/arch/arch/arm/core/cortex_m/libarcharmcore__cortex_m.a zephyr/arch/arch/arm/core/mpu/libarcharmcorempu.a zephyr/lib/libc/picolibc/libliblibcpicolibc.a zephyr/lib/libc/common/libliblibccommon.a zephyr/soc/soc/arm/nordic_nrf/libsocarmnordic_nrf.a zephyr/drivers/usb/device/libdriversusbdevice.a zephyr/drivers/usb/common/nrf_usbd_common/libdriversusbcommonnrf_usbd_common.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdriversconsole.a zephyr/drivers/gpio/libdriversgpio.a zephyr/drivers/hwinfo/libdrivershwinfo.a zephyr/drivers/i2c/libdriversi2c.a zephyr/drivers/pinctrl/libdriverspinctrl.a zephyr/drivers/sensor/nrf5/libdriverssensornrf5.a zephyr/drivers/serial/libdriversserial.a zephyr/drivers/timer/libdriverstimer.a modules/ncs-example-application/drivers/sensor/sen55/lib..ncs-example-applicationdriverssensorsen55.a modules/nrf/lib/fatal_error/lib..nrflibfatal_error.a modules/nrf/drivers/hw_cc3xx/lib..nrfdrivershw_cc3xx.a modules/sensirion_drivers/drivers/sensor/scd4x/lib..modulessensirion_driversdriverssensorscd4x.a modules/hal_nordic/nrfx/libmodules__hal_nordicnrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L"c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -LC:/Users/angel/199workspace/modules/sensirion_drivers/samples/sensor/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie -DPICOLIBC_DOUBLE_PRINTF_SCANF C:/Users/angel/199workspace/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/soft-float/no-interrupts/libnrf_cc310_platform_0.9.19.a --specs=picolibc.specs -lc -lgcc && C:\WINDOWS\system32\cmd.exe /C "cd /D C:\Users\angel\199workspace\modules\sensirion_drivers\samples\sensor\build\zephyr && "C:\Program Files\CMake\bin\cmake.exe" -E true"" c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: modules/sensirion_drivers/drivers/sensor/scd4x/lib..modulessensirion_driversdriverssensor__scd4x.a(scd4x.c.obj): in function
scd4x_compute_crc': C:/Users/angel/199workspace/modules/sensirion_drivers/drivers/sensor/scd4x/scd4x.c:33: undefined reference to
crc8' collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'C:\Users\angel\199workspace\modules\sensirion_drivers\samples\sensor\build'