24 DBGOUT(
"fd_cpu = %p - fd_extra = %p\r\n", fault_data_cpu, fault_data_extra);
25 DBGOUT(
"pc: %p\r\n", fault_data_cpu->
pc);
26 DBGOUT(
"sp = %p - lr = %p - r12 = %p -xPSR = %p\r\n", fault_data_cpu + 1, fault_data_cpu->
lr, fault_data_cpu->
r12, fault_data_cpu->
xPSR);
27 DBGOUT(
"r0 = %p - r1 = %p - r2 = %p - r3 = %p\r\n", fault_data_cpu->
r0, fault_data_cpu->
r1, fault_data_cpu->
r2, fault_data_cpu->
r3);
29 DBGOUT(
"r4 = %p - r5 = %p - r6 = %p - r7 = %p\r\n", fault_data_extra->
r4, fault_data_extra->
r5, fault_data_extra->
r6, fault_data_extra->
r7);
30 DBGOUT(
"r8 = %p - r9 = %p - r10 = %p - r11 = %p\r\n", fault_data_extra->
r8, fault_data_extra->
r9, fault_data_extra->
r10, fault_data_extra->
r11);
34 uintptr_t eflags = lr & 15;
35 uint8_t MMFSR =
SCB->CFSR & 0xff;
36 uint8_t BFSR = (
SCB->CFSR >> 8) & 0xff;
37 uint16_t UFSR = (
SCB->CFSR >> 16) & 0xffff;
42 DBGOUT(
"***FAULT***\r\neflags = 0x0%x\r\nPSP = %p\r\nType: ", eflags, __get_PSP());
63 DBGOUT(
"*MMFSR* MMARVALID: %d - MSTKERR: %d - MUNSTKERR: %d - DACCVIOL: %d - IACCVIOL: %d\r\n", MMFSR & 128 ? 1 : 0, MMFSR & 16 ? 1 : 0, MMFSR & 8 ? 1 : 0, MMFSR & 2 ? 1 : 0, MMFSR & 1);
64 DBGOUT(
"*BFSR* BFARVALID: %d - STKERR: %d - UNSTKERR: %d - IMPREISERR: %d - PRECISERR: %d - IBUSERR: %d\r\n", BFSR & 128 ? 1 : 0, BFSR & 16 ? 1 : 0, BFSR & 8 ? 1 : 0, BFSR & 4 ? 1 : 0, BFSR & 2 ? 1 : 0, BFSR & 1);
65 DBGOUT(
"*UFSR* DIVBYZERO: %d - UNALIGNED: %d - NOCP: %d - INVPC: %d - INVSTATE: %d - UNDEFINSTR: %d\r\n", UFSR & 512 ? 1 : 0, UFSR & 256 ? 1 : 0, UFSR & 8 ? 1 : 0, UFSR & 4 ? 1 : 0, UFSR & 2 ? 1 : 0, UFSR & 1);
66 DBGOUT(
"*HFSR* DEBUGEVT: %d - FORCED: %d - VECTBL: %d\r\n",
SCB->HFSR & 0x80000000 ? 1 : 0,
SCB->HFSR & 0x40000000 ? 1 : 0,
SCB->HFSR & 2 ? 1 : 0);
67 DBGOUT(
"*DFSR* EXTERNAL: %d - VCATCH: %d - DWTTRAP: %d - BKPT: %d - HALTED: %d\r\n",
SCB->DFSR & 16 ? 1 : 0,
SCB->DFSR & 8 ? 1 : 0,
SCB->DFSR & 4 ? 1 : 0,
SCB->DFSR & 2 ? 1 : 0,
SCB->DFSR & 1);
68 DBGOUT(
"MMAR = %p - BFAR = %p - AFSR: %d\r\n",
SCB->MMFAR,
SCB->BFAR,
SCB->AFSR);
70 print_fault_data(fault_data_cpu, fault_data_extra);