42#define ERROR_HANDLER __attribute__((interrupt,no_auto_psv))
43#define FAILSAFE_STACK_GUARDSIZE 8
57 __builtin_software_breakpoint();
64 __asm__
volatile (
"reset");
73 static uint8_t failsafe_stack[32];
75 " mov %[pstack], W15\n"
77 : [pstack]
"r"(failsafe_stack)
89 INTCON1bits.ADDRERR = 0;
103 if(INTCON3bits.DOOVR == 1)
105 INTCON3bits.DOOVR = 0;
110 if(INTCON3bits.DAE == 1)
117 if(INTCON3bits.NAE == 1)
123 if(INTCON3bits.APLL == 1)
125 INTCON3bits.APLL = 0;
137 INTCON1bits.OSCFAIL = 0;
144 INTCON1bits.MATHERR = 0;
157 INTCON1bits.STKERR = 0;
void TRAPS_halt_on_error(uint16_t code)
Stores the trap error code and waits forever. This is a weak attribute function. The user can overrid...
static void use_failsafe_stack(void)
void ERROR_HANDLER _MathError(void)
void ERROR_HANDLER _StackError(void)
void ERROR_HANDLER _AddressError(void)
#define FAILSAFE_STACK_GUARDSIZE
void ERROR_HANDLER _SoftTrapError(void)
static uint16_t TRAPS_error_code
void ERROR_HANDLER _HardTrapError(void)
void ERROR_HANDLER _OscillatorFail(void)