Skip to content

Commit ad205d2

Browse files
EvlersRbb666
authored andcommitted
[libcpu][arm][cortex-m33] allows rewrite to interrupt enable/disable api to support independent interrupts management
1 parent c96fc44 commit ad205d2

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

libcpu/arm/cortex-m33/context_gcc.S

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2026, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -10,6 +10,7 @@
1010
* 2013-06-18 aozima add restore MSP feature.
1111
* 2013-06-23 aozima support lazy stack optimized.
1212
* 2018-07-24 aozima enhancement hard fault exception handler.
13+
* 2026-05-19 Evlers allows rewrite to interrupt enable/disable api to support independent interrupts management
1314
*/
1415

1516
/**
@@ -34,6 +35,7 @@
3435
* rt_base_t rt_hw_interrupt_disable();
3536
*/
3637
.global rt_hw_interrupt_disable
38+
.weak rt_hw_interrupt_disable
3739
.type rt_hw_interrupt_disable, %function
3840
rt_hw_interrupt_disable:
3941
MRS r0, PRIMASK
@@ -44,6 +46,7 @@ rt_hw_interrupt_disable:
4446
* void rt_hw_interrupt_enable(rt_base_t level);
4547
*/
4648
.global rt_hw_interrupt_enable
49+
.weak rt_hw_interrupt_enable
4750
.type rt_hw_interrupt_enable, %function
4851
rt_hw_interrupt_enable:
4952
MSR PRIMASK, r0
@@ -258,6 +261,10 @@ rt_hw_context_switch_to:
258261
CPSIE F
259262
CPSIE I
260263

264+
/* clear the BASEPRI register to disable masking priority */
265+
MOV r0, #0x00
266+
MSR BASEPRI, r0
267+
261268
/* ensure PendSV exception taken place before subsequent operation */
262269
DSB
263270
ISB

libcpu/arm/cortex-m33/context_iar.S

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
;/*
2-
; * Copyright (c) 2006-2018, RT-Thread Development Team
2+
; * Copyright (c) 2006-2026, RT-Thread Development Team
33
; *
44
; * SPDX-License-Identifier: Apache-2.0
55
; *
@@ -11,6 +11,7 @@
1111
; * 2013-06-18 aozima add restore MSP feature.
1212
; * 2013-06-23 aozima support lazy stack optimized.
1313
; * 2018-07-24 aozima enhancement hard fault exception handler.
14+
; * 2026-05-19 Evlers allows rewrite to interrupt enable/disable api to support independent interrupts management
1415
; */
1516

1617
;/**
@@ -39,7 +40,7 @@ NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV excep
3940
;/*
4041
; * rt_base_t rt_hw_interrupt_disable();
4142
; */
42-
EXPORT rt_hw_interrupt_disable
43+
PUBWEAK rt_hw_interrupt_disable
4344
rt_hw_interrupt_disable:
4445
MRS r0, PRIMASK
4546
CPSID I
@@ -48,7 +49,7 @@ rt_hw_interrupt_disable:
4849
;/*
4950
; * void rt_hw_interrupt_enable(rt_base_t level);
5051
; */
51-
EXPORT rt_hw_interrupt_enable
52+
PUBWEAK rt_hw_interrupt_enable
5253
rt_hw_interrupt_enable:
5354
MSR PRIMASK, r0
5455
BX LR
@@ -253,6 +254,10 @@ rt_hw_context_switch_to:
253254
CPSIE F
254255
CPSIE I
255256

257+
; clear the BASEPRI register to disable masking priority
258+
MOV r0, #0x00
259+
MSR BASEPRI, r0
260+
256261
; ensure PendSV exception taken place before subsequent operation
257262
DSB
258263
ISB

libcpu/arm/cortex-m33/context_rvds.S

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
;/*
2-
;* Copyright (c) 2006-2018, RT-Thread Development Team
2+
;* Copyright (c) 2006-2026, RT-Thread Development Team
33
;*
44
;* SPDX-License-Identifier: Apache-2.0
55
;*
@@ -10,6 +10,7 @@
1010
; * 2013-06-18 aozima add restore MSP feature.
1111
; * 2013-06-23 aozima support lazy stack optimized.
1212
; * 2018-07-24 aozima enhancement hard fault exception handler.
13+
; * 2026-05-19 Evlers allows rewrite to interrupt enable/disable api to support independent interrupts management
1314
; */
1415

1516
;/**
@@ -39,7 +40,7 @@ NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV excep
3940
; * rt_base_t rt_hw_interrupt_disable();
4041
; */
4142
rt_hw_interrupt_disable PROC
42-
EXPORT rt_hw_interrupt_disable
43+
EXPORT rt_hw_interrupt_disable [WEAK]
4344
MRS r0, PRIMASK
4445
CPSID I
4546
BX LR
@@ -49,7 +50,7 @@ rt_hw_interrupt_disable PROC
4950
; * void rt_hw_interrupt_enable(rt_base_t level);
5051
; */
5152
rt_hw_interrupt_enable PROC
52-
EXPORT rt_hw_interrupt_enable
53+
EXPORT rt_hw_interrupt_enable [WEAK]
5354
MSR PRIMASK, r0
5455
BX LR
5556
ENDP
@@ -254,6 +255,10 @@ rt_hw_context_switch_to PROC
254255
CPSIE F
255256
CPSIE I
256257

258+
; clear the BASEPRI register to disable masking priority
259+
MOV r0, #0x00
260+
MSR BASEPRI, r0
261+
257262
; ensure PendSV exception taken place before subsequent operation
258263
DSB
259264
ISB

0 commit comments

Comments
 (0)