k_sleep causes nRF5340 to reset
I’m porting some code from an nRF5340 eval board to my own board, and I’ve run into an issue. While waiting for the net core to boot up, I enter a loop and call k_sleep until an initialization callback returns, before proceeding to the rest of the code. For some reason, k_sleep is causing the application to reset, but only when building for release. Debug works perfectly fine. Replacing k_sleep with k_busy_wait or k_yield also works. This code was originally built on the zephyr release that ships with nRF Connect SDK 1.6.1, but updating to 1.7.1 doesn’t resolve the issue.
I’m working on creating a minimal project that reproduces this behaviour, but in the meantime, what could I check to troubleshoot this? Blinky, which also uses k_sleep in main, does not trigger a reset loop.