This repository hosts a workspace featuring a single project: rl78-boot. This project includes both the bootloader, which utilizes the Renesas Code Flash Self-Programming Library for RL78, and the application itself. The flashing process is performed via a serial port using the XMODEM protocol to ensure file transfer integrity.
The bootloader project in this repo used the following software and hardware components
- IAR Embedded Workbench for Renesas RL78 (V5.10.3)
- Renesas Code Flash Self-Programming Library for RL78 (T01, Ver.4.00)
- Renesas Applilet3 for RL78 (V1.22.0)
- Tera Term (V5.2)
- 2x mini-B USB cables
- Renesas E1 Emulator (or similar)
- Renesas Promotion Board for RL78 (YRPBRL78G13)
Note
- Newer versions might work with little or no modifications.
- Renesas Applilet3 for RL78 was used for setting up the involved peripherals. The configuration file rl78-boot.cgp is available, for reference.
The Renesas Promotion Board for RL78 conveniently comes with a built-in Serial-to-USB adapter which simplifies the initial setup.
- Make sure the Virtual UART is selected.
| Jumper | Configuration |
|---|---|
J6 |
2-3 |
J7 |
2-3 |
J8 |
2-3 |
J9 |
2-3 |
- Use the E1 Emulator 14-pin flat cable to connect to the board
J5header. - Use one mini-B USB cable to connect the Renesas E1 emulator to a PC USB port.
- Use another mini-B USB cable to connect the
USB1connector to another PC USB port. - Use the Windows Device Manager to find out if the device was properly recognized and, if so, which communications port was assigned to it (e.g.
COMx).
The serial_bootloader workspace contains the rl78-boot project and can be cloned directly (or downloaded):
$ git clone https://github.com/iarsystems/ewrl78-bootloader
- Switch to the Tera Term.
- Open a new serial connection using the COMx.
- Set the serial port parameters to 115200-8-N-1.
To build the project, perform the following steps:
- Install the RL78 FSL library (for IAR compiler version 2.10+):
- Install it in the
<path-to>/ewrl78-bootloader/rl78-boot/FSL. For example:
- In the IAR Embedded Workbench, load the serial_bootloader.eww workspace.
- Build the project (F7).
- Choose Project → Download → Download active application.
- Disconnect the E1 Emulator from the YRPBRL78G13
J5header.
In Tera Term, you should see the application V1 running, with the LED blinking on the board:
- In the project, modify the welcome string from
V1toV2in the main-app.c source file and rebuild the project (F7). - The application can enter into its "bootloader mode". Press
b:
- The application is now in "bootloader mode" from where it is possible to download a new firmware. Press
1:
- Choose File → Transfer → XMODEM → Send..., navigate to the file
Debug\Exe\boot+app.binand click Send:
Congratulations! The bootloader updated the application:
The memory layout was defined for the R5F100LE device:
| Region | Start | End | Description |
|---|---|---|---|
BOOT0_ROM |
0x00000 |
0x00FFF |
The bootloader region |
BOOT1_ROM |
0x01000 |
0x01FFF |
The bootloader update slot |
APPLICATION |
0x02000 |
0x0FFFF |
The main application |
Note
- The linker configuration file (
boot_lnkr5f100le.icf) serves as an example for other RL78 compatible parts. - The
BOOT1_ROMregion is unmapped, solely used as temporary storage space for a new bootloader(, interrupt vectors, etc.).
The following command is performed during the post-build stage (Project → Options → Build Actions):
ielftool --bin-multi="0x00000-0x00FFF;0x02000-0x0FFFF" "$TARGET_PATH$" "$EXE_DIR$\binfile" & copy /b/v "$EXE_DIR$\binfile-0x0"+"$EXE_DIR$\binfile-0x2000" "$EXE_DIR$\boot+app.bin"
This build action will:
- Use the
IAR ELF Toolto generate 2 binary files: one forBOOT0_ROMand another one forAPPLICATION. - Use the
copy /bcommand to concatenate the generated binary files into a singleboot+app.binbinary file.
For technical support contact IAR Customer Support.
For questions or suggestions related to this repository: try the wiki or check earlier issues. If those don't help, create a new issue with detailed information.