diff --git a/portable/GCC/ARM_CRx_No_GIC/port.c b/portable/GCC/ARM_CRx_No_GIC/port.c index 01cb9fdb6..42356f3b0 100644 --- a/portable/GCC/ARM_CRx_No_GIC/port.c +++ b/portable/GCC/ARM_CRx_No_GIC/port.c @@ -83,10 +83,12 @@ /*-----------------------------------------------------------*/ /* - * Starts the first task executing. This function is necessarily written in + * Starts the first task executing. These functions are necessarily written in * assembly code so is implemented in portASM.s. */ extern void vPortRestoreTaskContext( void ); +extern void vPortInitialiseFPSCR( void ); +extern uint32_t ulReadValueAPSR( void ); /* * Used to catch tasks that attempt to return from their implementing function. @@ -218,7 +220,7 @@ BaseType_t xPortStartScheduler( void ) /* Only continue if the CPU is not in User mode. The CPU must be in a * Privileged mode for the scheduler to start. */ - __asm volatile ( "MRS %0, APSR" : "=r" ( ulAPSR )::"memory" ); + ulAPSR = ulReadValueAPSR(); ulAPSR &= portAPSR_MODE_BITS_MASK; configASSERT( ulAPSR != portAPSR_USER_MODE ); @@ -312,14 +314,11 @@ void FreeRTOS_Tick_Handler( void ) void vPortTaskUsesFPU( void ) { - //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. */ vPortInitialiseFPSCR(); - /*__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 253fb6a60..a212c9590 100644 --- a/portable/GCC/ARM_CRx_No_GIC/portASM.S +++ b/portable/GCC/ARM_CRx_No_GIC/portASM.S @@ -48,6 +48,7 @@ .global FreeRTOS_SVC_Handler .global vPortRestoreTaskContext .global vPortInitialiseFPSCR + .global ulReadValueAPSR .macro portSAVE_CONTEXT @@ -162,6 +163,15 @@ vPortInitialiseFPSCR: FMXR FPSCR, R0 BX LR +/****************************************************************************** + * ulReadValueAPSR is used to read the value of APSR context. + *****************************************************************************/ +.align 4 +.type ulReadValueAPSR, %function +ulReadValueAPSR: + MRS R0, APSR + BX LR + .align 4 .type FreeRTOS_IRQ_Handler, %function FreeRTOS_IRQ_Handler: