Simulating uC/OS-II inside the
OpenRISC simulator

In order to run uC/OS-II applications inside the OpenRISC simulator you bascially need three things: a hardware simulator, a compiler for the simulator and a uC/OS-II port for the simulator. The OpenCores project provides a complete GNU toolchain, contianing a hardware simulator and the corresponding compiler tools based on GNU GCC.

In order to save compilation time and space, we offer a precompiled toolchain. The installation procedure is tested on Linux, Ubuntu 8.04 and 9.04 (32 bit). Our precompiled toolchain provides the following complier tools and simulator versions:

We have also developed Grasp, a set of tracing and vizualization tools for illustrating the behavior of real-time applications, shown in the screenshots below.

Trace of tasks sharing a mutex implementing the Stack Resource Policy (SRP).

Trace of tasks which are mapped to a deferrable and a polling server.

Installing the precompiled OpenRISC toolchain for Linux

  1. Download the precompiled toolchain.
  2. Extract the archive anywhere you like.
  3. Add the <toolchain>/or32-elf/bin directory to your path.

    If you are working with bash you can type (or add the PATH to your .bashrc):

    $ PATH=$PATH:<toolchain>/or32-elf/bin
    $ export PATH

Running uC/OS-II inside the OpenRISC simulator

  1. Obtain a copy of the uC/OS-II version 2.86 source code from the Micrium website.
  2. Downlaod the uC/OS-II port for OpenRISC. Note that this port was made specifically for uC/OS-II version 2.86.
  3. Extract the archive anywhere you like
  4. Go to the extracted port directory.
  5. Follow the instructions in the README file to apply a patch to the original uC/OS-II sources.
  6. Compile the example application:
    $ make all
  7. Run the simulation:
    $ or32-elf-sim -f sim.cfg ucos-test.or32

Note: you may need to install qmake for the make command to work. Under Ubuntu you can install it using:

$ sudo apt-get install qt4-qmake

Using the GDB debugger

The OpenRISC toolchain comes with a GDB debugger, named or32-elf-gdb. We can connect it to a running simulation compiled with debug information using a (simulated) JTAG interface. Note that future versions of the OpenRISC toolchain plan to depricate the JTAG interface.
  1. To compile the uC/OS-II application with debug information, add -ggdb to the CFLAGS defines in the file, or type:
    $ CFLAGS="-ggdb"; make distclean all
  2. In order to use a graphical debugger interface, install the programm ddd from your Linux distribution's package manager.
  3. Start the simulation and connect the debugger to the target platform:
    $ ddd --debugger or32-elf-gdb
  4. Within the gdb console load the simulated executable and the remote target:
    file ucos-test.or32
    target jtag jtag://localhost:9999

Various extensions

We have extended the above uC/OS-II distribution with the following features: You can download a patch with the various extentions from here. Note that this patch requires the uC/OS-II port for OpenRISC, so you will need to first follow the steps described above.

RELTEQ + Servers + Hierarchical scheduling

You can download an example application demonstrating the RELTEQ extension with support for servers and hierarchical scheduling from here.


Our port of uC/OS-II for the OpenRISC simulator is based on the sources provided by Tim Oliver. The uC/OS-II port was adapted to the current version of the OpenRISC toolchain by Martijn van den Heuvel. The RELTEQ extention was developed by Wim Cools. The logging extention and the accompanying plotter were developped by Mike Holenderski.