Sporadic Kernel Panic

Hi,

I am using a modified HTTPS Client demo code [Let's say Version A] and sometimes when trying to debug with Segger Embedded Studio for ARM (Nordic Edition v 5.34a/Jlink 6.94a) [NRF Connect SDK V1.5.1/Windows 10], the code is unable to set breakpoints and ends up with the FIH_PANIC code section of the zephyr/main.c file and does not execute the program. It seems that a bootable images is not found. However, when debugging is not performed, the code executes correctly (as evidenced from my serial output). Interestingly, if I change the code slightly to Version B, the program after flashing to the MCU can be debugged. Then, if I revert the changes back to Version A and re-compile/re-flash, sometimes, the code is able to be debugged (even though previously it wasn't working). 

What is causing this behavior? Of course, since debugging isn't working it is hard to see what's going on. My guess is this may be related to where the bootloader is looking to start executing from and somehow a pointer is getting corrupted.

Thanks

  • Hi,

     

    based on this comment:

    It seems that a bootable images is not found.

    I assume you have a multi-build project with a secure, non-secure, and a bootloader. This means that each time you flash your device, you should ideally flash all three projects (available in the file "merged.hex").

    If you do changes to one of these examples, then enter debug mode directly, you will only update the project you're currently debugging.

    I highly suspect that this is what's happening once in a while on your end, ie. that only one of the three images is being updated.

     

    Kind regards,

    Håkon

  • Hi Hakon,

    I too am having this problem very randomly. My firmware application was working and debugging fine this morning. I removed some debugging logging lines (LOG_INF("...")), rebuilt the project in the same way I have always done

    File > Open nRF Connect SDK Project...

    Build > Build zephyr/merged.hex

    Target > Download zephyr/merged.hex 

    At this point I get the annoying message

    "The project 'zephyr/merged.hex' is out of date and needs to be built. Build the project before debugging? Yes, No" despite the fact I have just done a fresh build. I just ignore the message and click on "No".

    I get "Download successful" in SES (NE v5.60) Output window.

    Verifier has found no errors.

    I then click on the green arrow (Start  Execution)

    Depending on the mood SES is in, a debugging session may or may not start. Most of the time it does. However, this morning it did not and I have just spent the last two hours trying to start a debug session without much success.

    Normally, when a debug session is started, it stops at z_cstart() function in c:\Zypher\v170\zephyr\kernel\init.c. 

    However, sometimes it does not and gets stuck in somewhere in MCUBOOT on the line FIH_PANIC.

    There does not seem to be any sign during the build or download process that suggests something went wrong. Or is there?

    Please help.

    Kind regards

    Mohamed

  • Ah! Finally, I think this startlingly simple statement is the answer.

    I still don't know why the initial stop point seems arbitrary, but at least I can debug again!

Related