Merge pull request #2949 from NXPmicro/Fix_For_Cortex_M4

The HAL CM4 for ARM and IAR toolchains is valid only for FPU present.…
pull/2967/head
Sam Grove 2016-10-07 11:15:22 -05:00 committed by GitHub
commit f2b49b860d
2 changed files with 28 additions and 0 deletions

View File

@ -164,7 +164,9 @@ SVC_Handler_Veneer
SVC_ContextSave
TST LR,#0x10 ; is it extended frame?
#if (__FPU_PRESENT == 1)
VSTMDBEQ R12!,{S16-S31} ; yes, stack also VFP hi-regs
#endif
MOVEQ R0,#0x01 ; os_tsk->stack_frame val
MOVNE R0,#0x00
STRB R0,[R1,#TCB_STACKF] ; os_tsk.run->stack_frame = val
@ -184,7 +186,9 @@ SVC_ContextRestore
CMP R0,#0 ; Basic/Extended Stack Frame
MVNEQ LR,#:NOT:0xFFFFFFFD ; set EXC_RETURN value
MVNNE LR,#:NOT:0xFFFFFFED
#if (__FPU_PRESENT == 1)
VLDMIANE R12!,{S16-S31} ; restore VFP hi-registers
#endif
MSR PSP,R12 ; Write PSP
SVC_Exit
@ -247,7 +251,9 @@ Sys_Switch
MRS R12,PSP ; Read PSP
TST LR,#0x10 ; is it extended frame?
#if (__FPU_PRESENT == 1)
VSTMDBEQ R12!,{S16-S31} ; yes, stack also VFP hi-regs
#endif
MOVEQ R0,#0x01 ; os_tsk->stack_frame val
MOVNE R0,#0x00
STRB R0,[R1,#TCB_STACKF] ; os_tsk.run->stack_frame = val
@ -266,7 +272,9 @@ Sys_Switch
CMP R0,#0 ; Basic/Extended Stack Frame
MVNEQ LR,#:NOT:0xFFFFFFFD ; set EXC_RETURN value
MVNNE LR,#:NOT:0xFFFFFFED
#if (__FPU_PRESENT == 1)
VLDMIANE R12!,{S16-S31} ; restore VFP hi-regs
#endif
MSR PSP,R12 ; Write PSP
Sys_Exit

View File

@ -188,8 +188,12 @@ SVC_Handler_Veneer:
SVC_ContextSave:
TST LR,#0x10 /* is it extended frame? */
#if (__FPU_PRESENT == 1)
ITTE EQ
VSTMDBEQ R12!,{S16-S31} /* yes, stack also VFP hi-regs */
#else
ITE EQ
#endif
MOVEQ R0,#0x01 /* os_tsk->stack_frame val */
MOVNE R0,#0x00
STRB R0,[R1,#TCB_STACKF] /* os_tsk.run->stack_frame = val */
@ -207,10 +211,16 @@ SVC_ContextRestore:
LDMIA R12!,{R4-R11} /* Restore New Context */
LDRB R0,[R2,#TCB_STACKF] /* Stack Frame */
CMP R0,#0 /* Basic/Extended Stack Frame */
#if (__FPU_PRESENT == 1)
ITEE EQ
#else
ITE EQ
#endif
MVNEQ LR,#~0xFFFFFFFD /* set EXC_RETURN value */
MVNNE LR,#~0xFFFFFFED
#if (__FPU_PRESENT == 1)
VLDMIANE R12!,{S16-S31} /* restore VFP hi-registers */
#endif
MSR PSP,R12 /* Write PSP */
SVC_Exit:
@ -274,8 +284,12 @@ Sys_Switch:
MRS R12,PSP /* Read PSP */
TST LR,#0x10 /* is it extended frame? */
#if (__FPU_PRESENT == 1)
ITTE EQ
VSTMDBEQ R12!,{S16-S31} /* yes, stack also VFP hi-regs */
#else
ITE EQ
#endif
MOVEQ R0,#0x01 /* os_tsk->stack_frame val */
MOVNE R0,#0x00
STRB R0,[R1,#TCB_STACKF] /* os_tsk.run->stack_frame = val */
@ -292,10 +306,16 @@ Sys_Switch:
LDMIA R12!,{R4-R11} /* Restore New Context */
LDRB R0,[R2,#TCB_STACKF] /* Stack Frame */
CMP R0,#0 /* Basic/Extended Stack Frame */
#if (__FPU_PRESENT == 1)
ITEE EQ
#else
ITE EQ
#endif
MVNEQ LR,#~0xFFFFFFFD /* set EXC_RETURN value */
MVNNE LR,#~0xFFFFFFED
#if (__FPU_PRESENT == 1)
VLDMIANE R12!,{S16-S31} /* restore VFP hi-registers */
#endif
MSR PSP,R12 /* Write PSP */
Sys_Exit: