I encounter spurious resets on my ESP8266 system. Heap problem is my main suspect but nevertheless, I like to monitor the stack usage.
Does anybody know, how I could read the actual stack size and - very important - the highwater mark of the used stack?
Thanks for your input.
It is ok to see, if you had a stack overflow, but normally it’s too late because you would have a crash before you can ask again. I would rather prefer a highwater mark to see the tendency of the stack usage during program run.
But let’s say, the software did not harm anything by writing outside of the stack area, it would be very nice, to have a sticky flag, which informs the application of this stack overflow. As I have seen, the stack check (esp_check_stack_overflow) is called at several locations, for example in ‘malloc’ and ‘free’. There this new boolean return value is lost and just a debug log is performed. If you do not have an interface to see this log, you never know that a stack overflow ever happened!
Is it possible that I adapt this functions by myself (‘esp_pre_init’ and ‘esp_check_stack_overflow’) to get more security?