Program received signal SIGTRAP, Trace/breakpoint trap.
HardFault_Handler () at ../../../../HAL/NRF52/HAL.cpp:122
122 __debugbreak();
(gdb) bt
#0 HardFault_Handler () at ../../../../HAL/NRF52/HAL.cpp:122
#1 <signal handler called>
#2 nrf_rtc_event_pending (event=event@entry=NRF_RTC_EVENT_OVERFLOW, p_reg=0x20010000) at /home/triffid/Projects/NRF/nRF5_SDK/modules/nrfx/hal/nrf_rtc.h:361
#3 evt_pending (event=event@entry=NRF_RTC_EVENT_OVERFLOW, p_instance=<optimized out>, p_instance=<optimized out>) at /home/triffid/Projects/NRF/nRF5_SDK/components/libraries/timer/drv_rtc.c:187
#4 0x00003180 in drv_rtc_overflow_pending (p_instance=p_instance@entry=0x0 <nrf_atfifo_get_free>) at /home/triffid/Projects/NRF/nRF5_SDK/components/libraries/timer/drv_rtc.c:289
#5 0x00002996 in rtc_irq (p_instance=0x0 <nrf_atfifo_get_free>) at /home/triffid/Projects/NRF/nRF5_SDK/components/libraries/timer/app_timer2.c:459
#6 <signal handler called>
#7 0x00002fe4 in drv_rtc_init (p_instance=p_instance@entry=0x20000010 <m_rtc_inst>, p_config=p_config@entry=0x2000ffe4, handler=handler@entry=0x298d <rtc_irq>) at /home/triffid/Projects/NRF/nRF5_SDK/components/libraries/timer/drv_rtc.c:104
#8 0x000028e6 in app_timer_init () at /home/triffid/Projects/NRF/nRF5_SDK/components/libraries/timer/app_timer2.c:538
#9 0x00001406 in init () at ../../../../HAL/NRF52/HAL.cpp:94
If I edit drv_rtc_init@drv_rtc.c:102 and move NRFX_IRQ_ENABLE a few lines down below m_cb[p_instance->instance_id].p_instance = p_instance;, the hardfault no longer occurs and my code works normally.
Why the interrupt is triggering immediately after being enabled I've no idea.
Fwiw, I'm using nRF5_SDK_17.0.2_d674dde which I believe is the latest release.