Tuesday, June 24, 2014

RTEMS (or1k-rtems4.11-*) tool-chain for OpenRISC | Status Report - 25062014



Part of my GSoC project: Porting RTEMS to OpenRISC, I worked on hacking GNU tools to be able to build these tools for RTEMS targeting OpenRISC 1000 (AKA OR1K) architecture. These tools include: binutils, GCC and GDB. Besides, I had to work on Newlib port for OR1K since RTEMS depends on it. or1ksim (OR1K main emulator) is also part of the tool-chain. Currently, all the tools are working fine.

First I will list the status of each tool/program separately. After that (in the next few posts), we will come to the process of building the tool-chain. The following descriptions are concerned with some specific releases:

  • binutils-2.24
  • gcc-4.8.2
  • newlib-2.1.0
  • gdb-7.7
  • or1ksim-github-head


binutils

There has a been a small patch for binutils to support building it for RTEMS. No big deal with it. Recently, supporting or1k for binutils has been upstreamed; so the next task for RTEMS is to push our patch for review and be upstream to binutils cvs repo.


Newlib

RTEMS depends on Newlib as a library instead of the big libgcc one. Mainly, only Newlib/newlib is necessary for RTEMS. libgloss is not used because RTEMS should provide all the functions and systems calls there. There are some issues regarding Licences and a possibility that the or1k Newlib port may not be upstreamed consequently. Hence, I had to revert back to an old patch to avoid such conflicts. Also, I did not include all of libgloss code. Moreover, I had to write setjmp.S from scratch for the same reason.


GCC

Most of GCC work was about configurations. Some other definitions had to be added to include the proper headers for RTEMS and avoid others from OR1K. libgloss libraries for BSPs provided by OR1K are no longer linked by default (since RTEMS does not use any of them). To test my Newlib port, I had to link bare-metal applications with libnosys.a. Eventually GCC is working fine with Newlib.


GDB

A minimal effort was spent on GDB. It should be built without or1ksim embedded as built-in library. Instead, the current method of debugging with GDB, is to remotely attach it to or1ksim emulator via RSP protocol.


OR1KSIM

The OpenRISC simulator is just used as is from github. Anyone who uses or1ksim should provide a configuration script for his or her target. This is the current sim.cfg script I use to run or1ksim RTEMS BSP. It should be added to your home directory or the current directory you run the simulator from.


RSB (RTEMS Source Builder)

In the time being, all of the previous tools (excluding or1ksim) can be built from RSB; it's the latest modern tool RTEMS uses to build all the tool-chain for targets that RTEMS support. Therefor, I had to add support to RSB to build rtems4.11-or1k-* tool-chain. The patch for such a purpose is committed, so any one can clone RSB and build the entire tool-chain from it. Building the tool-chain from RSB is the easiest way.

In the next few posts, I will introduce some tutorials HOWTO build the tool-chain both manually and from RSB.

References

[1] Porting RTEMS to OpenRISC - Introduction 
[2] My github project repo (RTEMS).
[3] RTEMS or1k tool-chain status.
[4] HOWTO build or1k-rtems4.11 tool-chain.
[5] or1k/rtems related stuff.
[6] tool-chain patches