CONFIG_LOG=y leads to linker error: sync_rtc.c:239: undefined reference to `__device_dts_ord_21'

I could use a little help tracking down a linker undefined reference error. I am using nRF Connect in VS Code

c:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/soc/soc/arm/nordic_nrf/libsoc__arm__nordic_nrf.a(sync_rtc.c.obj): in function `sync_rtc_setup':
C:/ncs/v2.6.0/zephyr/soc/arm/nordic_nrf/nrf53/sync_rtc.c:239: undefined reference to `__device_dts_ord_21'
collect2.exe: error: ld returned 1 exit status

I took a sample project for the Zephyr shell and modified it to use a USB CDC backend (no code changes, just dts/kconfig)

By default, the Zephy shell sample has CONFIG_LOG=y, which has a dependency: CONFIG_NRF53_SYNC_RTC=y

If I build it against the nrf5340dk, it works fine.

If I build it against my custom board file, it fails with the above undefined reference error.

If I disable the RTC in prj.conf with CONFIG_NRF53_SYNC_RTC=n, it builds against my custom board just fine.

So my takeaway is that there must be something missing in my custom board files (RTC related?) that is leading to the undefined reference linker error.

Problem is, I'm not seeing anytrhing obvious or finding an easy solution by googling.

 

Related