void HardFaultVector(void) { #if 0 && defined __GNUC__ __asm volatile ( " tst lr, #4 \n" " ite eq \n" " mrseq r0, msp \n" " mrsne r0, psp \n" " ldr r1, [r0, #24] \n" " ldr r2, handler2_address_const \n" " bx r2 \n" " handler2_address_const: .word prvGetRegistersFromStack \n" ); #else #endif /* 0 && defined __GNUC__ */ int cfsr = GET_CFSR(); if (cfsr & 0x1) { chDbgPanic3("H IACCVIOL", __FILE__, __LINE__); } else if (cfsr & 0x100) { chDbgPanic3("H IBUSERR", __FILE__, __LINE__); } else if (cfsr & 0x20000) { chDbgPanic3("H INVSTATE", __FILE__, __LINE__); } else { chDbgPanic3("HardFaultVector", __FILE__, __LINE__); } while (TRUE) { } }
void _unhandled_exception(void) { /*lint -restore*/ chDbgPanic3("_unhandled_exception", __FILE__, __LINE__); while (true) { } }
void UsageFaultVector(void) { chDbgPanic3("UsageFaultVector", __FILE__, __LINE__); while (TRUE) ; }
void BusFaultVector(void) { chDbgPanic3("BusFaultVector", __FILE__, __LINE__); while (TRUE) { } }
void DebugMonitorVector(void) { chDbgPanic3("DebugMonitorVector", __FILE__, __LINE__); while (TRUE) ; }
void chDbgStackOverflowPanic(Thread *otp) { strcpy(panicMessage, "stack overflow: "); #ifdef CH_USE_REGISTRY strcat(panicMessage, otp->p_name); #endif chDbgPanic3(panicMessage, __FILE__, __LINE__); }
void fatal3(char *msg, char *file, int line) { strcpy(fatalErrorMessage, msg); #if EFI_CUSTOM_PANIC_METHOD chDbgPanic3(fatalErrorMessage, file, line); #else chDbgPanic(fatalErrorMessage); #endif }
/** * this depends on chcore.h patch +void chDbgStackOverflowPanic(thread_t *otp); + - chSysHalt("stack overflow"); \ + chDbgStackOverflowPanic(otp); \ * */ void chDbgStackOverflowPanic(thread_t *otp) { (void)otp; strcpy(panicMessage, "stack overflow: "); #if defined(CH_USE_REGISTRY) || defined(__DOXYGEN__) int p_name_len = strlen(otp->p_name); if (p_name_len < sizeof(panicMessage) - 2) strcat(panicMessage, otp->p_name); #endif chDbgPanic3(panicMessage, __FILE__, __LINE__); }
void chDbgPanic(const char *msg) { chDbgPanic3(msg, __FILE__, __LINE__); }