Skip to content

Commit 1be672d

Browse files
bulislawc1728p9
authored andcommitted
CMSIS/RTX: Patch RTX so irq_cm4f.s files work with no FPU targets
(cherry picked from commit cc2e051)
1 parent 9a87d7b commit 1be672d

File tree

3 files changed

+21
-0
lines changed
  • rtos/TARGET_CORTEX/rtx5/RTX/Source

3 files changed

+21
-0
lines changed

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_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_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)