This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr DT_N_INST_ symbols not defined in dtc output

Hello Nordic Devzone Community,

I am developing an out of tree driver for firmware running on an nRF9160.  I've made some progress and am getting closer to correctly implementing my driver code to connect with Zephyr Project 2.6.99 drivers API.  But I have some difficult to trace errors relating to two device related symbols that are not getting defined.  The two undefined symbols are DT_N_INST_0_kionix_kx132_BUS_P_label and DT_N_INST_0_kionix_kx132_P_label.

Excerpts from the longer build messages are:

In file included from /home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/arch/arm/aarch32/arch.h:20,
                 from /home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/arch/cpu.h:19,
                 from /home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/kernel_includes.h:33,
                 from /home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/kernel.h:17,
                 from /home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/init.h:11,
                 from /home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/device.h:29,
                 from /home/cpguest/embedded/z1-sandbox-2021-08-26/kionix-drivers/drivers/kionix/kx132-1211/kx132-1211.c:10:
/home/cpguest/embedded/z1-sandbox-2021-08-26/kionix-drivers/drivers/kionix/kx132-1211/kx132-1211.c: In function 'kx132_1211_init':
/home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/devicetree.h:301:40: error: 'DT_N_INST_0_kionix_kx132_BUS_P_label' undeclared (first use in this function); did you mean 'DT_N_INST_0_kionix_kx132_1211'?
  301 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                                        ^~~~~~~~~

and similarly,

/home/cpguest/embedded/z1-sandbox-2021-08-26/kionix-drivers/drivers/kionix/kx132-1211/kx132-1211.c:156:20: note: (near initialization for 'kx132_api.channel_get')
In file included from /home/cpguest/embedded/z1-sandbox-2021-08-26/kionix-drivers/drivers/kionix/kx132-1211/kx132-1211.c:10:
/home/cpguest/embedded/z1-sandbox-2021-08-26/zephyr/include/devicetree.h:301:40: error: 'DT_N_INST_0_kionix_kx132_P_label' undeclared here (not in a function); did you mean 'DT_N_INST_0_kionix_kx132_1211'?
  301 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                                        ^~~~~~~~~

I have this tiny "first foray" project hosted at Github at  github.com/.../kionix-driver-demo.  This project closely follows the file and directory structure of one Jared Wolff project "Air Quality Wing driver demo".  I'm using a west manifest file to manage my out-of-tree driver dependencies.  That part is working.

What is unclear from these error messages, aside from these needed symbols not being defined, is any advice from cmake, device tree compiler dtc or other build toolchain elements about where to review for likely corrections.  I have scrutinized my new device bindings file, and my board overlay file which connects the new sensor to the nRF9160 I2C bus instance number 1.  I don't see any errors in these device tree related files.

Can any Zephyr applications developers suggest specific places to look for sources of this build time error?  Are there errors in my overlay and bindings files?  Am I missing inclusion of needed Zephyr header files?

Thanks ahead of time for insights and help on this issue.

- Ted

Related