I am currently porting the nrf_cc3xx_platform library to use it with RIOT OS. Following what has been done for Zephyr and FreeRTOS, I implemented:
- Abort API
-
nrf_cc3xx_platform_abort_init - one instance of
nrf_cc3xx_platform_abort_apis_t
-
- Mutex API
-
nrf_cc3xx_platform_mutex_init - one instance of
nrf_cc3xx_platform_mutexes_t(with the corresponding mutexes) - one instance of
nrf_cc3xx_platform_mutex_apis_t(with the corresponding functions)
-
Based on the code of the nrfConnect CC310 hardware driver I have my own driver:
int cc310_init(void) {
int res;
/* Enable interrupts */
NVIC_EnableIRQ(CRYPTOCELL_IRQn);
/* Set the RTOS abort APIs */
nrf_cc3xx_platform_abort_init();
/* Set the RTOS mutex APIs */
nrf_cc3xx_platform_mutex_init();
/* Initialize the cc3xx HW with RNG support */
res = nrf_cc3xx_platform_init();
if (res) {
DEBUG("Could not initialize cc310 platform (%d)\n", res);
}
else {
DEBUG("Initialized cc310 platform\n");
}
return res;
}
/* This sets the interrupt handler */
void isr_cryptocell(void)
{
CRYPTOCELL_IRQHandler();
}
The problem I'm facing is that nrf_cc3xx_platform_init never returns, and gets stuck in CC_PalWaitInterruptRND. The complete backtrace looks like this:
#0 0x00001092 in CC_PalWaitInterruptRND () #1 0x00002128 in LLF_RND_WaitRngInterrupt () #2 0x00001aa0 in getTrngSource () #3 0x00001c2a in LLF_RND_RunTrngStartupTest () #4 0x0000138a in RndStartupTest.constprop.0 () #5 0x0000144a in CC_LibInit () #6 0x0000119a in nrf_cc3xx_platform_init () #7 0x00000ff4 in cc310_init () at cc310.c:39 #8 0x00000166 in main () at main.c:35
I have already checked that no call to the mutex API gets stuck. Placing a breakpoint on the interrupt handler shows that no interrupts are being triggered. Am I missing some initialization?
I'm using the cortex-m33 soft-float library archive (libnrf_cc310_platform_0.9.12.a). The version I checked out of nrfxlib is the commit 4a060cdb789b8e8eec025f7164d77322ad0cc2a5.
Thank you.