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
  • Hi,

    It seems something is not enabled, either in your device tree or Kconfig (prj.conf). I suggest you open your build folder and find this file: <build_folder>/zephyr/include/generated/devicetree_generated.h. There you see the numbered nodes. As you got __device_dts_ord_127, 127 is relevant here. That points to a peripheral or similar, and that needs to be enabled/included.

  • I have some new information that can perhaps help you verify on Nordic side.  


    I was reviewing this web page of Nordics 
    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/developing/adding_code.html#dm-user-workflows

    So I decided to try this 
    "The ncs-example-application repository is tagged every time a new release of the nRF Connect SDK is launched (starting with v2.3.0), using the same version number. This allows you to select the tag that matches the version of the nRF Connect SDK you intend to use."

    Low and behold I received this error when building that app. 
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    main.c:46: undefined reference to `__device_dts_ord_4'

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:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    / {
    examplesensor0: examplesensor_0 {
    compatible = "zephyr,examplesensor";
    input-gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    };
    };
    &gpio0 {
    status = "okay";
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX