mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
panic: dump some instruction memory on IllegalInstruction exception
This commit is contained in:
@@ -167,6 +167,7 @@ static const char *edesc[] = {
|
|||||||
|
|
||||||
static void commonErrorHandler(XtExcFrame *frame);
|
static void commonErrorHandler(XtExcFrame *frame);
|
||||||
static inline void disableAllWdts();
|
static inline void disableAllWdts();
|
||||||
|
static void illegal_instruction_helper(XtExcFrame *frame);
|
||||||
|
|
||||||
//The fact that we've panic'ed probably means the other CPU is now running wild, possibly
|
//The fact that we've panic'ed probably means the other CPU is now running wild, possibly
|
||||||
//messing up the serial output, so we stall it here.
|
//messing up the serial output, so we stall it here.
|
||||||
@@ -332,10 +333,36 @@ void xt_unhandled_exception(XtExcFrame *frame)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
panicPutStr(". Exception was unhandled.\r\n");
|
panicPutStr(". Exception was unhandled.\r\n");
|
||||||
|
if (exccause == 0 /* IllegalInstruction */) {
|
||||||
|
illegal_instruction_helper(frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
commonErrorHandler(frame);
|
commonErrorHandler(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void illegal_instruction_helper(XtExcFrame *frame)
|
||||||
|
{
|
||||||
|
/* Print out memory around the instruction word */
|
||||||
|
uint32_t epc = frame->pc;
|
||||||
|
epc = (epc & ~0x3) - 4;
|
||||||
|
|
||||||
|
/* check that the address was sane */
|
||||||
|
if (epc < SOC_IROM_MASK_LOW || epc >= SOC_IROM_HIGH) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
volatile uint32_t* pepc = (uint32_t*)epc;
|
||||||
|
|
||||||
|
panicPutStr("Memory dump at 0x");
|
||||||
|
panicPutHex(epc);
|
||||||
|
panicPutStr(": ");
|
||||||
|
|
||||||
|
panicPutHex(*pepc);
|
||||||
|
panicPutStr(" ");
|
||||||
|
panicPutHex(*(pepc + 1));
|
||||||
|
panicPutStr(" ");
|
||||||
|
panicPutHex(*(pepc + 2));
|
||||||
|
panicPutStr("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If watchdogs are enabled, the panic handler runs the risk of getting aborted pre-emptively because
|
If watchdogs are enabled, the panic handler runs the risk of getting aborted pre-emptively because
|
||||||
|
@@ -283,6 +283,8 @@
|
|||||||
#define SOC_DROM_HIGH 0x3F800000
|
#define SOC_DROM_HIGH 0x3F800000
|
||||||
#define SOC_IROM_LOW 0x400D0000
|
#define SOC_IROM_LOW 0x400D0000
|
||||||
#define SOC_IROM_HIGH 0x40400000
|
#define SOC_IROM_HIGH 0x40400000
|
||||||
|
#define SOC_IROM_MASK_LOW 0x40000000
|
||||||
|
#define SOC_IROM_MASK_HIGH 0x40070000
|
||||||
#define SOC_IRAM_LOW 0x40080000
|
#define SOC_IRAM_LOW 0x40080000
|
||||||
#define SOC_IRAM_HIGH 0x400A0000
|
#define SOC_IRAM_HIGH 0x400A0000
|
||||||
#define SOC_RTC_IRAM_LOW 0x400C0000
|
#define SOC_RTC_IRAM_LOW 0x400C0000
|
||||||
|
Reference in New Issue
Block a user