Hi,
We have a XIP application with freeRTOS that runs from flash. The application hangs (core lockup) after about 3 hours of run time and we are unable to attach debugger to know the actual cause of the issue. We kept the debugger attached the whole time and when the system crashed, it kicked us out of debug session. We have hardfault handler and we have tested that with divide by 0 operation, we can hit the hardfault handler in debug session (pause and see that we are stuck in loop inside the hardfault handler).
NOTE: when the system hangs, the power rails are up.
Is there a way to get core dump (see all the registers) and see what is going on? Also, out of curiosity what happens if the instructions read from flash get corrupted while in XIP or if the flash read fails? Does the LPC540xx core refetch the instructions or does it just lock up or hit some other fault handler?
Some of the things I may have assumed about LPC540xx may be incorrect so sorry in advance. I would love to understand this in a bit more depth. Any guidance is appreciated.
I think here are two practical steps to investigate further:
Enable Logging: Add logging to critical points in your code (e.g., task switches, exceptions, etc.). If possible, use an external serial logger or a SEGGER RTT logger to capture logs even if the system hangs.
Use a Dedicated HardFault Logger: Store the hard fault context (register values, stack trace) into a non-volatile memory region if possible. After a reset, you can read these logs to understand the state prior to the crash.
BR
Harry