Skip to content

OpenRISC tools install

Julius Baxter edited this page Dec 2, 2018 · 8 revisions

The following page will outline the tools required to be installed on a user's system to run the OpenRISC-related components of the workshop.

Note that the system must be a relatively recent Linux distribution. The examples given use the Aptitude (apt-get, etc.) package manager in Ubuntu. Substitute those commands for those of your distro.

Required components

The following are the required components:

  • The OpenRISC GNU tool chain (bare-metal, newlib-based, or1k-elf-)
  • The FuseSoC development environment
  • Icarus Verilog and GTKWave
  • The Altera Quartus tools (for synthesis, board programming)
  • OpenOCD debug proxy

Installing the required components

It is recommended this process is performed completed before attempting any part of the process, as, for instance, the SoC development environment depends on all tools being available.

For these examples, we will use the directory $HOME/or1k

General system tools

It is recommended the following development tools and libraries are installed. They will be necessary for various parts of the flow.

Under Ubuntu, apt-get the following:

sudo apt-get -y install build-essential make gcc g++ flex bison patch texinfo libncurses5-dev libmpfr-dev libgmp3-dev libmpc-dev libzip-dev python-dev libexpat1-dev libftdi-dev libtool autoconf libftdi-dev subversion libelf-dev elfutils

OpenRISC GNU tool chain precompiled for 32-bit Linux

[or1k-elf- toolchain built in April 2013 from github sources (150MB)] (https://www.dropbox.com/s/hm3xl2ex9sn55jr/or1k-toolchain.tar.bz2)

Extract this under /opt to create the directory or1k-toolchain.

Then run the following to add the executables to your $PATH:

echo "# OpenRISC tool chain path" >> ~/.bashrc

echo "export PATH=$PATH:/opt/or1k-toolchain/bin" >> ~/.bashrc

OpenRISC GNU tool chain from source

Up-to-date instructions for building the OpenRISC newlib toolchain are available on the or1k-elf toolchain page

Finally, we will want to run the following to put this path in our .bashrc file:

echo "# OpenRISC tool chain path" >> ~/.bashrc

echo "export PATH=$PATH:/opt/toolchains/or1k-elf/bin" >> ~/.bashrc

Mac OS X instructions

The above newlib build instructions worked on 10.14 (Mojave) but you must:

  1. install the system headers as per the instructions on this page (xcode-select --install, run package)
  2. swap mpfr-3.1.6.tar.bz2 for mpfr-3.1.4.tar.bz2 in the above newlib build instructions

Altera Quartus tools

These are simply downloaded and installed, but take a long time!

You will want to download the Quartus II Web Edition.

It is recommended using the download manager program as it allows you to select exactly what to install.

Visit the [Altera Quartus II Web Edition site] (http://dl.altera.com/?edition=web) and download the latest version for Linux. A the time of writing this was version 13.1 and the rest of the set up guide will assume that.

*Once downloaded, run the installer (there's a quick-start guide available on the Altera page near the download link).

  • Choose a destination directory of wherever you like, however this guide will assume /opt/altera/13.1
  • In the Products window expand the Device Families tree and tick the Cyclone IV E box - this is the family present on the DE0 Nano.
  • (Optional) Deselect the Modelsim-Altera Starter Edition (Free) as it's big and we won't be using it.
  • Continue through and have it install.

When it's done, use the following to export the Altera tools to your $PATH:

echo "# Altera Quartus tools path" >> ~/.bashrc

echo "export ALTERA_PATH=/opt/altera/13.1" >> ~/.bashrc

echo "export PATH=$PATH:$ALTERA_PATH/quartus/bin" >> ~/.bashrc

Icarus Verilog and GTKWave

These are both open source projects, and should be installable via any modern Linux distributions package management system. Under Ubuntu it's as easy as

sudo apt-get install iverilog gtkwave

Otherwise see this guide on installing Icarus Verilog.

Or see GTKWave's homepage to get source for it.

OpenOCD

OpenOCD is the debug proxy we'll use to talk to the board over JTAG.

Download the source to $HOME/or1k with

git clone https://github.com/openrisc/openOCD.git

Go into the OpenOCD directory and, the very first time, you must bootstrap it:

./bootstrap

You may need to install libtool and autoconf via your package manager to run this bootstrap process.

Once that is finished, configure and compile it:

./configure --enable-usb_blaster_libftdi --enable-adv_debug_sys --enable-altera_vjtag --enable-maintainer-mode

make

You can run make install if you like, too.

FuseSoC

The SoC development tool is next.

Clone this from the github repository into $HOME/or1k

git clone https://github.com/olofk/fusesoc.git

Once cloned go into fusesoc and run the following command to install fusesoc:

sudo pip install -e .

Finally, initialize fusesoc which will download and install orpsoc-cores and fusesoc-cores to the default location of $HOME/.local/share/fusesoc

fusesoc init

... and you're done!