diff --git a/os_port.c b/os_port.c index 1d09d31..dc634d1 100644 --- a/os_port.c +++ b/os_port.c @@ -243,7 +243,7 @@ void HardFault_Handler_C(ContextStateFrame_t* frame, uint32_t lr_value){ // "thumb instruction interworking" bit set frame->xpsr = (1 << 24); #else - while(1); + while(1){} #endif } diff --git a/os_port_armcc.S b/os_port_armcc.S index f159f77..10ee3e4 100644 --- a/os_port_armcc.S +++ b/os_port_armcc.S @@ -69,6 +69,7 @@ __PendSV_SwitchTo HardFault_Handler PROC EXPORT HardFault_Handler + IMPORT HardFault_Handler_C tst lr, #4 // 检查 EXC_RETURN (LR) 的位 2 ite eq mrseq r0, msp // 如果位 2 是 0,栈帧在 MSP diff --git a/os_port_gnu.S b/os_port_gnu.S index 0f1fc63..9fa99e2 100644 --- a/os_port_gnu.S +++ b/os_port_gnu.S @@ -78,6 +78,7 @@ cpu_clz: .section .text.HardFault_Handler,"ax",%progbits .global HardFault_Handler + .global HardFault_Handler_C .thumb_func HardFault_Handler: tst lr, #4