RL78
Renesas RL78 Microcontroller, C++ framework, Library, Sample
Install / Use
/learn @hirakuni45/RL78README
RL78

RL78 directories, overview, etc.
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
RL78 Project List
|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|
Enable/Disable FatFS LFN
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.
Preparation of RL78 development environment (Windows, MSYS2)
-
On Windows, install the MSYS2 environment beforehand.
-
There are three different MSYS2 environments: msys2, mingw32, and mingw64.
-
Upgrading msys2
pacman -Sy pacman
pacman -Syu
- Reopen the console. (You should see a message telling you to reopen the console.)
pacman -Su
-
The 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
- Install git commands
pacman -S git
Preparation of RL78 development environment (OS-X)
-
For 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
- As you probably know, in OS-X, llvm is initially invoked by gcc calls.
- However, llvm is currently unable to build gcc cross-compilers.
- So, we will install gcc with macports, and we will use the version 5 series.
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++
- You may need to reboot.
- Just to make sure.
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.
- Install texinfo, gmp, mpfr, mpc, diffutils, automake commands, etc.
sudo port install texinfo
sudo port install gmp
sudo port install mpfr
sudo port install libmpc
sudo port install diffutils
sudo port install automake
Preparation of RL78 development environment (Ubuntu)
Since there are multiple Linux environments, I will write about the "Ubuntu 16.04 LTS" environment here.
- Install texinfo, gmp, mpfr, mpc, diffutils, automake commands, etc.
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
Build RL78 development environment
- Use gcc-4.9.4 as the compiler for RL78 (rl78-elf-gcc,g++).
- Download binutils-2.25.1.tar.gz
- Download gcc-4.9.4.tar.gz
- Download newlib-2.2.0.tar.gz
build binutils-2.25.1
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)
- Pass /usr/local/rl78-elf/bin (edit .bash_profile and add the path)
PATH=$PATH:/usr/local/rl78-elf/bin
- Reopen the console.
rl78-elf-as --version
- Run the assembler commands to see if the path is valid.
build C Compiler
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)
build newlib
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)
- Under Linux, the sudo command does not recognize the path to the binutils locally configured, so "make install" fails.
Therefore, the following script should be written and executed.
#!/bin/sh
# file: rl78_install.sh
PATH=${PATH}:/usr/local/rl78-elf/bin
make install
sudo rl78_install.sh
build C++ Compiler
cd
cd gcc-4.9.4
cd rl78_build
../configure --p
