diff options
| author | bernard <[email protected]> | 2017-09-29 10:23:56 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2017-09-29 10:23:56 +0800 |
| commit | cccff34fcac04f34233a33e453f2d0ec255bf231 (patch) | |
| tree | d406036f73296b27f3cb96e77ede98dd7803c61d /libcpu/arm/cortex-m3 | |
| parent | e9a77b513f0a4b37d539a030592a61b08d03602d (diff) | |
| parent | 3691b67e83ab57196dfc62606b1be18db76994a7 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'libcpu/arm/cortex-m3')
| -rw-r--r-- | libcpu/arm/cortex-m3/context_gcc.S | 4 | ||||
| -rw-r--r-- | libcpu/arm/cortex-m3/context_iar.S | 4 | ||||
| -rw-r--r-- | libcpu/arm/cortex-m3/context_rvds.S | 1 | ||||
| -rw-r--r-- | libcpu/arm/cortex-m3/cpuport.c | 11 |
4 files changed, 14 insertions, 6 deletions
diff --git a/libcpu/arm/cortex-m3/context_gcc.S b/libcpu/arm/cortex-m3/context_gcc.S index ca961bbd87..5181cb2712 100644 --- a/libcpu/arm/cortex-m3/context_gcc.S +++ b/libcpu/arm/cortex-m3/context_gcc.S @@ -162,7 +162,9 @@ rt_hw_context_switch_to: NOP MSR msp, r0 - CPSIE I /* enable interrupts at processor level */ + /* enable interrupts at processor level */ + CPSIE F + CPSIE I /* never reach here! */ diff --git a/libcpu/arm/cortex-m3/context_iar.S b/libcpu/arm/cortex-m3/context_iar.S index ad9fa0dd0f..95dee8062d 100644 --- a/libcpu/arm/cortex-m3/context_iar.S +++ b/libcpu/arm/cortex-m3/context_iar.S @@ -161,7 +161,9 @@ rt_hw_context_switch_to: NOP MSR msp, r0 - CPSIE I ; enable interrupts at processor level + ; enable interrupts at processor level + CPSIE F + CPSIE I ; never reach here! diff --git a/libcpu/arm/cortex-m3/context_rvds.S b/libcpu/arm/cortex-m3/context_rvds.S index ebfd5c8da8..a4191203be 100644 --- a/libcpu/arm/cortex-m3/context_rvds.S +++ b/libcpu/arm/cortex-m3/context_rvds.S @@ -168,6 +168,7 @@ rt_hw_context_switch_to PROC MSR msp, r0 ; enable interrupts at processor level + CPSIE F CPSIE I ; never reach here! diff --git a/libcpu/arm/cortex-m3/cpuport.c b/libcpu/arm/cortex-m3/cpuport.c index f938bab800..10989ffc5b 100644 --- a/libcpu/arm/cortex-m3/cpuport.c +++ b/libcpu/arm/cortex-m3/cpuport.c @@ -368,11 +368,12 @@ __asm int __rt_ffs(int value) { CMP r0, #0x00 BEQ exit + RBIT r0, r0 CLZ r0, r0 ADDS r0, r0, #0x01 - exit +exit BX lr } #elif defined(__IAR_SYSTEMS_ICC__) @@ -380,9 +381,11 @@ int __rt_ffs(int value) { if (value == 0) return value; - __ASM("RBIT r0, r0"); - __ASM("CLZ r0, r0"); - __ASM("ADDS r0, r0, #0x01"); + asm("RBIT %0, %1" : "=r"(value) : "r"(value)); + asm("CLZ %0, %1" : "=r"(value) : "r"(value)); + asm("ADDS %0, %1, #0x01" : "=r"(value) : "r"(value)); + + return value; } #elif defined(__GNUC__) int __rt_ffs(int value) |
