I would like to have devices that reboot unexpectedly, report that panic reason/data over the network after the reboot has settled and network connectivity has been established. I only need the text of what is printed by the standard panic handler -- not a full coredump, although I realize that is also possible. Perhaps a ringbuffer of recent UART logs, could also be good, and might include the panic text anyway.
So is there some means to store some data that will persist across soft reboots [in fact, I would prefer NOT flash, or encrypted-only flash -- it might contain sensitive data], and which can be reliably written even during a panic handler? Ideally something in esp-idf which is already hooked up to the panic data and/or UART logs.
How to access panic reason/stacktrace on next boot?
Re: How to access panic reason/stacktrace on next boot?
Not something that is supported out of the box, but you can probably use -Wl,-wrap to wrap around the panic handler functions. In your wrapper, install UART print function which will write to a statically allocated buffer in RTC memory. On next reboot, read the contents of that buffer. The buffer needs to be declared with RTC_NOINIT attribute so that it doesn't get zeroed out by startup code.
Re: How to access panic reason/stacktrace on next boot?
Ah, great! RTC_NOINIT + RTC memory, is what I was looking for, at least to store some state between soft reboots.
I've thought about this a bit more, and I am coming around to using the base64 encoded coredump in a separate partition, and sending this over the network after a reboot. At some point when I switch to release builds, I think this would be the only sane way to debug. I assume the helpful stacktrace is only useful with debug info, anyway. Does that sound about right?
Separate/related question, can the coredumps be stored encrypted in flash?
I've thought about this a bit more, and I am coming around to using the base64 encoded coredump in a separate partition, and sending this over the network after a reboot. At some point when I switch to release builds, I think this would be the only sane way to debug. I assume the helpful stacktrace is only useful with debug info, anyway. Does that sound about right?
Separate/related question, can the coredumps be stored encrypted in flash?
Who is online
Users browsing this forum: pacucha42 and 138 guests