Giter Site home page Giter Site logo

fractalclone / riscv-gnu-toolchain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from riscv-collab/riscv-gnu-toolchain

0.0 2.0 0.0 2.6 MB

GNU toolchain for RISC-V, including GCC 6.1.0

License: Other

Makefile 0.30% M4 0.12% C 99.16% Objective-C 0.10% C++ 0.28% Shell 0.04%

riscv-gnu-toolchain's Introduction

RISC-V GNU Compiler Toolchain

This is the RISC-V C and C++ cross-compiler. It supports two build modes: a generic ELF/Newlib toolchain and a more sophisticated Linux-ELF/glibc toolchain.

Getting the sources

This repository uses submodules. You need the --recursive option to fetch the submodules automatically

$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain

Alternatively :

$ git clone https://github.com/riscv/riscv-gnu-toolchain
$ cd riscv-gnu-toolchain
$ git submodule update --init --recursive

Prerequisites

Several standard packages are needed to build the toolchain. On Ubuntu, executing the following command should suffice:

$ sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc

On Fedora/CentOS/RHEL OS, executing the following command should suffice:

$ sudo yum install autoconf automake libmpc-devel mpfr-devel gmp-devel gawk  bison flex texinfo patchutils gcc gcc-c++

On OS X, you can use Homebrew to install the dependencies:

$ brew install gawk gnu-sed gmp mpfr libmpc isl

To build the glibc (Linux) on OS X, you will need to build within a case-sensitive file system. The simplest approach is to create and mount a new disk image with a case sensitive format. Make sure that the mount point does not contain spaces. This is not necessary to build newlib or gcc itself on OS X.

This process will start by downloading about 200 MiB of upstream sources, then will patch, build, and install the toolchain. If a local cache of the upstream sources exists in $(DISTDIR), it will be used; the default location is /var/cache/distfiles. Your computer will need about 8 GiB of disk space to complete the process.

Installation (Newlib)

To build the Newlib cross-compiler, pick an install path. If you choose, say, /opt/riscv, then add /opt/riscv/bin to your PATH now. Then, simply run the following command:

./configure --prefix=/opt/riscv
make

You should now be able to use riscv-gcc and its cousins.

Installation (Linux)

To build the Linux cross-compiler, pick an install path. If you choose, say, /opt/riscv, then add /opt/riscv/bin to your PATH now. Then, simply run the following command:

./configure --prefix=/opt/riscv
make linux

Installation (Linux multilib)

To build the Linux cross-compiler with support for both 32-bit and 64-bit, run the following commands:

./configure --prefix=/opt/riscv --enable-multilib
make linux

The multilib compiler will have the prefix riscv-unknown-linux-gnu-, rather than the usual prefix (riscv32-... or riscv64-...).

Advanced Options

There are a number of additional options that may be passed to configure. See './configure --help' for more details.

Test Suite

The DejaGnu test suite has been ported to RISC-V. This can run with GDB simulator for elf toolchain or Qemu for linux toolchain, and GDB simulator doesn't support floating-point. To test GCC, run the following commands:

./configure --prefix=$RISCV --disable-float --disable-linux
make newlib
make check-gcc-newlib

./configure --prefix=$RISCV
make linux
# Need qemu-riscv32 or qemu-riscv64 in your `PATH`.
make check-gcc-linux

riscv-gnu-toolchain's People

Contributors

palmer-dabbelt avatar aswaterman avatar a0u avatar darius-bluespec avatar kito-cheng avatar colinschmidt avatar vapier avatar yunsup avatar sbeamer avatar manuelafm avatar gkelly avatar fractalclone avatar arsv avatar tjyang avatar arunthomas avatar martinmaas avatar omasanori avatar pmundkur avatar rbarzic avatar sorear avatar svenstucki avatar timsifive avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.