Question:
Explain about configUSE_TASK_FPU_SUPPORT setting in FreeRTOSConfig.h when optimization is enabled?
Answer:
Some of the calculation uses vector floating-point (VFP) registers d0-d31, when building a project with high optimization levels (-O3).
To prevent processor register corruption a task must not use any floating point registers unless it has a floating point context. Whether or not RTOS tasks are created with a floating point context by default depends on the compiler in use, and the configUSE_TASK_FPU_SUPPORT setting in FreeRTOSConfig.h.
1. A newly created task will not have a floating point context if:
You are using a FreeRTOS version older than V9.0.0, or
You are using a compiler other than GCC, or
configUSE_TASK_FPU_SUPPORT is set to 1 in FreeRTOSConfig.h, or
configUSE_TASK_FPU_SUPPORT is undefined.
2. A newly created task will already have a floating point context if:
You are using FreeRTOS V9.0.0 or later, and
The GCC compiler is used, and
configUSE_TASK_FPU_SUPPORT is set to 2 in FreeRTOSConfig.h.