From Renesas.info
Revision as of 17:48, 10 December 2021 by Zkmike (talk | contribs) (Increased FAQ Title)
Jump to navigation Jump to search

Using the floating point unit (FPU) in interrupts

Issue :

By default, the Cortex-A9 port does not support the use of the floating point unit in interrupts. If it is necessary to use the floating point unit in interrupts then it will also be necessary to save the entire floating point context to the stack on entry to each (potentially nested) interrupt. From FreeRTOS V9.0.0 the FreeRTOS GCC Cortex-A port can do this automatically for you. By default the RZA FreeRTOS does not enable this for the RZA. Does the RZA support floating point unit (FPU) in interrupts?

Solution :

The reason why configUSE_TASK_FPU_SUPPORT is set to 1, is to save stack memory.

You can set configUSE_TASK_FPU_SUPPORT to 2.


We recommend keeping configUSE_TASK_FPU_SUPPORT 1, and call portTASK_USES_FLOATING_POINT() function at the beginning of a task that uses the floating-point calculation.

The example of calling portTASK_USES_FLOATING_POINT() is shown in following URL:


Interrupt Handler:

And if there is interrupt handler that uses FPU, the following operation is required at the top and the end of IRQ handler.

/* Save the floating point context, if any. */
        FMRXNE  R1,  FPSCR
        VPUSHNE {D0-D15}
        VPUSHNE {D16-D31}
        PUSHNE  {R1}
/* Restore the floating point context, if any. */
        POPNE   {R0}
        VPOPNE  {D16-D31}
        VPOPNE  {D0-D15}
        VMSRNE  FPSCR, R0