
StartBoard
hirakuni45/RL78
Renesas RL78 Microcontroller, C++ framework, Library, Sample

Renesas RL78 Microcontroller, C++ framework, Library, Sample
SerialUSB is an open-source printed circuit board by hirakuni45, from the hirakuni45/RL78 repository on GitHub, published under the BSD-3-Clause licence. It is a 2-layer board of 63.5 × 26.5 mm with 23 parts on 26 nets, routed with 41 tracks and 0 vias.
It is built around the FT231XS-R. Its parts include 8 capacitors, 5 resistors, 3 diodes, 3 connectors and 2 ICs.

This is a program by RL78 and its compiler, rl78-elf-gcc,g++.
***For RL78 development, you can use the integrated development environment provided by Renesas Electronics, but for permanent use, you need to purchase the commercial version or generate your own.
However, you need to purchase the commercial version to use it permanently, or you need to purchase the integrated development environment for RL78 because the generated binaries are limited to 64 Kbytes or less.
Also, since it does not support C++, use gcc.
We also emphasize the convenience of development on multiple platforms, such as Mac OS-X and Linux.
I can also use Open Source Tools for Renesas's development tools, which require registration, but they don't fit my development style.
I don't like IDEs very much. ***
Currently, I mainly provide headers, related libraries, etc. for "R5F100L" (G13 group).
R5F100LCAFB (FLASH: 32K, RAM: 2K, DATA-FLASH: 4K) @250 yen
R5F100LEAFB (FLASH: 64K, RAM: 4K, DATA-FLASH:4K) @290 yen
R5F100LGAFB (FLASH:128K, RAM:12K, DATA-FLASH:8K) @340 yen (conversion board already mounted @420 yen)
R5F100LJAFB (FLASH:256K, RAM:20K, DATA-FLASH:8K) @400 yen
@xxx is reference price for Akizuki Denshi sales
The project consists of Makefile, related headers, and source code, and is composed of dedicated startup routines, linker scripts
It consists of a dedicated startup routine and a linker script.
Therefore, no dedicated boot program or loader is required, and the binaries you create can be executed as is.
This means that you can run your application as is, without the need for a dedicated boot program or loader.
The entire process from the hardware reset to the device and your application running is detailed and easy to understand.
***The most common case is that the compiler has been modified to switch functions dynamically, internally. ***
***You can build a practical environment with only gcc and make without such a step. ***
For device I/O operations, a template class library composed in C++ is used, and dedicated headers and class libraries for various devices are prepared.
We are constantly improving and researching to realize highly functional and flexible operations with minimal implementation.
We are looking for class libraries for unknown devices. (Must be able to provide under MIT license)
E-Mail: hira@rvf-rc45.net
| directory | contents |
|---|---|
| rl78prog | Programming tool to write programs to RL78 flash |
| G13 | G13 group, linker scripts, device definition files |
| common | RL78 shared classes, small class library, utilities |
| chip | control classes for various devices, etc. |
| ff12a | "FatFS 0.12a" framework created by ChaN, and RL78/G13 SPI |
| KiCAD_Lib | Parts library for KiCAD |
| data_flah_lib | GR-Cotton/GR-Kurumi data/flash operation library |
| FIRST_sample | Super simple sample (blinking LED) for RL78/G13 devices |
| SOFT_DELAY_sample | Software timer sample for RL78/G13 devices |
| UART_sample | Serial communication sample for RL78/G13 devices |
| ARITH_sample | RL78/G13 Four arithmetic operations sample (receive and calculate mathematical expression by string) |
| ADC_sample | RL78/G13 internal A/D conversion sample |
| ADC_SWITCH_sample | RL78/G13 series switch (four rows) A/D conversion sample |
| THERMISTOR_sample | RL78/G13 Thermistor temperature display sample (using A/D conversion) |
| TOUCH_sample | RL78/G13 touch switch, sample |
| DATA_FLASH_sample | RL78/G13 Data flash sample (read, write, erase) |
| INTERVAL_TIMER_sample | RL78/G13 internal 12-bit, interval timer samples |
| INTERVAL_TIMER_TAU_sample | RL78/G13 TAU use interval timer sample |
| EEPROM_sample | RL78?G13 EEPROM I2C Read/Write sample |
| DS3231_sample | RL78/G13 DS3231 I2C Real Time Clock time display and setting sample |
| DS1371_sample | RL78/G13 DS1371 I2C Real Time Clock time display, setting sample |
| BMP180_sample | RL78/G13 BMP180 I2C Pressure/Temperature sensor reading and display sample |
| VL53L0X_sample | RL78/G13 VL53L0X I2C Time-of-Flight distance sensor, sample |
| PWM_sample | RL78/G13 TAU use PWM output sample |
| SDC_sample | RL78/G13 SD card operation sample (SD card root directory list) |
| WAV_PLAYER_sample | RL78/G13 WAV file playback sample (8-bit output by PWM modulation, up to 48KHz/16bits) |
| VS1063_PLAYER_sample | RL78/G13 VS1063 Audio Decoder Playback sample |
| LCD_DOT_sample | RL78/G13 ST7565(R)/SSD1306 SPI LCD controller, graphics display sample |
| MAX6675_sample | RL78/G13 MAX6675 SPI K thermocouple, temperature display sample |
| MAX7219_sample | RL78/G13 MAX7219 SPI LED display sample |
The SD card file system "fatfs" uses "LFN" (long file name) as standard and displays UTF-8 is used as standard. (UTF-8 and Shift-JIS conversion tables are available.)
This requires a device of at least 128KB.
This consumes a lot of memory. If you do not need it, set "_USE_LFN" in "ff12a/src/ffconf.h" to "0" and compile it.
If you do not need it, you can compile the file with "_USE_LFN" set to "0" in "ff12a/src/ffconf.h" and the string code will be OEM, (ShiftJIS for CP932), with minimal Long file names are also disabled, and 8.3 format is used.
On Windows, install the MSYS2 environment beforehand.
There are three different MSYS2 environments: msys2, mingw32, and mingw64.
Upgrading msys2
pacman -Sy pacman
pacman -Syu pacman -SuThe update will be performed multiple times, and you must follow the console's instructions.
You will need to reopen the console multiple times.
Install gcc, texinfo, gmp, mpfr, mpc, diffutils, automake, zlib tar, make, unzip commands, etc.
pacman -S gcc
pacman -S texinfo
pacman -S mpc-devel
pacman -S diffutils
pacman -S automake
pacman -S zlib
pacman -S tar
pacman -S make
pacman -S unzip
pacman -S zlib-devel pacman -S gitFor OS-X, install macports beforehand. (Brew is not recommended due to its inflexibility.)
(Depending on the OS-X version, you may need to install X-Code, Command Line Tools, etc. beforehand.)
Upgrading macports
sudo port -d self update sudo port install gcc5
sudo ln -sf /opt/local/bin/gcc-mp-5 /usr/local/bin/gcc
sudo ln -sf /opt/local/bin/g++-mp-5 /usr/local/bin/g++
sudo ln -sf /opt/local/bin/g++-mp-5 /usr/local/bin/c++ gcc --version gcc (MacPorts gcc5 5.4.0_0) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. sudo port install texinfo
sudo port install gmp
sudo port install mpfr
sudo port install libmpc
sudo port install diffutils
sudo port install automakeSince there are multiple Linux environments, I will write about the "Ubuntu 16.04 LTS" environment here.
sudo apt-get install texinfo
sudo apt-get install libgmp-dev
sudo apt-get install libmpfr-dev
sudo apt-get install libmpc-dev
sudo apt-get install diffutils
sudo apt-get install automake
sudo apt-get install zlib1g-dev cd
tar xfvz binutils-2.25.1.tar.gz
cd binutils-2.25.1
mkdir rl78_build
cd rl78_build
... /configure --target=rl78-elf --prefix=/usr/local/rl78-elf --disable-nls --with-system-zlib
make
make install OS-X,Linux: (sudo make install) PATH=$PATH:/usr/local/rl78-elf/bin rl78-elf-as --version cd
tar xfvz gcc-4.9.4.tar.gz
cd gcc-4.9.4
mkdir rl78_build
cd rl78_build
../configure --prefix=/usr/local/rl78-elf --target=rl78-elf --enable-languages=c --disable-libssp --with-newlib --disable-nls --disable-threads --disable-libgomp --disable-libmudflap --disable-libstdcxx-pch --disable-multilib --enable-lto --with-system-zlib
make
make install OS-X,Linux: (sudo make install) cd
tar xfvz newlib-2.2.0.tar.gz
cd newlib-2.2.0
mkdir rl78_build
cd rl78_build
../configure --target=rl78-elf --prefix=/usr/local/rl78-elf
make
make install OS-X: (sudo make install)#!/bin/sh
# file: rl78_install.sh
PATH=${PATH}:/usr/local/rl78-elf/bin
make install sudo rl78_install.sh cd
cd gcc-4.9.4
cd rl78_build
../configure --prefix=/usr/local/rl78-elf --target=rl78-elf --enable-languages=c,c++ --disable-libssp --with-newlib --disable-nls --disable-threads --disable-libgomp --disable-libmudflap --disable-libstdcxx-pch --disable-multilib --enable-lto --with-system-zlib
make
make install OS-X,Linux: (sudo make install)In OS-X and Linux, remove the optimization option "-flto" set in the "Makefile" when building each project.
Remove the optimization option "-flto" from the "Makefile" when building each project.
Otherwise, an executable binary that does not work will be generated.
This does not happen when building with *MSYS2.
Specifically, no information in the section containing unreferenced function addresses, etc., is output.
We are currently investigating a workaround.
We are currently investigating a workaround.
At present, there is little benefit to be gained from "-flto", so for safety reasons, we have decided to build without this option in all environments.
option in all environments to be safe.
git clone https://github.com/hirakuni45/RL78.git sh all_project_build.sh(1) RXD Serial receive
(2) TXD Serial transmit
(3) RTS Hardware control signal
(4) VCC Power supply (5V or 3.3V)
(5) GND Power supply 0V
Since only a limited current can be drawn from 3.3V, it is recommended to use a regulator.
A conversion adapter that can take out the RTS signal is required.
We do not recommend cheap modules made in China because they do not have RTS or their quality is not stable.
Only those who understand and can deal with these issues should use these modules.

cd /c/
tar xfvz boost_1_74_0.tar.gz
cd boost_1_74_0
ls
boost/ boost-build.jam bootstrap.sh* index.html libs/ README.md tools/
boost.css boostcpp.jam doc/ INSTALL LICENSE_1_0.txt rst.css
boost.png bootstrap.bat index.htm Jamroot more/ status/ cd rl78prog
make
make install
Put the path to /usr/local/bin.Edit rl78_prog.conf and set the COM port and baud rate.
Only "115200", "500000", and "1000000" baud rates are supported due to the RL78 specification and termios limitations.
Equivalent to /dev/ttyS10 -> COM11. (+1 to the number)
rl78prog/KiCAD/ contains reference circuits for RL78 programmer (writing machine), etc.
Serial devices confirmed to work
| FT231X | CP2102 | CH340 | |
|---|---|---|---|
| Windows | ○ | ○ | △ |
| OS-X | × | × | △ |
| Linux | x | x | △ |
○:Confirmed operation, △:Unconfirmed, ×:Malfunction
Although the writing software is multi-platform compatible, currently it can only be used in a Windows environment.
The writing software is multi-platform, but currently only works in Windows environment.
RL78 is classified as a 16-bit microcontroller, but strictly speaking, it is not.
Basically, it is no different from an 8-bit microcontroller, and can be said to be an 8-bit microcontroller with a large address space.
When writing C or C++ programs, it is important to note that the pointer is basically 16 bits, and only 64K bytes of space can be accessed.
In special cases, the __far pointer can be used, but it is not efficient.
In special cases, the __far pointer can be used, but it is less efficient and can be used only for special purposes.
In the case of using FatFS, the conversion table between UTF-8 and CP932 can be placed in the latter half of the ROM Flash area, and the _far pointer can be used to access the 64K byte space.
The program counter is extended to 20 bits.
The program counter is extended to 20 bits and operates in a 1M-byte area.
The RAM and I/O areas are assigned to 0xF0000 and after, and access to these areas requires the use of an addressing address whose upper 4 bits are fixed.
The compiler can access a 20-bit area by using an addressing mode in which the upper 4 bits are fixed and a 16-bit access is performed.
The compiler acts as if it is accessing a 20-bit area, but in fact it can only access a 16-bit area.
In reality, only a 16-bit area can be accessed.
For more information, see the explanation of "Mirror Area.
Renesas Electronics has not released the documentation required to write to the internal data flash.
Renesas Electronics does not provide the necessary documentation for writing to the internal data flash, nor does it provide a data flash library for gcc.
Therefore, it is not possible to use the internal data flash in the current situation.
If you want to store some data, you can use EEPROM with I2C connection.
GR-Cotton and GR-Kurumi use RL78/G13, and the WEB compiler is gcc.
The situation has changed since we found out that the RL78/G13 is used in GR-Cotton and GR-Kurumi, and that the data flash library (gcc version of PFDL T4) can be used.
Now, data flash operation can be performed normally.
make make
make run| file name | Spec |
|---|---|
| G13/R5F100LCAFB.ld | Linker script for R5F100LCAFB ( 32K/ 2K/4K) |
| G13/R5F100LEAFB.ld | Linker script for R5F100LEAFB (64K/ 4K/4K) |
| G13/R5F100LGAFB.ld | Linker script for R5F100LGAFB (128K/12K/8K) |
| G13/R5F100LJAFB.ld | Linker script for R5F100LJAFB (256K/20K/8K) |
| G13/readme.txt | Linker script overview |
| G13/adc.hpp | A/D converter definition |
| G13/dma.hpp | DMA controller definition |
| G13/iica.hpp | IICA (I2C) definition |
| G13/intr.hpp | Interrupt control relation definition |
| G13/port.hpp | Port relation definition |
| G13/sau.hpp | Serial Array Unit definition |
| G13/system.hpp | system-related definition |
| G13/tau.hpp | timer array unit definition |
| G13/timer.hpp | 12-bit interval timer definition |
| file name | Spec |
|---|---|
| chip/chip_list.txt | chip list |
| chip/BMP180.hpp | I2C BOSHE BMP180 temperature and pressure sensor driver |
| chip/DS3231.hpp | I2C Maxim DS3231 RTC Real Time Clock Driver |
| chip/DS1371.hpp | I2C Maxim DS1371 RTC real-time clock driver (32-bit binary counter) |
| chip/EEPROM.hpp | I2C connection EEPROM driver |
| chip/MPU6050.hpp | I2C InvenSense Accelerometer, Gyro sensor driver |
| chip/ST7565.hpp | SPI LCD single color, dot matrix driver |
| chip/SSD1306.hpp | SPI OLED single color, dot matrix driver |
| chip/UC1701.hpp | SPI LCD single color, dot matrix driver |
| chip/VS1063.hpp | SPI MP3 / OGG VORBIS encoder, decoder driver |
| chip/NTCTH.hpp | Analog thermistor linear completion template |
| chip/VL53L0X.hpp | I2C Time-of-Flight distance sensor driver |
| chip/MAX6675.hpp | SPI K Thermocouple Temperature Sensor Driver |
| chip/MAX7219.hpp | SPI LED driver |
| file name | Spec |
|---|---|
| common/start.s | hardware reset, initialization |
| common/init.c | main initialization |
| common/option_bytes.hpp | option byte setting |
| common/vect.h | hardware vector definition |
| common/vect.c | hardware vector settings |
| common/time.h | time function definition (reduced version of posix time.h) |
| common/time.c | time function implementation (reduced version of posix time.c) |
| common/io_utils.hpp | I/O control template utilities |
| common/adc_io.hpp | A/D conversion control template |
| common/basic_arith.hpp | Four arithmetic input class |
| common/bitset.hpp | bit-packed simple template class (reduced set of std::bitset) |
| common/command.hpp | line input template |
| common/csi_io.hpp | CSI(SPI) conversion control template |
| common/delay.hpp | software delay (32 MHz operation, in microseconds) |
| common/fifo.hpp | First-in first-out buffer |
| common/filer.hpp | file selection for bitmap graphics |
| common/font6x12.hpp | 6x12 pixel, ASCII font class (definition) |
| common/font6x12.cpp | 6x12 pixel, ASCII font class (entity) |
| common/format.hpp | string formatting template |
| common/iica_io.hpp | IICA input/output template |
| common/itimer.hpp | interval timer control template |
| common/kfont12.bin | 12-pixel Kanji font bitmap data |
| common/kfont12.hpp | 12-pixel Kanji font class |
| common/monograph.hpp | bitmap graphics control class |
| common/port_utils.hpp | port utilities |
| common/sdc_io.hpp | SD card control class |
| common/string_utils.hpp | string utilities (code conversion, etc.) |
| common/switch_man.hpp | switch management classes |
| common/task.hpp | task control (disabled task class) |
| common/tau_io.hpp | Timer control template |
| common/uart_io.hpp | Serial communication input/output (UART) |
Translated with www.DeepL.com/Translator (free version)
License
MIT
| Qty | Value | Footprint | References |
|---|---|---|---|
| 4 | 0.1uF | Capacitors_SMD:C_0603_HandSoldering | C3, C4, C7, C8 |
| 2 | 1.2K | Resistors_SMD:R_0603_HandSoldering | R3, R4 |
| 2 | 27 | Resistors_SMD:R_0603_HandSoldering | R1, R2 |
| 2 | 47pF | Capacitors_SMD:C_0603_HandSoldering | C1, C2 |
| 1 | 22uF | Capacitors_SMD:C_1210_HandSoldering | C6 |
| 1 | 3P-SW | Akizuki:SS-12D01-VG4 | SW1 |
| 1 | 4.7uF | Capacitors_SMD:C_0805_HandSoldering | C5 |
| 1 | 760 | Resistors_SMD:R_0603_HandSoldering | R5 |
| 1 | BLM18PG471SN1D | Resistors_SMD:R_0603_HandSoldering | FB1 |
| 1 | BLUE | LEDs:LED_0603 | D3 |
| 1 | CONN_02X03 | Pin_Headers:Pin_Header_Straight_2x03 | P3 |
| 1 | CONN_02X05 | Pin_Headers:Pin_Header_Straight_2x05 | P2 |
| 1 | FT231XS | SMD_Packages:SSOP-20 | U2 |
| 1 | GREEN | LEDs:LED_0603 | D1 |
| 1 | NJU7223DL1-33 | TO_SOT_Packages_SMD:TO-252-2Lead | U1 |
| 1 | RED | LEDs:LED_0603 | D2 |
| 1 | USB_OTG | Akizuki:HRS-MICRO-USB-B | P1 |

hirakuni45/RL78
Renesas RL78 Microcontroller, C++ framework, Library, Sample

sudomesh/disaster-radio
A (paused) work-in-progress long-range, low-bandwidth wireless disaster recovery mesh network powered by the sun.

shorepine/tulipcc
The Tulip Creative Computer and AMYboard - portable Python synthesizers




vaugerbird/sstv-backpack
A ESP32-CAM SSTV backpack for the Baofeng UV-5R + others!


It measures 63.5 × 26.5 mm and has 2 copper layers, 1.6 mm thick.
23 parts, built around the FT231XS-R. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the hirakuni45/RL78 repository on GitHub, at the commit this page was made from: the board is rl78prog/KiCAD/FTDI231XS/SerialUSB.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the BSD-3-Clause licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).