Is there a way to persist an application reset reset through esp_restart?

Neil.Macmullen
Posts: 11
Joined: Sun Mar 10, 2019 12:48 pm

Is there a way to persist an application reset reset through esp_restart?

Postby Neil.Macmullen » Wed Oct 30, 2019 11:56 am

My application is deeply embedded and so I have a 'fault' mechanism that performs esp_restart if unusual conditions are detected. I would like to persist the reason for the fault (e.g. "too many connection attempts") through the restart so that it can be written to the flash filing system then uploaded on a future connection attempt. The reason not to write it to the FFS immediately is that some of the potentials faults themselves indicate potential problems with the file structure.

I've tried storing the fault code in the RTC RAM but it appears that esp_restart clears this area although fortunately it leaves the time untouched.

Is there any way to pass a value through esp_restart which can then be read back? I've considered writing to NVRAM but that's still a little heavyweight. It's _probably_ safe but I really don't want to rely on the state of the device at the point of the fault to be sufficient to do much more than write to a RAM/register location and then restart.

Any ideas? Thanks in advance.


Neil.Macmullen
Posts: 11
Joined: Sun Mar 10, 2019 12:48 pm

Re: Is there a way to persist an application reset reset through esp_restart?

Postby Neil.Macmullen » Thu Oct 31, 2019 1:10 pm

Perfect, RTC_NOINIT_ATTR is exactly what I was looking for - thanks! :D

Who is online

Users browsing this forum: dkovar and 143 guests