From d37b60563263c8e5aad6d7ffae33f766a120d428 Mon Sep 17 00:00:00 2001 From: kar-rahul-aws Date: Mon, 8 Jul 2024 14:42:46 +0530 Subject: [PATCH] First update of vPortTaskUsesFPU API --- portable/GCC/ARM_CRx_No_GIC/port.c | 7 ++++--- portable/GCC/ARM_CRx_No_GIC/portASM.S | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/portable/GCC/ARM_CRx_No_GIC/port.c b/portable/GCC/ARM_CRx_No_GIC/port.c index 7294fb760..a3fb8e4a9 100644 --- a/portable/GCC/ARM_CRx_No_GIC/port.c +++ b/portable/GCC/ARM_CRx_No_GIC/port.c @@ -312,13 +312,14 @@ void FreeRTOS_Tick_Handler( void ) void vPortTaskUsesFPU( void ) { - uint32_t ulInitialFPSCR = 0; + //uint32_t ulInitialFPSCR = 0; /* A task is registering the fact that it needs an FPU context. Set the * FPU flag (which is saved as part of the task context). */ ulPortTaskHasFPUContext = pdTRUE; /* Initialise the floating point status register. */ - __asm volatile ( "FMXR FPSCR, %0" ::"r" ( ulInitialFPSCR ) : "memory" ); + vSetupFPU(); + /*__asm volatile ( "FMXR FPSCR, %0" ::"r" ( ulInitialFPSCR ) : "memory" );*/ } -/*-----------------------------------------------------------*/ +/*-----------------------------------------------------------*/ \ No newline at end of file diff --git a/portable/GCC/ARM_CRx_No_GIC/portASM.S b/portable/GCC/ARM_CRx_No_GIC/portASM.S index 349a940d9..42fd70939 100644 --- a/portable/GCC/ARM_CRx_No_GIC/portASM.S +++ b/portable/GCC/ARM_CRx_No_GIC/portASM.S @@ -149,6 +149,15 @@ vPortRestoreTaskContext: /* Switch to system mode. */ CPS #SYS_MODE portRESTORE_CONTEXT + +.align 4 +.type vSetupFPU, %function +vSetupFPU: + PUSH { R0 } + MOV R0, #0x0 + FMXR FPSCR, R0 + POP { R0 } + BX LR .align 4 .type FreeRTOS_IRQ_Handler, %function