GNU MCU Eclipse

A family of Eclipse CDT extensions and tools for GNU ARM & RISC-V development

How to build the RISC-V Embedded GCC binaries?

The latest version of the build script is a single run, multi-platform build, generating the Windows 32, Windows 64, GNU/Linux 32, GNU/Linux 64 and macOS distribution packages at once.

The script was developed on macOS, but it should also run on any recent GNU/Linux distribution (just that in this case it cannot generate the macOS package).


The prerequisites are common to all binary builds. Please follow the instructions in the separate Prerequisites for building binaries page and return when ready.

Download the build scripts repo

The build script is available from GitHub and can be viewed online.

To download it, clone the gnu-mcu-eclipse/riscv-none-gcc-build Git repo, including submodules.

$ rm -rf ~/Downloads/riscv-none-gcc-build.git
$ git clone --recurse-submodules \

Check the script

The script creates a temporary build Work/riscv-none-gcc folder in the user home. Although not recommended, if for any reasons you need to change this, you can redefine WORK_FOLDER_PATH variable before invoking the script.

Preload the Docker images

Docker does not require to explicitly download new images, but does this automatically at first use.

However, since the images used for this build are relatively large, it is recommended to load them explicitly before starting the build:

$ bash ~/Downloads/riscv-none-gcc-build.git/scripts/ preload-images

The result should look similar to:

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ilegeul/centos32    6-xbb-v1            f695dd6cb46e        2 weeks ago         2.92GB
ilegeul/centos      6-xbb-v1            294dd5ee82f3        2 weeks ago         3.09GB
hello-world         latest              f2a91732366c        2 months ago        1.85kB


Update git repos

The GNU MCU Eclipse RISC-V GCC is following closely the official RISC-V releases.

The procedure is to first merge the remote branches to the local branches.

Currently, the following branches are used

  • riscv-gcc-7.2.0
  • riscv-newlib-2.5.0
  • riscv-binutils-2.29

The GNU MCU Eclipse branches have similar names, but suffixed with -gme.

After merging the remote branches, merge the result into the -gme branch.

Prepare release

By default, the build script uses tagged commits and downloads the corresponding archives.

While preparing the release it is important to be able to use live Git versions. For this,

  • update the commit ids to the desired ones
  • commit and push
  • start the build script and pass --use-gits
$ bash ~/Downloads/riscv-none-gcc-build.git/scripts/ --use-gits

When the result is acceptable, commit all repos and tag all with the same tag (like v7.2.0-1-20171109):

Update the script

In the gnu-mcu-eclipse/riscv-none-gcc-build, update the scripts/ to refer to the latest version number (RELEASE_VERSION), but without the initial v.

For major releases, Check if the library sources (gmp, mpfr, mpc, isl) did change and possibly update them.

In the riscv-none-gcc-build project, update RELEASE_VERSION

Update gnu-mcu-eclipse/info files:

  • CHANGES.txt (add release)
  • (update references to commits)
  • commit and push (without push, the inner clone uses an older version)

Build all distribution files

Before starting a multi-platform build, check if Docker is started.

$ bash ~/Downloads/riscv-none-gcc-build.git/scripts/ --all

On macOS, to prevent entering sleep, use:

$ caffeinate bash ~/Downloads/riscv-none-gcc-build.git/scripts/ --all

Many, many hours later, the output of the build script is a set of 5 files and their SHA signatures in the deploy folder:

$ ls -l deploy
total 784400
-rw-r--r--  1 ilg  staff  75726500 Jul  5 14:44 gnu-mcu-eclipse-riscv-none-gcc-7.1.1-2-20170705-1143-osx.tgz
-rw-r--r--  1 ilg  staff       127 Jul  5 14:44 gnu-mcu-eclipse-riscv-none-gcc-7.1.1-2-20170705-1143-osx.tgz.sha
-rw-r--r--  1 ilg  staff  52436506 Jul  5 21:39 gnu-mcu-eclipse-riscv-none-gcc-7.1.1-2-20170705-1528-centos64.tgz
-rw-r--r--  1 ilg  staff       132 Jul  5 21:39 gnu-mcu-eclipse-riscv-none-gcc-7.1.1-2-20170705-1528-centos64.tgz.sha
-rw-r--r--  1 ilg  staff  53128553 Jul  6 01:23
-rw-r--r--  1 ilg  staff       129 Jul  6 01:23
-rw-r--r--  1 ilg  staff  51726488 Jul  7 04:52 gnu-mcu-eclipse-riscv-none-gcc-7.1.1-2-20170706-2356-centos32.tgz
-rw-r--r--  1 ilg  staff       132 Jul  7 04:52 gnu-mcu-eclipse-riscv-none-gcc-7.1.1-2-20170706-2356-centos32.tgz.sha
-rw-r--r--  1 ilg  staff  43378400 Jul  7 06:44
-rw-r--r--  1 ilg  staff       129 Jul  7 06:44

Subsequent runs

Separate platform specific builds

Instead of --all, you can use any combination of:

--win32 --win64 --linux32 --linux64 --osx

Please note that, due to the specifics of the GCC build process, the Windows build requires the corresponding Debian build, so --win32 alone is equivalent to --linux32 --win32 and --win64 alone is equivalent to --linux64 --win64.


To remove most build files, use:

$ bash ~/Downloads/riscv-none-gcc-build.git/scripts/ clean

To also remove the repository and the output files, use:

$ bash ~/Downloads/riscv-none-gcc-build.git/scripts/ cleanall

Install hierarchy

The procedure to install GNU MCU Eclipse RISC-V Embedded GCC is platform specific, but relatively straight forward (a .zip archive or setup on Windows, a .tgz archive or install on macOS, a .tgz archive on GNU/Linux). The setup/install asks no special questions, and the defaults are generally ok for most installations.

After install, this package should create structure like this (only the first two depth levels are shown):

$ tree -L 2 /Users/ilg/opt/gnu-mcu-eclipse/riscv-none-gcc/7.1.1-1-20170702-0625/
├── bin
│   ├── riscv-none-embed-addr2line
│   ├── riscv-none-embed-ar
│   ├── riscv-none-embed-as
│   ├── riscv-none-embed-c++
│   ├── riscv-none-embed-c++filt
│   ├── riscv-none-embed-cpp
│   ├── riscv-none-embed-elfedit
│   ├── riscv-none-embed-g++
│   ├── riscv-none-embed-gcc
│   ├── riscv-none-embed-gcc-7.1.1
│   ├── riscv-none-embed-gcc-ar
│   ├── riscv-none-embed-gcc-nm
│   ├── riscv-none-embed-gcc-ranlib
│   ├── riscv-none-embed-gcov
│   ├── riscv-none-embed-gcov-dump
│   ├── riscv-none-embed-gcov-tool
│   ├── riscv-none-embed-gdb
│   ├── riscv-none-embed-gprof
│   ├── riscv-none-embed-ld
│   ├── riscv-none-embed-ld.bfd
│   ├── riscv-none-embed-nm
│   ├── riscv-none-embed-objcopy
│   ├── riscv-none-embed-objdump
│   ├── riscv-none-embed-ranlib
│   ├── riscv-none-embed-readelf
│   ├── riscv-none-embed-run
│   ├── riscv-none-embed-size
│   ├── riscv-none-embed-strings
│   └── riscv-none-embed-strip
├── gnu-mcu-eclipse
│   ├──
│   ├── CHANGES.txt
│   ├── binutils-configure-output.txt
│   ├──
│   ├──
│   ├── gcc-configure-output.txt
│   └── newlib-configure-output.txt
├── include
│   └── gdb
├── lib
│   ├── gcc
│   ├──
│   ├──
│   ├──
│   └── libriscv-none-embed-sim.a
├── libexec
│   └── gcc
├── licenses
│   ├── binutils-gdb
│   ├── gcc
│   ├── gmp-6.1.0
│   ├── isl-0.16.1
│   ├── mpc-1.0.3
│   ├── mpfr-3.1.4
│   └── newlib
├── riscv-none-embed
│   ├── bin
│   ├── include
│   └── lib
└── share
    ├── doc
    ├── gcc-7.1.1
    └── gdb

24 directories, 41 files

No other files are installed in any system folders or other locations.


The binaries are distributed as portable archives, that do not need to run a setup and do not require an uninstall.


A simple test is performed by the script at the end, by launching the executable to check if all shared/dynamic libraries are correctly used.

For a true test you need to first install the package and then run the program form the final location. For example on macOS the output should look like:

$ ${HOME}/opt/gnu-mcu-eclipse/riscv-none-gcc/7.1.1-1-20170702-0625/bin/riscv-none-embed-gcc --version
riscv-none-embed-gcc (GNU MCU Eclipse RISC-V Embedded GCC, 64-bit) 7.1.1 20170509

More build details

The script is quite complex, and an attempt to explain its functionality would require some effort. For the final authoritative details, please refer to the comments available in the script.