Using embOS with Renesas RA family, Flexible Software Package (FSP) and e2Studio

From SEGGER Wiki
Jump to: navigation, search

Introduction

The Renesas Flexible Software Package (FSP) is an enhanced software package designed to provide easy-to-use, scalable, high-quality software for embedded system designs using Renesas RA family of Arm Microcontrollers.

This Wiki describes how to add embOS Cortex-M GCC to a Renesas FSP e²studio project. With the resulting project you can still use the Renesas Smart Configurator. The following description uses Renesas FSP v3.1.0 and Renesas Smart Configurator 2021-04.

Generate the Renesas FSP project

Start e²studio and create a new Renesas C/C++ project with the following options. Project name and location are up to you. This Wiki article assumes the project is created within an embOS shipment in c:\Work\embOS_CortexM_GCC_Free_V5.14.0.0\Start\BoardSupport\Renesas\R7FA4M2AD_EK_RA4M2\.

embOS FSP e2s 01 GenerateProject.png

embOS FSP e2s 02 GenerateProject.png

embOS FSP e2s 03 GenerateProject.png

embOS FSP e2s 04 GenerateProject.png

embOS FSP e2s 05 GenerateProject.png

Add embOS to the e²studio project

Your newly created project should now look similar to this one:

embOS FSP e2s 06 AddembOS.png

You can also open and use an already existing project that you have created.

Add an embOS application and exclude main.c

Choose an embOS sample application like the OS_StartLEDBlink.c and add it to the project. Furthermore, make sure there is no other C file containing the main() routine by excluding or deleting the respective file. For new projects, this file is named main.c.

When adding new files or folders within the project directory, e²studio will exclude those from build. Therefore, make sure to include them again via right click -> Resource Configurations -> Exclude from Build....

embOS FSP e2s 07 AddembOS.png

Add an embOS library and BSP files

Add all files from the embOS BSP folder SEGGER and Setup and one embOS library. You can take these two folders from another embOS BSP within that shipment. The BSP.c might need to be updated according to your hardware. The OS_Syscalls.c file is not required, since the FSP project already provides a bsp_sbrk.c with the required routines.

embOS FSP e2s 08 AddembOS.png

embOS FSP e2s 09 AddembOS.png

Add Include paths and definitions

  • Add the include paths /../../../Inc and ${workspace_loc:/${ProjName}/SEGGER.
  • Add the definition OS_LIBMODE_DP.

embOS FSP e2s 10 AddembOS.png

embOS FSP e2s 11 AddembOS.png

Update Renesas FSP files regarding stack symbols

The Renesas FSP files use the stack symbols __StackLimit and __StackTop. embOS instead uses the stack symbols __stack_start__ and __stack_end__. Therefore, add the symbols __stack_start__ and __stack_end__ to the FSP linker description file fsp.ld.

__stack_start__ should have the same value as __StackLimit and __stack_end__ the same value as __StackTop.

The .stack_dummy section of the linker description should look as follows:

fsp.ld

 1     /* Stacks are stored in this section. */
 2     .stack_dummy (NOLOAD):
 3     {
 4         . = ALIGN(8);
 5         __StackLimit = .;
 6         __stack_start__ = __StackLimit;
 7         /* Main stack */
 8         KEEP(*(.stack))
 9         __StackTop = .;
10         __stack_end__ = __StackTop;
11         /* Thread stacks */
12         KEEP(*(.stack*))
13         __StackTopAll = .;
14     } > RAM


Build the project

You should now be able to successfully build the project:

embOS FSP e2s 12 AddembOS.png

Renesas Smart Configurator

If the e²studio project is configured accordingly you can use the Renesas Smart Configurator directly from within the IDE and generate new FSP files.

embOS FSP e2s 13 SmartConfigurator.png

Conclusion

With only a few steps it is possible to create an embOS project for any Renesas RA device and to still be able to use the Renesas Smart Configurator to generate or modify FSP files.