aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s
diff options
context:
space:
mode:
Diffstat (limited to 'os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s')
-rw-r--r--os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s61
1 files changed, 31 insertions, 30 deletions
diff --git a/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s b/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s
index 36864a2c9..a8c0d34cf 100644
--- a/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s
+++ b/os/rt/ports/ARMCMx/compilers/GCC/chcoreasm_v6m.s
@@ -44,14 +44,10 @@
.set CONTEXT_OFFSET, 12
.set SCB_ICSR, 0xE000ED04
.set ICSR_PENDSVSET, 0x10000000
+ .set ICSR_NMIPENDSET, 0x80000000
- .syntax unified
- .cpu cortex-m4
-#if CORTEX_USE_FPU
- .fpu fpv4-sp-d16
-#else
- .fpu softvfp
-#endif
+ .cpu cortex-m0
+ .fpu softvfp
.thumb
.text
@@ -62,16 +58,22 @@
.thumb_func
.globl _port_switch
_port_switch:
- push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
-#if CORTEX_USE_FPU
- vpush {s16-s31}
-#endif
- str sp, [r1, #CONTEXT_OFFSET]
- ldr sp, [r0, #CONTEXT_OFFSET]
-#if CORTEX_USE_FPU
- vpop {s16-s31}
-#endif
- pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}
+ push {r4, r5, r6, r7, lr}
+ mov r4, r8
+ mov r5, r9
+ mov r6, r10
+ mov r7, r11
+ push {r4, r5, r6, r7}
+ mov r3, sp
+ str r3, [r1, #CONTEXT_OFFSET]
+ ldr r3, [r0, #CONTEXT_OFFSET]
+ mov sp, r3
+ pop {r4, r5, r6, r7}
+ mov r8, r4
+ mov r9, r5
+ mov r10, r6
+ mov r11, r7
+ pop {r4, r5, r6, r7, pc}
/*--------------------------------------------------------------------------*
* Start a thread by invoking its work function.
@@ -90,12 +92,7 @@ _port_thread_start:
#if CH_DBG_STATISTICS
bl _stats_stop_measure_crit_thd
#endif
-#if !CORTEX_SIMPLIFIED_PRIORITY
- movs r3, #0
- msr BASEPRI, r3
-#else /* CORTEX_SIMPLIFIED_PRIORITY */
cpsie i
-#endif /* CORTEX_SIMPLIFIED_PRIORITY */
mov r0, r5
blx r4
bl chThdExit
@@ -123,17 +120,21 @@ _port_switch_from_isr:
#endif
.globl _port_exit_from_isr
_port_exit_from_isr:
-#if CORTEX_SIMPLIFIED_PRIORITY
- movw r3, #:lower16:SCB_ICSR
- movt r3, #:upper16:SCB_ICSR
- mov r2, ICSR_PENDSVSET
- str r2, [r3, #0]
+ ldr r3, .L2
+ ldr r2, .L3
+#if CORTEX_ALTERNATE_SWITCH
cpsie i
-#else /* !CORTEX_SIMPLIFIED_PRIORITY */
- svc #0
-#endif /* !CORTEX_SIMPLIFIED_PRIORITY */
+#endif
.L1: b .L1
+ .align 2
+.L2: .word SCB_ICSR
+#if CORTEX_ALTERNATE_SWITCH
+.L3: .word ICSR_PENDSVSET
+#else
+.L3: .word ICSR_NMIPENDSET
+#endif
+
#endif /* !defined(__DOXYGEN__) */
/** @} */