mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-29 10:30:24 +00:00
update libcpu/arm/cortex-m3: restore MSP.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
; * Change Logs:
|
||||
; * Date Author Notes
|
||||
; * 2009-01-17 Bernard first version
|
||||
; * 2013-06-18 aozima add restore MSP feature.
|
||||
; */
|
||||
|
||||
;/**
|
||||
@@ -17,6 +18,7 @@
|
||||
; */
|
||||
;/*@{*/
|
||||
|
||||
SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register
|
||||
NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register
|
||||
NVIC_SYSPRI2 EQU 0xE000ED20 ; system priority register (2)
|
||||
NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest)
|
||||
@@ -158,6 +160,13 @@ rt_hw_context_switch_to PROC
|
||||
LDR r1, =NVIC_PENDSVSET
|
||||
STR r1, [r0]
|
||||
|
||||
; restore MSP
|
||||
LDR r0, =SCB_VTOR
|
||||
LDR r0, [r0]
|
||||
LDR r0, [r0]
|
||||
NOP
|
||||
MSR msp, r0
|
||||
|
||||
; enable interrupts at processor level
|
||||
CPSIE I
|
||||
|
||||
|
||||
Reference in New Issue
Block a user