Renesas GCC Toolchains
The gcc-renesas.com webpage has good information on how to build the Renesas RX and RL78 toolchains, but the GCC versions used there are a little outdated. And in addition, some patches are applied.
So instead I tried to build the toolchains from scratch directly from the GNU sources, and also get the benefit of the newer GCC version 7 instead of GCC version 4.
My efforts were successful and I have automated it into a single script. Simply change the TARGET variable to build either RL78 or the RX toolchain. It installs everything into a separate directoy in /opt/ on the filesystem. Take a look:
#!/bin/bash set -e TARGET="rl78-elf" #TARGET="rx-elf" PREFIX="/opt/gcc-${TARGET}/" export PATH="${PREFIX}bin:$PATH" # 1) Prepare build directories: if [ -d build ]; then echo "Old build directory detected, please remove it." exit 1 else mkdir -p build/autoconf mkdir -p build/binutils mkdir -p build/gcc mkdir -p build/gdb mkdir -p build/newlib fi # 2) Get sources: if [ ! -d source ]; then mkdir source cd source wget "https://gnuftp.uib.no/autoconf/autoconf-2.64.tar.bz2" wget "https://gnuftp.uib.no/gcc/gcc-7.3.0/gcc-7.3.0.tar.xz" wget "https://gnuftp.uib.no/gdb/gdb-8.1.tar.xz" wget "https://gnuftp.uib.no/binutils/binutils-2.30.tar.xz" wget "ftp://sourceware.org/pub/newlib/newlib-2.5.0.tar.gz" tar -xvjf autoconf-2.64.tar.bz2 tar -xvJf gcc-7.3.0.tar.xz tar -xvJf gdb-8.1.tar.xz tar -xvJf binutils-2.30.tar.xz tar -xvzf newlib-2.5.0.tar.gz cd .. fi # 3) Build autoconf: cd build/autoconf ../../source/autoconf-2.64/configure --prefix=$PREFIX make sudo make install cd .. # 4) Build binutils: cd binutils ../../source/binutils-2.30/configure --target=$TARGET --prefix=$PREFIX --enable-maintainer-mode --disable-nls --disable-werror make sudo make install cd .. # 5) Get gcc sources: if [ ! -d ../source/gcc-7.3.0/gmp ]; then cd ../source/gcc-7.3.0 ./contrib/download_prerequisites cd ../../build fi # 6) Build gcc (step 1): cd gcc ../../source/gcc-7.3.0/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++ --disable-shared --with-newlib --enable-lto --disable-libstdcxx-pch --disable-nls --disable-werror make all-gcc sudo make install-gcc cd .. # 7) Build newlib: cd newlib ../../source/newlib-2.5.0/configure --target=$TARGET --prefix=$PREFIX --disable-nls make sudo make install cd .. # 8) Build gdb: cd gdb ../../source/gdb-8.1/configure --target=$TARGET --prefix=$PREFIX --disable-nls make sudo make install cd .. # 9) Build gcc (step 2): cd gcc make sudo make install