Skip to content

Commit aaf9b00

Browse files
committed
Code review suggestions
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
1 parent 797d3fe commit aaf9b00

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

portable/GCC/ARM_AARCH64/port.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,15 +468,19 @@ void FreeRTOS_Tick_Handler( void )
468468
}
469469
/*-----------------------------------------------------------*/
470470

471-
void vPortTaskUsesFPU( void )
472-
{
473-
/* A task is registering the fact that it needs an FPU context. Set the
474-
* FPU flag (which is saved as part of the task context). */
475-
ullPortTaskHasFPUContext = pdTRUE;
471+
#if ( configUSE_TASK_FPU_SUPPORT != 2 )
476472

477-
/* Consider initialising the FPSR here - but probably not necessary in
478-
* AArch64. */
479-
}
473+
void vPortTaskUsesFPU( void )
474+
{
475+
/* A task is registering the fact that it needs an FPU context. Set the
476+
* FPU flag (which is saved as part of the task context). */
477+
ullPortTaskHasFPUContext = pdTRUE;
478+
479+
/* Consider initialising the FPSR here - but probably not necessary in
480+
* AArch64. */
481+
}
482+
483+
#endif /* configUSE_TASK_FPU_SUPPORT */
480484
/*-----------------------------------------------------------*/
481485

482486
void vPortClearInterruptMask( UBaseType_t uxNewMaskValue )

portable/GCC/ARM_AARCH64/portmacro.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,18 @@ extern void vPortInstallFreeRTOSVectorTable( void );
135135
* handler for whichever peripheral is used to generate the RTOS tick. */
136136
void FreeRTOS_Tick_Handler( void );
137137

138-
/* Any task that uses the floating point unit MUST call vPortTaskUsesFPU()
139-
* before any floating point instructions are executed. */
140-
void vPortTaskUsesFPU( void );
138+
/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or left undefined) then tasks are
139+
* created without an FPU context and must call vPortTaskUsesFPU() to give
140+
* themselves an FPU context before using any FPU instructions. If
141+
* configUSE_TASK_FPU_SUPPORT is set to 2 then all tasks will have an FPU context
142+
* by default. */
143+
#if ( configUSE_TASK_FPU_SUPPORT != 2 )
144+
void vPortTaskUsesFPU( void );
145+
#else
146+
/* Each task has an FPU context already, so define this function away to
147+
* nothing to prevent it from being called accidentally. */
148+
#define vPortTaskUsesFPU()
149+
#endif
141150
#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU()
142151

143152
#define portLOWEST_INTERRUPT_PRIORITY ( ( ( uint32_t ) configUNIQUE_INTERRUPT_PRIORITIES ) - 1UL )

0 commit comments

Comments
 (0)