Difference between revisions of "Using embOS with Renesas RA family, Flexible Software Package (FSP) and IAR"

From SEGGER Wiki
Jump to: navigation, search
 
(10 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
With the resulting project you can still use the Renesas Smart Configurator.
 
With the resulting project you can still use the Renesas Smart Configurator.
 
The following description uses Renesas FSP 3.1 and Renesas Smart Configurator 2021-04.
 
The following description uses Renesas FSP 3.1 and Renesas Smart Configurator 2021-04.
  +
Please be aware with later Renesas FSP and embOS versions some steps might be different (especially the changes in the FSP files).
  +
In case of doubt please contact the [https://www.segger.com/doc/UM01001_embOS.html#Support SEGGER embOS support].
   
[[File:RA Smart Configurator version.png]]
+
[[File:RA_SmartConfigurator_version.png]]
   
 
==Generate the Renesas FSP project==
 
==Generate the Renesas FSP project==
 
Start the Renesas Smart Configurator and create a new IAR EWARM project with the following options.
 
Start the Renesas Smart Configurator and create a new IAR EWARM project with the following options.
 
Project name and location are up to you.
 
Project name and location are up to you.
This Wiki article assumes the project is created within an [https://www.segger.com/downloads/embos/ embOS shipment] in ''c:\Work\embOS_CortexM_IAR_V8_Free_V5.14.0.0\Start\BoardSupport\Renesas\R7FA4M2AD_EK_RA4M2\''.
+
This Wiki article assumes the project is created within an [https://www.segger.com/downloads/embos/embOS_CortexM_IAR_Trial embOS shipment] in ''c:\Work\embOS_CortexM_IAR_V8_Free_V5.14.0.0\Start\BoardSupport\Renesas\R7FA4M2AD_EK_RA4M2\''.
   
 
[[File:RA_SmartConfigurator_Project.png]]
 
[[File:RA_SmartConfigurator_Project.png]]
Line 21: Line 23:
 
[[File:RA_SmartConfigurator_NoRTOS.png]]
 
[[File:RA_SmartConfigurator_NoRTOS.png]]
   
[[File:RA_SmartConfigurator_Bare Metal.png]]
+
[[File:RA_SmartConfigurator_BareMetal.png]]
   
==Open the project in IAR EWARM==
+
==Add embOS to the IAR project==
  +
Your newly created project should now look similar to this one:
   
 
[[File:IAR_open.png]]
 
[[File:IAR_open.png]]
   
  +
You can also open and use an already existing project that you have created.
==Add an embOS application and exclude main.c==
 
  +
  +
===Add an embOS application and exclude main.c===
   
 
[[File:IAR_application.png]]
 
[[File:IAR_application.png]]
   
==Add an embOS library and BSP files==
+
===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 an other embOS BSP within that shipment.
 
Add all files from the embOS BSP folder ''SEGGER'' and ''Setup'' and one embOS library. You can take these two folders from an other embOS BSP within that shipment.
 
BSP.c might need to be updated according to your hardware.
 
BSP.c might need to be updated according to your hardware.
   
[[File:IAR_BSPLib.png]]
+
[[File:IAR_BSP_Lib.png]]
   
==Add Include paths and define==
+
===Add Include paths and define===
 
* Add the include paths ''$PROJ_DIR$/../../../Inc'' and ''$PROJ_DIR$/SEGGER''.
 
* Add the include paths ''$PROJ_DIR$/../../../Inc'' and ''$PROJ_DIR$/SEGGER''.
 
* Add the define ''OS_LIBMODE_DP''.
 
* Add the define ''OS_LIBMODE_DP''.
Line 43: Line 48:
 
[[File:IAR_Preprocessor.png]]
 
[[File:IAR_Preprocessor.png]]
   
==Update Renesas FSP files regarding stack symbol==
+
===Update Renesas FSP files regarding stack symbol===
 
The Renesas FSP files use the stack symbol ''.stack''.
 
The Renesas FSP files use the stack symbol ''.stack''.
 
embOS instead uses the stack symbol ''CSTACK''.
 
embOS instead uses the stack symbol ''CSTACK''.
 
Therefore all occurrences of ''.stack'' needs to be replaced with ''CSTACK''.
 
Therefore all occurrences of ''.stack'' needs to be replaced with ''CSTACK''.
  +
embOS expects the vector table region ".intvec". All occurrences of ".fixed_vectors" in fsp.icf needs to be replaced with with ".intvec".
   
 
* fsp.icf
 
* fsp.icf
Line 53: Line 59:
   
 
rw section CSTACK,
 
rw section CSTACK,
  +
</source>
  +
  +
<source lang="C">
  +
place at start of VECT_region { ro section .intvec* };
  +
  +
place at start of FLASH_region { ro section .intvec* };
 
</source>
 
</source>
   
Line 58: Line 70:
 
<source lang="C">
 
<source lang="C">
 
#define BSP_SECTION_STACK BSP_UNINIT_SECTION_PREFIX "CSTACK"
 
#define BSP_SECTION_STACK BSP_UNINIT_SECTION_PREFIX "CSTACK"
  +
  +
#define BSP_SECTION_FIXED_VECTORS ".intvec"
 
</source>
 
</source>
   
Line 68: Line 82:
 
</source>
 
</source>
   
==Build the project==
+
===Build the project===
 
You should now be able to successfully build the project:
 
You should now be able to successfully build the project:
   

Latest revision as of 10:09, 7 November 2022

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 IAR to an existing Renesas FSP project. With the resulting project you can still use the Renesas Smart Configurator. The following description uses Renesas FSP 3.1 and Renesas Smart Configurator 2021-04. Please be aware with later Renesas FSP and embOS versions some steps might be different (especially the changes in the FSP files). In case of doubt please contact the SEGGER embOS support.

RA SmartConfigurator version.png

Generate the Renesas FSP project

Start the Renesas Smart Configurator and create a new IAR EWARM 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_IAR_V8_Free_V5.14.0.0\Start\BoardSupport\Renesas\R7FA4M2AD_EK_RA4M2\.

RA SmartConfigurator Project.png

RA SmartConfigurator IAR.png

RA SmartConfigurator Flat.png

RA SmartConfigurator NoRTOS.png

RA SmartConfigurator BareMetal.png

Add embOS to the IAR project

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

IAR open.png

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

Add an embOS application and exclude main.c

IAR application.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 an other embOS BSP within that shipment. BSP.c might need to be updated according to your hardware.

IAR BSP Lib.png

Add Include paths and define

  • Add the include paths $PROJ_DIR$/../../../Inc and $PROJ_DIR$/SEGGER.
  • Add the define OS_LIBMODE_DP.

IAR Preprocessor.png

Update Renesas FSP files regarding stack symbol

The Renesas FSP files use the stack symbol .stack. embOS instead uses the stack symbol CSTACK. Therefore all occurrences of .stack needs to be replaced with CSTACK. embOS expects the vector table region ".intvec". All occurrences of ".fixed_vectors" in fsp.icf needs to be replaced with with ".intvec".

  • fsp.icf
rw section CSTACK };

rw section CSTACK,
place at start of VECT_region  { ro section .intvec* };

place at start of FLASH_region  { ro section .intvec* };
  • bsp_compiler_support.h
#define BSP_SECTION_STACK                  BSP_UNINIT_SECTION_PREFIX "CSTACK"

#define BSP_SECTION_FIXED_VECTORS          ".intvec"
  • system.c
#define BSP_PRV_STACK_LIMIT                          ((uint32_t) __section_begin("CSTACK"))
#define BSP_PRV_STACK_TOP                            ((uint32_t) __section_end("CSTACK"))

#pragma section="CSTACK"

Build the project

You should now be able to successfully build the project:

IAR build.png

Renesas Smart Configurator

If IAR EWARM is configured accordingly you can start the Renesas Smart Configurator directly from within the IDE and generate new FSP files:

IAR 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.