IARSystems / ewrl78-linker-config-flashlibs

A collection of ILINK linker configurations that simplifies project setup for flash libraries on IAR Embedded Workbench for Renesas RL78

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ICF Trio

What is the purpose of the ICF Trio Project?

The ICF Trio project was developed for IAR Embedded Workbench for Renesas RL78 version 3.10 or later. It uses a set of 3 files which together will lead to a proper linker configuration for the memory reservation requirements when there are RL78 Flash Libraries in use.

Benefits

  • Provides simplified setup for new projects relying on any of the RL78 Flash Libraries.
  • Reduces the developer's efforts when linker reconfiguration is needed, specially when retargeting or switching to a different RL78 Flash Library.
  • Takes advantage of advanced IAR ILINK Linker capabilities by placing the sections related to the __near constants from the ending of the mirrorable area. This feature can result in greater flexibility thanks to the contiguous flash space left for the user program's sections placement on RL78 devices equipped with smaller Code Flash.
Details (click to unfold)

rl78-linker

Linker Configuration Trio Layout Specification

In this section you will find an overview of how the ICF Trio components fit together.

ICF Trio layout

File Description
trio_lnkR5F1nnXn.icf The first one is user-selectable. The selection is made based on the similarity in the memory map for distinct groups of RL78 targets. Each of these files hold the proper Linker Configuration Override parameters which can be set on the Project options.

The X within the part number means that the linker configuration is offered regardless the target's pin count. For example, trio_lnkR5F100xE.icf should be selected for a R5F100LE target.
common.icf The second is automatically included from the user-selected configuration. This is the heart of the Trio, containing parametrized directives which can be applied to any of the supported RL78 targets.
self_ram.icf The third is automatically included by common.icf to evaluate the RAM reservation symbol used by the linker to reserve the appropriate amount of RAM (for Self-RAM) when using the Trio.

Flash Library Flavors

The Renesas RL78 MCUs require specific set of libraries to enable usage of their Flash Memories.

Renesas Electronics provides the RL78 Flash Libraries in 3 different flavors:

  • The FSL (Flash Self-Programming Library) does program the RL78's Code Flash.
  • The FDL (Flash Data Library) does program the RL78's Data Flash.
  • The EEL (EEPROM Emulation Library) does emulate EEPROM behaviour on the RL78's Data Flash. It provides an extra layer of functionalities on top of its corresponding companion FDL Library Type (T01 or T02 - explained below). It provides transparent Wear Leveling among the provisioned Data Flash blocks which may, in practice, virtually raise the amount of possible rewrites.

Flash Library Types

The RL78 Flash Libraries flavors may be provided as one of the following library types:

  • The T01 (Type01, also known as Full) are the fully fledged Flash Libraries.
  • The T02 (Type02, also known as Tiny) are the balanced ones, providing the main functionalities at expense of less resources when compared with the T01 Libraries.
  • The T04 (Type04, also known as Pico) is the one providing only the bare essential functionalities. This library type offers the lowest resource usage footprint. Usually this is the suitable choice for the scenarios where the chosen RL78 target comes with constrained memory resources.

Self-RAM

Typically for every combination of RL78 MCU and RL78 Flash Library, the programmer would need to refer to the Renesas Electronics' Application Note document r20ut2944 in order to know if the chosen combination will require some specific RAM range to be reserved, therefore the chosen combination can function properly.

Self-RAM refers to the aforementioned RAM area, which must be reserved on some cases, when relying on the RL78 MCU's self-programming capabilities.

In order to tremendously simplify this process, the ICF Trio mostly automates it, by taking advantage of every advanced linker configuration directive available to override the default linker configuration, while following the requirements defined in the aforementioned Application Note.

Note For further information regarding the complete feature set and requirements for for each of these flash libraries, refer to their respective documentation.

How to use the ICF Trio

The following sections are a step-by-step guide on how to create and configure a project that takes advantage of the ICF Trio from scratch.

As reference, the Renesas Promotion Board for RL78/G14 was used as target for the walkthrough. The examples used the most popular flash library combinations.

Regardless, similar steps can be used with other combinations of RL78 targets and related flash libraries.

Pre-requisites

In this walkthrough, the following components already installed or downloaded:

Note The RL78 Flash Library installers wizard will ask you to "select your region". The libraries compatible with the IAR Embedded Workbench for Renesas RL78 v2.10+ (<library-name>.a) are only available for "America/Europe/Middle East/Africa" as of this writing.

RAM reservation symbols

The table below lists the available libraries alongside their respective documentation as well as the project's required linker symbol used for RAM reservation.

RL78 Flash Library Documentation Symbol Reserves Self-RAM for the...
T01-FSL T01-FSL __RESERVE_T01_FSL=1 ...T01-FSL Code Flash Library
T01-FDL T01-FDL __RESERVE_T01_FDL=1 ...T01-FDL Data Flash Library
T01-EEL T01-EEL __RESERVE_T01_EEL=1 ...T01-EEL EEPROM Emulation Library
T02-FDL T02-FDL __RESERVE_T02_FDL=1 ...T02-FDL Tiny Data Flash Library
T02-EEL T02-EEL __RESERVE_T02_EEL=1 ...T02-EEL EEPROM Emulation Library
T04-FDL T04-FDL __RESERVE_T04_FDL=1 ...T04-FDL Pico Flash Lbrary

Creating a base project with Applilet3

Applilet3 and AP4 are GUI-based code generators that can generate startup and peripheral drivers in C for RL78 targets.

  • The IAR Embedded Workbench for Renesas RL78 installs the Renesas Electronics' Applilet3 code generator. Launch the Applilet3 tool.

  • Create a new project named Project Name which targets the board's MCU (PN# R5F104LEAFA), using the IAR Compiler as Build Tool.

New Project

  • On Pin assignment tab, click on Fix settings.

Pins Assignment

  • On the On-Chip debug setting tab, enable the On-chip debug operation setting.

OCD

  • Enable the Low Voltage Detection, selecting any coherent value for VLVD, such as 3.63V. Save the Project. Finally, click on Generate code.

CG LVD

Setup the project in the IAR Embedded Workbench

  • Start the IAR Embedded Workbench for RL78, save the the Workspace (.eww) on the same project folder which was created at the chosen Place. This folder can (and will) be referred by IAR Embedded Workbench through its built-in environment variable $PROJ_DIR$.

Note The $PROJ_DIR$ is an internal argument variable which translates to the directory containing the project file (.ewp). It is oftentimes used to refer to the project's source files, header files and libraries with relative pathnames (e.g., $PROJ_DIR$/<dir>/<file>). The IAR Embedded Workbench offers a selection of other useful built-in argument variables.

  • Choose ProjectCreate New Project... and create an Empty RL78 project. Save it on the project's $PROJ_DIR$ location.

  • Choose ProjectAdd Project Connection... and point to the .ipcf file which has been created by the Applilet3 when the code was generated.

Workspace

  • Clone this repository inside $PROJ_DIR$.

Note Alternatively this repository can be downloaded as a .zip archive via the Code button.

Examples

Select one of the available examples below to continue.

Each example contains further steps for creating a simple program that consists of storing/retrieving persistent data using different combinations of the most popular RL78 Flash Libraries.

Example Creates a program which will...
T04-FDL ...exercise the Data Flash
T01-FSL ...exercise the Code Flash
T02-EEL & T02-FDL ...exercise the Data Flash partitioned into an EEL pool and a FDL pool

Issues

Found an issue or have a suggestion related to this repository? Feel free to use the public issue tracker.

  • Do not forget to take a look at earlier issues.
  • If creating a new issue, please describe it in detail.

Disclaimer

The information in this repository is subject to change without notice and does not represent a commitment on any part of IAR. While the information contained herein is assumed to be accurate, IAR assumes no responsibility for any errors or omissions.

About

A collection of ILINK linker configurations that simplifies project setup for flash libraries on IAR Embedded Workbench for Renesas RL78

License:Other