undefined reference to `__device_dts_ord_98'

I'm trying to use implement the real time clock rtc0. This is what I did:

I enabled CONFIG_RTC=y in the prj.conf.

&rtc0 {
            compatible = "nordic,nrf-rtc";
            reg = < 0x4000b000 0x1000 >;
            cc-num = < 0x3 >;
            interrupts = < 0xb 0x1 >;
            status = "okay";
            clock-frequency = < 0x8000 >;
            prescaler = < 0x1 >;
};

in the overlay file

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/rtc.h>

#define RTC_0 DT_NODELABEL(rtc0)
const struct device *timer_dev = DEVICE_DT_GET(RTC_0);
const struct rtc_time time;

int main(void)
{
        rtc_set_time(timer_dev, &time);
        return 0;
}

in the main

After I added rtc_set_time(timer_dev, &time); it fails to link the C executable zephyr/zephyr_pre0.elf with the error: undefined reference to `__device_dts_ord_98'

What did I forget to do or did wrong? I have the feeling I'm missing something like an additional initiation type function but there is very little documentation on how to actually set it up.

Parents Reply Children
  • Hi Ruth,

    I think its like Helsing said. We are confusing real time clock and real time counter. Its not good that they have the same abbreviation rtc (in my opinion it should be more like RTIC (increment counter). The real time counter is similar to the ticks of the MCU [like k_uptime_get()]. The real time clock needs a battery and a quartz which is kept running in order to track time even if the main device is turned off. Usually they are a seperate hardware module like the DS3231. My assumption was that since the nrf52840dk has a battery, its likely it has a real time clock, but I guess I'm wrong.

    Helsing please correct me if I misunderstood anything.

    Kind regards,

    Nicolas

Related