void Hard_Fault_Handler(uint32_t stack[])
{
static char msg[80];
printf("In Hard Fault Handler\n");
sprintf(msg, "SCB->HFSR = 0x%08x\n", SCB->HFSR);
printf(msg);
if ((SCB->HFSR & (1 << 30)) != 0)
{
printf("Forced Hard Fault\n");
sprintf(msg, "SCB->CFSR = 0x%08x\n", SCB->CFSR );
printf(msg);
if((SCB->CFSR & 0xFFFF0000) != 0) {
printUsageErrorMsg(SCB->CFSR);
}
if((SCB->CFSR & 0xFF00) != 0) {
printBusFaultErrorMsg(SCB->CFSR);
}
if((SCB->CFSR & 0xFF) != 0) {
printMemoryManagementErrorMsg(SCB->CFSR);
}
}
stackDump(stack);
__ASM volatile("BKPT #01");
while(1);
}
|