summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorlizhirui <[email protected]>2021-05-20 16:23:56 +0800
committerlizhirui <[email protected]>2021-05-20 16:23:56 +0800
commit5d333029924d2b467b3d5da24851132771a473b7 (patch)
tree60dd601e633c7a23b103c5650e20220f0655130e /libcpu
parentfdfdb9001b337092849cf1278beb5bc1ebd0f72b (diff)
Revert "repair hard fault return bug"
This reverts commit e7fc0c89d2367533dcd1b77e46acaeea7bc3f876.
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/arm/cortex-m7/context_rvds.S6
1 files changed, 5 insertions, 1 deletions
diff --git a/libcpu/arm/cortex-m7/context_rvds.S b/libcpu/arm/cortex-m7/context_rvds.S
index 6caed09e38..d051f819c1 100644
--- a/libcpu/arm/cortex-m7/context_rvds.S
+++ b/libcpu/arm/cortex-m7/context_rvds.S
@@ -10,7 +10,6 @@
; * 2013-06-18 aozima add restore MSP feature.
; * 2013-06-23 aozima support lazy stack optimized.
; * 2018-07-24 aozima enhancement hard fault exception handler.
-; * 2021-02-15 lizhirui repair hard fault return bug
; */
;/**
@@ -236,6 +235,11 @@ MemManage_Handler
ENDIF
STMFD r0!, {lr} ; push exec_return register
+ TST lr, #0x04 ; if(!EXC_RETURN[2])
+ ITE EQ
+ MSREQ msp, r0 ; [2]=0 ==> Z=1, update stack pointer to MSP.
+ MSRNE psp, r0 ; [2]=1 ==> Z=0, update stack pointer to PSP.
+
PUSH {lr}
BL rt_hw_hard_fault_exception
POP {lr}