IPC/ICMSG breaks if buffer has contents on reboot, but only with very specific config

Hello Nordic support

I have encountered what I think is a bug in ICMSG. The attached sample shows the following behavior:

  1. The first time it runs, the app and flpr CPUs succesfully start and communicate via IPC.
  2. Then, on reboot, cpuflpr seemingly immediately read some info from the IPC channel and crash.
  3. On the next reboot everything works again.

From this behavior I conclude that the IPC library does not properly work if the IPC buffer contains information from the previous boot. You can reproduce this on an nrf54l15dk building with the command west build -b nrf54l15dk/nrf54l15/cpuapp --sysbuild. Something strange, which is noted in the README of the code, is that which logging backend is used on both cores seems to have an effect on whether this issue appears. Also, enabling multithreading on FLPR also makes the issue disappear.

Example FLPR output (working):

*** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
I: Initializing...
D: initializing IPC...
D: Opening instance...
D: Registering endpoint...
D: Register endpoint
I: IPC initialized.

I: Waiting before sending IPC, so APP core gets unstuck
I: Received ipc of len 4
I: Setting level 20
I: Received 20, sending back 21!
I: Received ipc of len 4
I: Setting level 50
I: Received 50, sending back 51!
I: Received ipc of len 4
I: Setting level 80
I: Received 80, sending back 81!
I: Received ipc of len 4
I: Setting level 9
I: Received 9, sending back 10!

Example FLPR output (crash):

*** Booting nRF Connect SDK v3.0.1-9eb5615da66b ***
*** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
I: Initializing...
D: initializing IPC...
D: Opening instance...
D: Registering endpoint...
D: Register endpoint
I: Received ipc of len 4
I: Setting level 20
I: Received ipc of len 4
I: Setting level 50
I: Received ipc of len 4
I: Setting level 80
I: Received ipc of len 4
I: Setting level 9
I: IPC initialized.

I: Received ipc of len 4g IPC, so APP core gets unstuck
I: Setting level 39
I: Received ipc of len 4
I: Setting level 69
I: Received ipc of len 4
I: Setting level 99
I: Received ipc of len 4
I: Setting level 28
I: Received ipc of len 4
I: Setting level 58
I: Received ipc of len 4
I: Setting level 88
I: Received ipc of len 4
I: Setting level 17
I: Received ipc of len 4
I: Setting level 47
I: Received ipc of len 4
I: Setting level 77
I: Received ipc of len 4
I: Setting level 6
I: Received ipc of len 4
I: Setting level 36
I: Received ipc of len 4
I: Setting level 66
I: Received ipc of len 4
I: Setting level 96
I: Received ipc of len 4
I: Setting level 25
I: Received ipc of len 4
I: Setting level 55
I: Received ipc of len E:
E:  mcause:

This was tested on NCS v3.0.1.

Best Regards,
Fridtjof

minimal_sample.zip

Related