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.

Related