out of tree driver; builds, links but not in map

I have an out of tree driver (vl53l1x) building and linking for an out of tree board which works.  
However, another driver for bmi088, builds, appears to link but does not appear in the map files
which leads to this error when I try and use the sensor --> undefined reference to `__device_dts_ord_127' 

I have a feeling the dts fragment may be the cause but not sure at this point.

source tree looks like this 

- project_root
  - boards
  - dts
  - hello_world
    CMakeLists.txt
    KConfig
    prf.conf
    sample.yaml
  - drivers
    CMakeLists.txt
    KConfig
    - sensor 
      CMakeLists.txt
      KConfig
      - bmi088
        CMakeLists.txt
        KConfig
        <other code files>
      - vl53l1x (functioning)   
  - src
    main.c


Without trying to use the sensor 
[172/184] Linking C static library drivers\sensor\bmi088\lib..__..__..__workvob__xqc__bringup_empty__hello_world__drivers__sensor__bmi088.a
[173/184] Linking C static library zephyr\kernel\libkernel.a
[174/184] Linking C executable zephyr\zephyr_pre0.elf

When I try to use the sensor
[174/185] Linking C static library drivers\sensor\bmi088\lib..__..__..__workvob__xqc__bringup_empty__hello_world__drivers__sensor__bmi088.a
[175/185] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
c:/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(main.c.obj): in function `get_gyro_device':
C:\workvob\xqc\bringup_empty\hello_world\src\main.c:131: undefined reference to `__device_dts_ord_127'

Other functioning sensors left out 
&i2c1 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    clock-frequency = <I2C_BITRATE_FAST>;

    pinctrl-0 = <&i2c1_default>;
    pinctrl-1 = <&i2c1_sleep>;
    pinctrl-names = "default", "sleep";

    gyro: bmi088_gyr@69 {
      compatible = "bosch,bmi088-gyr";
      status = "okay";
      reg = <0x69>;
      // datasheet page 39
      bandwidth = <0x06>; // corner-frequency at 64 Hz
    };
    acc: bmi088_acc@18 {
      compatible = "bosch,bmi088-acc";
      status = "okay";
      reg = <0x18>;
      odr = <0x0B>; // 800 Hz
      osr = <0x08>; // 4 times oversampled
    };
};
Parents Reply Children
  • Hi,

    The error indicate that there is an issue with the devicetree for the board you build for. The ncs-example-application builds for custom_plank out of the box, but for other boards you need to add an overlay. You can refer to this overlay file, and add as similar for the board you are building for. As an example, a overlay for the nRF52840 DK that use P0.0 for the sensor, could look like this:

    / {
    	examplesensor0: examplesensor_0 {
    		compatible = "zephyr,examplesensor";
    		input-gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    	};
    };
    
    &gpio0 {
    	status = "okay";
    };

Related