Failure of the BMA4xx driver to compile

This is NOT a runtime error it's a compile time error (application). Failing at stage [154/159] Linking C executable zephyr\zephyr_pre0.elf

Having started by following the "nRF Connect SDK hands-on, series" with Ali Aljaaani.  I got his examples working OK but when I try to replace one of the sensors with the BMA400, via the bma4xx driver I get a compilation error.

Ther only call to the driver is:

	if (!device_is_ready(dev)) {
		printk("\nError: Device \"%s\" is not ready; "
		       "check the driver initialization logs for errors.\n",
		       dev->name);
		return NULL;
	}

Overlay file:

bma400: bma400@14 {
//        compatible = "bosch,bma4xx";   // BMA4xx Driver fails 
        compatible = "bosch,bma280";	// BMA280 Driver compiles OK
        status = "okay";
        reg = < 0x14 >;
    };
};

If I point to the BMA280 driver it compiles correctly and produces the expected result:

*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***

Error: Device "bme688@76" is not ready; check the driver initialization logs for errors.

Error: Device "bmi270@68" is not ready; check the driver initialization logs for errors.

Error: Device "bma400@14" is not ready; check the driver initialization logs for errors.

I can only assume there is a bug in one of the files in: "C:\ncs\v2.7.0\zephyr\drivers\sensor\bosch\bma4xx"

I am using toolchain/SDK 2.7.0 and my target is a 52832-dk board, no hardware sensors.

chris

test_case_bma4xx.zip

*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***

Error: Device "bme688@76" is not ready; check the driver initialization logs for errors.

Error: Device "bmi270@68" is not ready; check the driver initialization logs for errors.

Error: Device "bma400@14" is not ready; check the driver initialization logs for errors.



Building test_case_bma4xx
C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir m:/nrf-projects/test_case_bma4xx/build m:/nrf-projects/test_case_bma4xx --pristine --board nrf52dk/nrf52832 -- -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=m:/nrf-projects/test_pcb;m:/nrf-projects/eeprom;m:/nrf-projects/eeprom_samp;m:/nrf-projects/peripheral_lbs;m:/nrf-projects/test_case_bma4xx"

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: M:/nrf-projects/test_case_bma4xx
-- CMake version: 3.21.0
-- Found Python3: C:/ncs/toolchains/ce3b5ff664/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:/ncs/v2.7.0/zephyr/.cache
-- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: nrf52dk, qualifiers: nrf52832
-- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/ce3b5ff664/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: C:/ncs/v2.7.0/zephyr/boards/nordic/nrf52dk/nrf52dk_nrf52832.dts
-- Found devicetree overlay: M:/nrf-projects/test_case_bma4xx/boards/nrf52dk_nrf52832.overlay
-- Generated zephyr.dts: M:/nrf-projects/test_case_bma4xx/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: M:/nrf-projects/test_case_bma4xx/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: M:/nrf-projects/test_case_bma4xx/build/zephyr/dts.cmake
Parsing M:/nrf-projects/test_case_bma4xx/Kconfig
Loaded configuration 'C:/ncs/v2.7.0/zephyr/boards/nordic/nrf52dk/nrf52dk_nrf52832_defconfig'
Merged configuration 'M:/nrf-projects/test_case_bma4xx/prj.conf'
Configuration saved to 'M:/nrf-projects/test_case_bma4xx/build/zephyr/.config'
Kconfig header saved to 'M:/nrf-projects/test_case_bma4xx/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/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/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.7.0/zephyr/CMakeLists.txt:2027 (message):
  __ASSERT() statements are globally ENABLED


-- Configuring done
-- Generating done
-- Build files have been written to: M:/nrf-projects/test_case_bma4xx/build
-- west build: building application
[4/159] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr), build: v3.6.99-ncs2
[154/159] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map M:/nrf-projects/test_case_bma4xx/build/zephyr/zephyr_pre0.map 
cmd.exe /C "cd . && C:\ncs\toolchains\ce3b5ff664\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=M:/nrf-projects/test_case_bma4xx/build/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/nrf52832/libsoc__nordic.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/i2c/libdrivers__i2c.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/sensor/bosch/bme680/libdrivers__sensor__bosch__bme680.a  zephyr/drivers/sensor/bosch/bmi270/libdrivers__sensor__bosch__bmi270.a  zephyr/drivers/sensor/nordic/temp/libdrivers__sensor__nordic__temp.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/dk_buttons_and_leds/lib..__nrf__lib__dk_buttons_and_leds.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/segger/libmodules__segger.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp"  -LM:/nrf-projects/test_case_bma4xx/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_LONG_LONG_PRINTF_SCANF  --specs=picolibc.specs  -lc  -lgcc && cmd.exe /C "cd /D M:\nrf-projects\test_case_bma4xx\build\zephyr && C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(sensor_data_collector.c.obj): in function `sensor_data_collector':
M:/nrf-projects/test_case_bma4xx/src/sensor_data_collector.c:90: undefined reference to `__device_dts_ord_105'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.EXE' --build 'm:\nrf-projects\test_case_bma4xx\build'

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

Parents
  • Hi Thanks,

    I may have tracked down the issue after trawling through the build directory I discovered that there had been no attempt to compile the driver so the cause of the error was no "bma4xx.obj" file.  The error only showed at link time...

    It appear that two new CONFIG entries are required for this driver but not the previous Bosch drivers.

    CONFIG_SENSOR_ASYNC_API=y
    CONFIG_BMA4XX=y

    As I'm at work I can only try this on the testcase I submitted which now compiles.  I will try in the full code this evening.

    This is not mentioned here, maybe it should be!

    docs.nordicsemi.com/.../bosch_bma4xx-i2c.html

    Hope this helps other users.

    Chris

Reply
  • Hi Thanks,

    I may have tracked down the issue after trawling through the build directory I discovered that there had been no attempt to compile the driver so the cause of the error was no "bma4xx.obj" file.  The error only showed at link time...

    It appear that two new CONFIG entries are required for this driver but not the previous Bosch drivers.

    CONFIG_SENSOR_ASYNC_API=y
    CONFIG_BMA4XX=y

    As I'm at work I can only try this on the testcase I submitted which now compiles.  I will try in the full code this evening.

    This is not mentioned here, maybe it should be!

    docs.nordicsemi.com/.../bosch_bma4xx-i2c.html

    Hope this helps other users.

    Chris

Children
No Data
Related