Skip to content

Commit 0946627

Browse files
bulislawDeepika
authored andcommitted
CMSIS/RTX: Pre-processor defines used for assembly
CMSIS repo does not support pre-processor defines, hence multiple assembly files are added for secure/non-secure and floating point tools. Mbed OS tools support assembly file pre-processing, but the build system does not support multiple assembly files for each target, hence updating the assembly files. 1. Patch RTX so irq_cm4f.S files work with no FPU targets 2. Patch RTX so irq_armv8mml.S files to work with and without FPU 2. Patch RTX so irq_armv8mml.S and irq_armv8mbl.S files to work with secure and non-secure builds
1 parent bb25e86 commit 0946627

File tree

9 files changed

+43
-15
lines changed

9 files changed

+43
-15
lines changed

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_M23/irq_armv8mbl.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
; */
2525

2626

27-
IF :LNOT::DEF:DOMAIN_NS
28-
DOMAIN_NS EQU 0
29-
ENDIF
27+
#ifndef DOMAIN_NS
28+
DOMAIN_NS EQU 0
29+
#endif
3030

3131
I_T_RUN_OFS EQU 20 ; osRtxInfo.thread.run offset
3232
TCB_SM_OFS EQU 48 ; TCB.stack_mem offset

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.S

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@
2424
; */
2525

2626

27-
IF :LNOT::DEF:DOMAIN_NS
28-
DOMAIN_NS EQU 0
29-
ENDIF
27+
#ifndef DOMAIN_NS
28+
DOMAIN_NS EQU 0
29+
#endif
3030

31-
IF ({FPU}="FPv5-SP") || ({FPU}="FPv5_D16")
31+
#ifdef __ARM_FP
3232
__FPU_USED EQU 1
33-
ELSE
33+
#else
3434
__FPU_USED EQU 0
35-
ENDIF
35+
#endif
36+
3637

3738
I_T_RUN_OFS EQU 20 ; osRtxInfo.thread.run offset
3839
TCB_SM_OFS EQU 48 ; TCB.stack_mem offset

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/irq_cm4f.S

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,22 @@ SVC_Context
7474
CBNZ R1,SVC_ContextSave ; Branch if running thread is not deleted
7575
TST LR,#0x10 ; Check if extended stack frame
7676
BNE SVC_ContextSwitch
77+
#ifdef __FPU_PRESENT
7778
LDR R1,=0xE000EF34 ; FPCCR Address
7879
LDR R0,[R1] ; Load FPCCR
7980
BIC R0,R0,#1 ; Clear LSPACT (Lazy state)
8081
STR R0,[R1] ; Store FPCCR
8182
B SVC_ContextSwitch
83+
#endif
8284

8385
SVC_ContextSave
8486
STMDB R12!,{R4-R11} ; Save R4..R11
87+
#ifdef __FPU_PRESENT
8588
TST LR,#0x10 ; Check if extended stack frame
8689
IT EQ
8790
VSTMDBEQ R12!,{S16-S31} ; Save VFP S16.S31
91+
#endif
92+
8893
STR R12,[R1,#TCB_SP_OFS] ; Store SP
8994
STRB LR, [R1,#TCB_SF_OFS] ; Store stack frame information
9095

@@ -103,9 +108,11 @@ SVC_ContextRestore
103108
LDR R0,[R2,#TCB_SP_OFS] ; Load SP
104109
ORR LR,R1,#0xFFFFFF00 ; Set EXC_RETURN
105110

111+
#ifdef __FPU_PRESENT
106112
TST LR,#0x10 ; Check if extended stack frame
107113
IT EQ
108114
VLDMIAEQ R0!,{S16-S31} ; Restore VFP S16..S31
115+
#endif
109116
LDMIA R0!,{R4-R11} ; Restore R4..R11
110117
MSR PSP,R0 ; Set PSP
111118

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/TARGET_M23/irq_armv8mbl.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
.file "irq_armv8mbl.S"
2828
.syntax unified
2929

30-
.ifndef DOMAIN_NS
30+
#ifndef DOMAIN_NS
3131
.equ DOMAIN_NS, 0
32-
.endif
32+
#endif
3333

3434
.equ I_T_RUN_OFS, 20 // osRtxInfo.thread.run offset
3535
.equ TCB_SM_OFS, 48 // TCB.stack_mem offset

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/TARGET_M33/irq_armv8mml.S

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
.file "irq_armv8mml.S"
2828
.syntax unified
2929

30-
.ifndef DOMAIN_NS
30+
#ifndef DOMAIN_NS
3131
.equ DOMAIN_NS, 0
32-
.endif
32+
#endif
3333

34-
.ifndef __FPU_USED
34+
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
35+
.equ __FPU_USED, 1
36+
#else
3537
.equ __FPU_USED, 0
36-
.endif
38+
#endif
3739

3840
.equ I_T_RUN_OFS, 20 // osRtxInfo.thread.run offset
3941
.equ TCB_SM_OFS, 48 // TCB.stack_mem offset

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/irq_cm4f.S

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,22 @@ SVC_Context:
7474
CBNZ R1,SVC_ContextSave // Branch if running thread is not deleted
7575
TST LR,#0x10 // Check if extended stack frame
7676
BNE SVC_ContextSwitch
77+
#ifdef __FPU_PRESENT
7778
LDR R1,=0xE000EF34 // FPCCR Address
7879
LDR R0,[R1] // Load FPCCR
7980
BIC R0,R0,#1 // Clear LSPACT (Lazy state)
8081
STR R0,[R1] // Store FPCCR
8182
B SVC_ContextSwitch
83+
#endif
8284

8385
SVC_ContextSave:
8486
STMDB R12!,{R4-R11} // Save R4..R11
87+
#ifdef __FPU_PRESENT
8588
TST LR,#0x10 // Check if extended stack frame
8689
IT EQ
8790
VSTMDBEQ R12!,{S16-S31} // Save VFP S16.S31
91+
#endif
92+
8893
STR R12,[R1,#TCB_SP_OFS] // Store SP
8994
STRB LR, [R1,#TCB_SF_OFS] // Store stack frame information
9095

@@ -96,9 +101,11 @@ SVC_ContextRestore:
96101
LDR R0,[R2,#TCB_SP_OFS] // Load SP
97102
ORR LR,R1,#0xFFFFFF00 // Set EXC_RETURN
98103

104+
#ifdef __FPU_PRESENT
99105
TST LR,#0x10 // Check if extended stack frame
100106
IT EQ
101107
VLDMIAEQ R0!,{S16-S31} // Restore VFP S16..S31
108+
#endif
102109
LDMIA R0!,{R4-R11} // Restore R4..R11
103110
MSR PSP,R0 // Set PSP
104111

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/TARGET_M23/irq_armv8mbl_common.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,5 @@ Sys_ContextRestore2
297297

298298
Sys_ContextExit
299299
BX LR ; Exit from handler
300+
301+
END

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/TARGET_M33/irq_armv8mml_common.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,5 @@ Sys_ContextRestore2
270270

271271
Sys_ContextExit
272272
BX LR ; Exit from handler
273+
274+
END

rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/irq_cm4f.S

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,22 @@ SVC_Context
7474
CBNZ R1,SVC_ContextSave ; Branch if running thread is not deleted
7575
TST LR,#0x10 ; Check if extended stack frame
7676
BNE SVC_ContextSwitch
77+
#ifdef __FPU_PRESENT
7778
LDR R1,=0xE000EF34 ; FPCCR Address
7879
LDR R0,[R1] ; Load FPCCR
7980
BIC R0,R0,#1 ; Clear LSPACT (Lazy state)
8081
STR R0,[R1] ; Store FPCCR
8182
B SVC_ContextSwitch
83+
#endif
8284

8385
SVC_ContextSave
8486
STMDB R12!,{R4-R11} ; Save R4..R11
87+
#ifdef __FPU_PRESENT
8588
TST LR,#0x10 ; Check if extended stack frame
8689
IT EQ
8790
VSTMDBEQ R12!,{S16-S31} ; Save VFP S16.S31
91+
#endif
92+
8893
STR R12,[R1,#TCB_SP_OFS] ; Store SP
8994
STRB LR, [R1,#TCB_SF_OFS] ; Store stack frame information
9095

@@ -96,9 +101,11 @@ SVC_ContextRestore
96101
LDR R0,[R2,#TCB_SP_OFS] ; Load SP
97102
ORR LR,R1,#0xFFFFFF00 ; Set EXC_RETURN
98103

104+
#ifdef __FPU_PRESENT
99105
TST LR,#0x10 ; Check if extended stack frame
100106
IT EQ
101107
VLDMIAEQ R0!,{S16-S31} ; Restore VFP S16..S31
108+
#endif
102109
LDMIA R0!,{R4-R11} ; Restore R4..R11
103110
MSR PSP,R0 ; Set PSP
104111

0 commit comments

Comments
 (0)