Renesas RL78/G14 (uGOAL)

Introduction

The Renesas RL78/G14 Fast Prototyping Board is an development board of the manufacterer Renesas. The device is a 16 bit CPU with 48kB of RAM and 512kB of ROM. It is capable as an application controller for the iRJ45/SoM module.

Currently the RL78/G14 is only compatible with uGoal.

Software

Integrated Development Environment

The e2 studio by Renesas is a free Integrated Development Environment which provides several utilities to develope and debug applications for the RL78/G14 Fast Prototyping Board. It is available on the Renesas website.

If you just want to use our applications, you won’t need the IDE.

Building and Flashing

There are two Toolchains available to build applications for the Renesas RL78/G14: the CCRL and the GNURL78 Toolchain. The former one is provided by Renesas and is free for applications up tp 64 kB of linkage size.

For our applications we use the GNURL78 toolchain, which is available here. Once installed and added to path you’ll be able to use our provided build system.

To flash the device we’re using the Renesas Flash Programmer. You can download the Programmer from here.

Getting Started

Preparations

Hardware Requirements

Arduino PMOD Adaptershield

Make sure following settings are set:

  • J13 - Connect “iRJ45” with “Sockel”

  • J8 - Connect “CS_SOURCE” with “PB2”

  • J7 - Connect “RST_SOURCE” with “PD7”

  • Set all DIP-Switches to “OFF”

RL78/G14 Fast Prototyping Board

Per default there are no jumpers to set on this board.

Target System

Connect both boards (see Figure above). Voltage supply is done through the VCC33_Sockel by the RL78/G14.

Please connect both boards with each other, before you connect them per USB to your computer.

EtherCAT Distributed Clocks

The Platform RL78/G14 supports the feature EtherCAT Distributed Clocks (DC). The synchronization signal SYNC0 from the SoM is connected through the Arduino Adaptershield to the RL78/G14. To use the signal SYNC1 a bridge is needed to connect the pins 7 and 4 of the Arduino Adaptershield. Connected as shown in the figure below, both of the SYNC signals cause an interrupt on the RL78/G14.

 

Using delivered build system

Within a example folder “ugoal/projects/ugoal/<example name>/gcc” of the software delivery, build the firmware with following commands:

make PLATFORM=rl78g14

Use following command within the example folder, to flash the application onto the RL78/G14:

make PLATFORM=rl78g14 flash

If you want to clean the build, use following command:

make PLATFORM=rl78g14 clean

Using e2 studio by Renesas

This chapter describes the integration of the source files into a new e2 studio project, to edit, compile and debug the software delivery.

Automatic project generation

From any project folder a project generator can be run to create an e2studio project for the application. The project generator requires a python3 installation. Required dependencies are installed automatically.

If you want to create a e2studio project, run the following command:

For the RL78 platform the template number 1 needs to be chosen.

The generated project should be imported into e2studio using “Import → Existing Projects into Workspace” and be browsing to the project folder:

 

The imported project can be compiled and debugged:

Manually import sources into new project

Install the latest e2 studio with RL78 support, which is downloadable from https://www.renesas.com/us/en/software-tool/e-studio.

  • Open e2 studio and choose “Create a new C/C++ project”.

  • Choose the Template “Renesas RL78” and “GCC for Renesas RL78 C/C++ Executable Project”.

  • Choose a project name and click “Next”

  • Choose the toolchain “GCC for Renesas RL78“, target device “RL78-G14”>”80pin”>”R5F104ML” and “E2 Lite (RL78)” as Hardware Debug Configuration and click finish.

 

  • Click right on the project in the “Project Explorer” and select “Import”.

  • Select “General”>”File System” and click “Next”.

  • Choose the sources of the uGoal software delivery.

 

 

  • Right click on the imported folders in the “Project Explorer” and choose “Properties”.

  • On the property “C/C++ Build”, uncheck “Exclude resource from build” and select “Apply and Close”.

  • Repeat this step for all imported directories.

  • Right click on the root folder (e.g. “02_profinet”) in the “Project Explorer” and choose “Properties”.

  • On the property “C/C++ Build”>”Settings”, choose “Tool Settings”>”Compiler”>”Source” and add the user specified define “-DAPPL_STANDALONE”. Confirm with “OK”.

  • Choose “Tool Settings”>”Compiler”>”Includes” and add all imported directories and subdirectories to add these to the include path. Click “Apply”.

  • Choose “Tool Settings”>”Linker”>”Source” and replace the linker script by the file “${workspace_loc:/${ProjName}/ugoal/plat/rl78g14/vendor/RL78G14.ld”.

  • Choose “Tool Settings”>”Linker”>”Miscellaneous” and check “Use newlib-nano”.

  • Remove the directories “02_profinet/generate” and “02_profinet/src” from the root directory, as uGoal includes all necessary platform driver.

Build and Run application with e2 studio

Click “Build” in the upper left corner of e2 studio, to build the application. The output should look like this:

To debug the application, you’ll have to change the debug configuration.

  • Choose in the Toolbar of e2 studio “Run”>”Debug Configurations”.

  • Choose “Debugger” and “Connection Settings” and change “Power Target From The Emulator” to “No”. Apply the changes.

Debugging

UART

The RL78/G14 Fast Prototyping Board provides multiple UART-interfaces. In the example application the UART0 is used. You can access the UART by the PMOD1 interface by connecting a USB-to-serial adapter to the TxD0 of the RL78/G14 and launching a serial monitor like putty. Choose the following settings:

Speed

115200

Data Bits

8

Stop Bits

1

Parity

None

Flow Control

XON/XOFF

Application

After setting up the serial monitor and starting the application, the output should look like this:

Known Issues

Following you’ll find current limitations regarding the RL78/G14.

  • Some applications will not start if logging is enabled. The reason is a limited memory area of 3,75 kB for read-only variables. Currently all logging-strings are placed in this area which leads to an overflow.

  • The I2C interface will not working, if the compiler optimization is set to “-o2”. We recommend to build the applications optimization disabled.