MCU uptime and last reset reason

Is there a way to determine MCU uptime and in case it was reset the reason for the reset? Either due to klipper code deciding to do a reset or due to hardware watchdog or brownout detection etc.

I have managed to connect to the MCU via the console.py tool and was hoping to find an “uptime” command or similar there. I am using an Ender 7 Mainboard with an STM32 MCU.

In console.py you can issue a get_uptime command. The reason for last reset is not stored.

Also, the console.py tool queries the uptime at startup and implements clock tracking, so you can get the current uptime (in seconds since last reboot) with something like: ECHO { clock / freq }

-Kevin

Thanks a lot. Really great to have such a deug console.