if (DEVELOPMENT_DEBUG)
{
SetBits16(SYS_CTRL_REG, DEBUGGER_ENABLE, 1);//启用调试器能够重新加载
*(volatile unsigned long *)(STATUS_BASE) = hardfault_args[0];// R0
*(volatile unsigned long *)(STATUS_BASE + 0x04) = hardfault_args[1];// R1
*(volatile unsigned long *)(STATUS_BASE + 0x08) = hardfault_args[2];// R2
*(volatile unsigned long *)(STATUS_BASE + 0x0C) = hardfault_args[3];// R3
*(volatile unsigned long *)(STATUS_BASE + 0x10) = hardfault_args[4];// R12
*(volatile unsigned long *)(STATUS_BASE + 0x14) = hardfault_args[5];// LR
*(volatile unsigned long *)(STATUS_BASE + 0x18) = hardfault_args[6]; // PC
*(volatile unsigned long *)(STATUS_BASE + 0x1C) = hardfault_args[7]; // PSR
*(volatile unsigned long *)(STATUS_BASE + 0x20) = (unsigned long)hardfault_args; // Stack Pointer
*(volatile unsigned long *)(STATUS_BASE + 0x24) = (*((volatile unsigned long *)(0xE000ED28))); // CFSR
*(volatile unsigned long *)(STATUS_BASE + 0x28) = (*((volatile unsigned long *)(0xE000ED2C))); // HFSR
*(volatile unsigned long *)(STATUS_BASE + 0x2C) = (*((volatile unsigned long *)(0xE000ED30))); // DFSR
*(volatile unsigned long *)(STATUS_BASE + 0x30) = (*((volatile unsigned long *)(0xE000ED3C))); // AFSR
*(volatile unsigned long *)(STATUS_BASE + 0x34) = (*((volatile unsigned long *)(0xE000ED34))); // MMAR
*(volatile unsigned long *)(STATUS_BASE + 0x38) = (*((volatile unsigned long *)(0xE000ED38))); // BFAR
if (USE_WDOG)
wdg_freeze(); // Stop WDOG
if ((GetWord16(SYS_STAT_REG) & DBG_IS_UP) == DBG_IS_UP)
__asm("BKPT #0\n"); //挂死在此处
else
while(1);
}
}
这个一般是什么原因啊?硬件的有虚焊还是?软件上能定位这个问题吗,前面的那些寄存器有助于定位问题吗?
谢谢!