OpenRisc simulator runs Linux

Posted on 2009/12/06

3


OpenCores is an organization owned by ORSoc that invests in open source hardware. Their site hosts many hardware projects that ship the source code (Hardware Description Language in this case) with the GNU Lesser General Public Licence. This allows the adoption of free Intellectual Properties (hardware blocks) in any hardware design, being it proprietary (closed-source) or not. One of the most exciting project is the OpenRisc, a 32bit micro-controller that competes with professional cores. Even in one of the most loved open source platforms, the Arduino, the core itself (an Atmel AVR variant) is “closed source”.

By extending the open source philosophy to the core itself, it is possible to:

  • understand “what’s behind” an embedded platform
  • study and exploit the lower layers of the firmware
  • discover hardware bugs
  • customize the micro-controller design

In order to develop software on this particular micro-controller, a toolchain has been developed (thanks to Means of Freedom and ORSoc) based on the widely adopted GNU toolchain. Using this toolchain it is possible to compile C code for the OpenRisc platform and run it inside a simulator. The most complete example of the toolchain’s potential is the compilation and simulation of a small Linux system.

OpenCores provides a VMWare image that contains an Ubuntu system with all the tools to start toying with OpenRisc. More information here: http://www.opencores.org/openrisc,vmware

To use the toolchain on an existing Linux system (Ubuntu, for example), there is a guide here: http://www.opencores.org/openrisc,gnu_toolchain

The steps basically involve:

  • installing the prerequisites (for example build-essentials)
  • running a script that:
    • downloads the version of the software that can be compiled for OpenRisc
    • patches the source code to add OpenRisc-specific compatibility
    • compiles the toolchain and the Linux system to simulate
  • running the simulator (or32-elf-sim) using the Linux image and a configuration file.
  • connecting to the simulated Linux system (using telnet on localhost, port 10084)

The simulator can be launched with a configuration file that allows to change many parts of the system, like the memory and the peripherals, and the connections to the external world; for example it redirects the serial port to a listening TCP socket on port 10084 that can be accessed with telnet.

This system shows untapped potential: it could become widely adopted by electronic enthusiasts that now are enjoying Arduino and PICs. After that, the project could mature up to the point of being competitive against commercial cores. Up to now, ORSoc sells development kits based on (expensive) FPGA, but in the near future I hope that they will sell a real OpenRisc-based chip mounted on a set of boards just like the Arduino ones.

Posted in: Embedded, Hardware