有个问题向大家请教一下。我在主循环中调用Reset_Handler,程序启动定时器2可以正常运行,但是我在HardFault_Handler中调用Reset_Handler重启芯片的时候,定时器2没有正常启动。在HardFault的时候有什么特别的地方吗?
调用我自己的Hard_fault程序
HardFault_Handler\
PROC
IMPORT hard_fault_handler_c
TST LR, #4
ITE EQ
MRSEQ R0, MSP
MRSNE R0, PSP
B hard_fault_handler_c
ENDP
处理函数
void hard_fault_handler_c(unsigned int * hardfault_args)
{
static T_CALL_STACK T_stacked;
T_stacked.stacked_r0 = ((unsigned long) hardfault_args[0]);
T_stacked.stacked_r1 = ((unsigned long) hardfault_args[1]);
T_stacked.stacked_r2 = ((unsigned long) hardfault_args[2]);
T_stacked.stacked_r3 = ((unsigned long) hardfault_args[3]);
T_stacked.stacked_r12 = ((unsigned long) hardfault_args[4]);
T_stacked.stacked_lr = ((unsigned long) hardfault_args[5]);
T_stacked.stacked_pc = ((unsigned long) hardfault_args[6]);
T_stacked.stacked_psr = ((unsigned long) hardfault_args[7]);
T_stacked.SHCSR = (*((volatile unsigned long *)(0xE000ED24)));
T_stacked.MFSR = (*((volatile unsigned char *)(0xE000ED28)));
T_stacked.BFSR = (*((volatile unsigned char *)(0xE000ED29)));
T_stacked.UFSR = (*((volatile unsigned short int *)(0xE000ED2A)));
T_stacked.HFSR = (*((volatile unsigned long *)(0xE000ED2C)));
T_stacked.DFSR = (*((volatile unsigned long *)(0xE000ED30)));
T_stacked.MMAR = (*((volatile unsigned long *)(0xE000ED34)));
T_stacked.BFAR = (*((volatile unsigned long *)(0xE000ED38)));
FlashRecord(&T_stacked);
while (1) Reset_Handler();
|