Version 8.3.0-1.2 is a maintenance release of the xPack GNU RISC-V Embedded GCC, that packs the SiFive release from August 2019, and adds support for running on Arm platforms, like Raspberry Pi.

This is the xPack distribution of the SiFive RISC-V GCC.

There are separate binaries for Windows, macOS and GNU/Linux, 32/64-bit.

Starting with this version, support for 32/64-bit Arm GNU/Linux platforms, like Raspberry Pi, was added.

Download

The binary files are available from GitHub Releases.

Install

The full details of installing the xPack GNU RISC-V Embedded GCC on various platforms are presented in the separate Install page.

Easy install

The easiest way to install GNU RISC-V Embedded GCC is with xpm by using the binary xPack, available as @xpack-dev-tools/riscv-none-embed-gcc from the npmjs.com registry.

To install the latest version available, use:

xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest --verbose

To install this specific version, use:

xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@8.3.0-1.2.1

Compliance

Starting with v8.2.0-2, this distribution closely follows the official SiFive Freedom Tools distribution.

This release is based on the v2019.08.0 release, and includes the SiFive extensions (like CLIC interrupts and a an even larger multi-lib set).

The following commits (from sifive/freedom-tools) were used:

GDB was upstreamed and does not require SiFive specific patches, so the current build uses git://sourceware.org/git/binutils-gdb.git, the 9b40759 commit from 28 Feb 2019.

Supported libraries

The supported libraries are:

$ riscv-none-embed-gcc -print-multi-lib
.;
rv32e/ilp32e;@march=rv32e@mabi=ilp32e
rv32ea/ilp32e;@march=rv32ea@mabi=ilp32e
rv32em/ilp32e;@march=rv32em@mabi=ilp32e
rv32eac/ilp32e;@march=rv32eac@mabi=ilp32e
rv32emac/ilp32e;@march=rv32emac@mabi=ilp32e
rv32i/ilp32;@march=rv32i@mabi=ilp32
rv32ia/ilp32;@march=rv32ia@mabi=ilp32
rv32im/ilp32;@march=rv32im@mabi=ilp32
rv32if/ilp32f;@march=rv32if@mabi=ilp32f
rv32ifd/ilp32d;@march=rv32ifd@mabi=ilp32d
rv32iaf/ilp32f;@march=rv32iaf@mabi=ilp32f
rv32iafd/ilp32d;@march=rv32iafd@mabi=ilp32d
rv32imaf/ilp32f;@march=rv32imaf@mabi=ilp32f
rv32imf/ilp32f;@march=rv32imf@mabi=ilp32f
rv32imfd/ilp32d;@march=rv32imfd@mabi=ilp32d
rv32iac/ilp32;@march=rv32iac@mabi=ilp32
rv32imac/ilp32;@march=rv32imac@mabi=ilp32
rv32imafc/ilp32f;@march=rv32imafc@mabi=ilp32f
rv32imafdc/ilp32d;@march=rv32imafdc@mabi=ilp32d
rv64i/lp64;@march=rv64i@mabi=lp64
rv64ia/lp64;@march=rv64ia@mabi=lp64
rv64im/lp64;@march=rv64im@mabi=lp64
rv64if/lp64f;@march=rv64if@mabi=lp64f
rv64ifd/lp64d;@march=rv64ifd@mabi=lp64d
rv64iaf/lp64f;@march=rv64iaf@mabi=lp64f
rv64iafd/lp64d;@march=rv64iafd@mabi=lp64d
rv64imf/lp64f;@march=rv64imf@mabi=lp64f
rv64imaf/lp64f;@march=rv64imaf@mabi=lp64f
rv64iac/lp64;@march=rv64iac@mabi=lp64
rv64imac/lp64;@march=rv64imac@mabi=lp64
rv64imafc/lp64f;@march=rv64imafc@mabi=lp64f
rv64imafdc/lp64d;@march=rv64imafdc@mabi=lp64d

Bug fixes

  • none

Improvements

Compared to the original SiFive version, the same architecture and API options are supported, and there are minimal functional changes

  • libgloss was removed from the list of libraries always linked to the application, since it issues ECALL instructions that fail in bare metal environments
  • march=rv32imaf/mabi=ilp32f was added to the list of multi-libs
  • the standard documentation, in PDF and HTML, is included
  • experimental support for Python in GDB was added

newlib-nano

Support for newlib-nano is available using the --specs=nano.specs option. For better results, this option must be added to both compile and link time.

nosys.specs

If no syscalls are needed, --specs=nosys.specs can be used at link time to provide empty implementations for the POSIX system calls.

Compile options

The libraries are compiled with -O2 -mcmodel=medany. The nano version is compiled with -Os -mcmodel=medany.

Python

Support for Python scripting was added to GDB. This distribution provides two separate binaries, riscv-none-embed-gdb-py with Python 2.7 support, and riscv-none-embed-gdb-py3 with support for Python 3.7.

It is mandatory to have exactly these version installed, otherwise GDB will not start properly.

For this it is recommended to install the binaries provided by Python, not those available in the distribution, since they may be incomplete, for example those in Ubuntu/Debian, which split the Python system library into multiple packages.

On GNU/Linux, the recommended way is to build is from sources, and install locally:

python3_version="3.7.9"
mkdir -p "${HOME}/Downloads"
curl -L --fail -o "${HOME}/Downloads/Python-${python3_version}.tgz" https://www.python.org/ftp/python/${python3_version}/Python-${python3_version}.tgz
rm -rf "${HOME}/Work/Python-${python3_version}"
mkdir -p "${HOME}/Work"
cd "${HOME}/Work"
tar xzf "${HOME}/Downloads/Python-${python3_version}.tgz"
cd "${HOME}/Work/Python-${python3_version}"
bash ./configure --prefix="${HOME}/opt"
make
make altinstall

To run GDB with this version of Python, use a script to set the proper environment, like:

mkdir -p "${HOME}/opt/bin"
cat <<'__EOF__' > "${HOME}/opt/bin/riscv-none-embed-gdb-py3.sh"
#!/usr/bin/env bash
PYTHONPATH="$($HOME/opt/bin/python3.7 -c 'import os; import sys; print(os.pathsep.join(sys.path))')" \
PYTHONHOME="$($HOME/opt/bin/python3.7 -c 'import sys; print(sys.prefix)')" \
riscv-none-embed-gdb-py3 "$@"
__EOF__
chmod +x "${HOME}/opt/bin/riscv-none-embed-gdb-py3.sh"

Text User Interface (TUI)

Support for TUI was added to GDB. The ncurses library (v6.2) was added to the distribution.

Known problems

  • the GDB binaries with Python support were built with version 2.7/3.7, and require exactly those versions in order to run properly.

Shared libraries

On all platforms the packages are standalone, and expect only the standard runtime to be present on the host.

All dependencies that are build as shared libraries are copied locally in the same folder as the executable.

runpath

On GNU/Linux the binaries are adjusted to use a relative path:

$ readelf -d library.so | grep runpath
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]

Please note that in the GNU ld.so search strategy, the DT_RUNPATH has lower priority than LD_LIBRARY_PATH, so if this later one is set in the environment, it might interfere with the xPack binaries.

@executable_path

Similarly, on macOS, the binaries are adjusted with otool to use a relative path.

Documentation

The original PDF documentation is available in the share/doc folder.

Supported platforms

Binaries for Windows, macOS and GNU/Linux are provided.

The binaries were built using the xPack Build Box (XBB), a set of build environments based on slightly older distributions, that should be compatible with most recent systems.

  • x86/x64 GNU/Linux: all binaries were built with GCC 9.3, running in an Ubuntu 12 Docker container
  • arm64/arm GNU/Linux: all binaries were built with GCC 9.3, running in an Ubuntu 16 Docker container
  • x86/x64 Windows: all binaries were built with mingw-w64 GCC 9.3, running in an Ubuntu 12 Docker container
  • x64 macOS: all binaries were built with GCC 9.3, running in a separate folder on macOS 10.10.5.

Build

The scripts used to build this distribution are in:

  • distro-info/scripts

For the prerequisites and more details on the build procedure, please see the README-MAINTAINER page.

Travis tests

The first set of tests were performed on Travis, by running a simple script to check if the binaries start and compile several simple programs on a wide range of platforms and distributions:

Tests

The binaries were testes on Windows 10 Pro 32/64-bit, Ubuntu 18 LTS 64-bit, Xubuntu 18 LTS 32-bit and macOS 10.14.

The tests consist in building and debugging some simple Eclipse projects available in the build project.

Since the source code used for GCC is identical to the one used by SiFive, the long and complex tests performed by SiFive to validate their release were not executed again.

Checksums

The SHA-256 hashes for the files are:

2009f256e59291e1025cc099e4300d7662dda040b304fe3462b4cb7c35c71378
xpack-riscv-none-embed-gcc-8.3.0-1.2-darwin-x64.tar.gz

751f28a28148ddaec8cfcbf7eb794a70d24ee6650dc29da91e6aa672b9deae52
xpack-riscv-none-embed-gcc-8.3.0-1.2-linux-arm64.tar.gz

63f232cbeddbe968130f4c8386cca24c5e1410cc2551738d071b279a94cd8b75
xpack-riscv-none-embed-gcc-8.3.0-1.2-linux-arm.tar.gz

1d99730d6e1e5d3a60fa0ccfbbcf0276e77dd83d58b6d8d1543cef40a1dd96ca
xpack-riscv-none-embed-gcc-8.3.0-1.2-linux-x32.tar.gz

079a88d7f7c18cfd735a9ed1f0eefa28ab28d3007b5f7591920ab25225c89248
xpack-riscv-none-embed-gcc-8.3.0-1.2-linux-x64.tar.gz

8e7e98117900f3eed717b20555b346c2473dcbb9090e05c456412008f39fb62d
xpack-riscv-none-embed-gcc-8.3.0-1.2-win32-x32.zip

5b7a4e3a2bb22566fed951972d726d10ff43bc35db17f9287eed52766e80ecee
xpack-riscv-none-embed-gcc-8.3.0-1.2-win32-x64.zip

Download analytics

Credit to Shields IO for the badges and to Somsubhra/github-release-stats for the individual file counters.