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.
#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):
-mno-delay
compiles for architecture implementations without delay slot.-mcompat-delay
compiles for both architectures. Those
have an increased code size as each delay slot is filled with a
no-operation.-msoft-float
compiles with soft floating point
instructions, for example when your target implementation does not
contain an FPU.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
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:
export PATH=/opt/toolchains/or1k-elf/bin:${PATH}
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.