or1k-elf toolchain (Newlib port for OpenRISC)

The or1k-elf toolchain is a baremetal compiler, assembler, etc. toolchain for the OpenRISC architecture. The toolchain is based on the newlib C library and the standard GNU gcc, binutils and gdb. With this toolchain you can compile your own C code and execute it on the various OpenRISC targets.

Build your software

A simple hello world program like this hello.c
#include <stdio.h>

int main(int argc, char *argv[]) {
    printf("Hello World!\n");
    return 0;
}
is basically compiled with the cross compilation toolchain:
$ or1k-elf-gcc -o hello.elf hello.c
The default is to build for the or1ksim simulator. You can also build it for other boards, e.g. for the DE0 nano:
$ or1k-elf-gcc -o hello.elf hello.c -mboard=de0_nano
Finally there are a few architecture-specific compiler options (multilib configurations):

or1k support extensions

The libgloss, which is an essential part of a newlib-based cross-compiler contains some additional code to support baremetal programming. Most essential those are some simple helping functions to change the core state and support for exception, interrupt and timer handling. An extensive documentation of the functions can be found here.

There also is a short tutorial with some basic examples is also available

Download and Install the Toolchain

You can install pre-compiled toolchains and install them on your Linux system. We have prebuilt-toolchains for releases of the different components that are preferably installed to /opt/toolchains/or1k-elf. You can find all releases here. Those are current releases:

After downloading a release you can extract it anywhere in your filesystem, we recommend to `/opt/toolchains/or1k-elf/`. You need to add the toolchain to your path:
export PATH=/opt/toolchains/or1k-elf/bin:${PATH}

Development Build status

Whenever something is pushed to the newlib repository, the current development versions of Binutils, GCC, (or1k) Newlib and GDB are automatically build at Travis CI.

Current build status: