Build error with BMI270 on Thingy:53 — ZERO_OR_COMPILE_ERROR in DEVICE_DT_GET_ONE

Hi, I’m trying to build the github.com/.../neuton-nordic-thingy53-ble-remotecontrol project using nRF Connect SDK v2.6.2.
I added the BMI270 sensor on SPI3 in my DeviceTree overlay:

&spi3 { bmi270: spi-dev-bmi270@1 { status = "okay"; }; };

In my code (bsp_imu.c), I try to initialize the device like this:

imu_ctx_.dev = DEVICE_DT_GET_ONE(bosch_bmi270);

But during build I get the following error:

error: size of unnamed array is negative zephyr/include/zephyr/sys/util.h:94:55: note: in expansion of macro 'ZERO_OR_COMPILE_ERROR' zephyr/include/zephyr/device.h:286:22: note: in expansion of macro 'DEVICE_DT_GET_ONE' bsp_imu.c:38:22: note: in expansion of macro 'DEVICE_DT_GET_ONE'

It looks like DEVICE_DT_GET_ONE(bosch_bmi270) doesn’t find any compatible in the DeviceTree, which causes the compile-time error.

Related