RZA FreeRTOS

From Renesas.info
Revision as of 00:11, 19 February 2022 by Zkmike (talk | contribs)

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.

Alternative:

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:

https://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html

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

FreeRTOS ( with IOT Libraries )

e2studio 2022-01 and later support FreeRTOS (with IoT Libraries ) for the RZA2M from scratch. Follow the steps below.

Step 1) Create a GNU for Renesas RZ C/C++ Executable Project. Then Create a project name.

This is an example of what the RZA2M Dialog Creation Settings should be.

Step 2) In the next dialog after creating project name the following setting are required.

  • Toolchain version: 6 2017-q2-update ( versions exceeding this are not supported)
  • RTOS: FreeRTOS (with IoT libraries)
  • RTOS Version: v202012.00-rza2m-1.0.0 NOTE if this is not in the drop down you need to click the Manage RTOS Versions. Set the Target Device to a RZA2M be download.
  • Target Device: Set this to RZA2M part number
  • Language: C or C++
    • NOTE: The Renesas drivers are written in C language. To uses these drivers follow the C standard to handle mixed C/C++ API and header usage.

Step 3) Use the default setting of every dialog after.

Step 4) Next open the smart configuration perspective for this project. This would be the ProjectName.scfg file ( i.e. Test.sctg).

Step 5) Click the generate Code in the SC Overview Information Window. This will generate the default drivers.

Step 6) By default a main.c  file is not created. You will need to manually need to create this file and define the main function.

Step 7) Compile