mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-01 03:26:58 +03:00
read the rst reason from the SDK if stored.
add String getResetInfo(void); and struct rst_info * getResetInfoPtr(void);
This commit is contained in:
@ -34,6 +34,8 @@ extern "C" {
|
||||
#define LOOP_TASK_PRIORITY 0
|
||||
#define LOOP_QUEUE_SIZE 1
|
||||
|
||||
struct rst_info resetInfo;
|
||||
|
||||
int atexit(void (*func)()) {
|
||||
return 0;
|
||||
}
|
||||
@ -124,6 +126,15 @@ void user_rf_pre_init() {
|
||||
|
||||
extern "C" {
|
||||
void user_init(void) {
|
||||
uart_div_modify(0, UART_CLK_FREQ / (74480));
|
||||
|
||||
system_rtc_mem_read(0, &resetInfo, sizeof(struct rst_info));
|
||||
if(resetInfo.reason == WDT_RST_FLAG || resetInfo.reason == EXCEPTION_RST_FLAG) {
|
||||
os_printf("Last Reset:\n - flag=%d\n - Fatal exception (%d):\n - epc1=0x%08x,epc2=0x%08x,epc3=0x%08x,excvaddr=0x%08x,depc=0x%08x\n", resetInfo.reason, resetInfo.exccause, resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
|
||||
}
|
||||
struct rst_info info = { 0 };
|
||||
system_rtc_mem_write(0, &info, sizeof(struct rst_info));
|
||||
|
||||
uart_div_modify(0, UART_CLK_FREQ / (115200));
|
||||
|
||||
init();
|
||||
|
Reference in New Issue
Block a user