(七)嵌入式系统异常程序远程定位
扫描二维码
随时随地手机看文章
void hard_fault_lr_pc(U32 *usHardFault)
{
usStack_R14 = usHardFault[5];
usStack_R15 = usHardFault[6];
BKP_WriteBackupRegister(BKP_DR3, usHardFault[5]>>16);
BKP_WriteBackupRegister(BKP_DR4, usHardFault[5]&0xffff);
BKP_WriteBackupRegister(BKP_DR5, usHardFault[6]>>16);
BKP_WriteBackupRegister(BKP_DR6, usHardFault[6]&0xffff);
}
__ASM uint32_t __HardFaultException (void)
{
extern hard_fault_lr_pc
TST LR,#4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
B hard_fault_lr_pc
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
//BKP_WriteBackupRegister(BKP_DR2, HARDFAULT);
__HardFaultException();
while(1)
{
}
}