Skip to content

Building nSIM OSCI Linux Virtual Platform

Anthony Kolesov edited this page Jun 26, 2013 · 26 revisions

Abstract

This document provides a step-by-step guide on building nSIM OSCI Linux Virtual Platform. Platform allows to run Linux kernel for ARC processors on the nSIM simulator.

Prerequisites

Software:

Environment:

  • In its default configuration platform creates xterm windows, so it requires to be started from GUI. If you from terminal interface, then build platform in headless mode.
  • Ethernet implementation
  • Ethernet implementation requires networking capabilities to be set for Platform binary. Setting those capabilities requires sudo access on host system. You can use Platform without sudo but without Ethernet. Capabilities can be set only on local file system, they can not be set on NFS. For full experience you need to have sudo access and run platform from local file system.

Following document refers to $NSIM_HOME as path to nSIM installation. It is recommended to set this as an environment variable.

Building SystemC and SCML libraries

Create directories where you will install SystemC and SCML before building them.

Build and install SystemC:

$ tar xzf systemc-2.3.0.tgz
$ mkdir systemc-2.3.0/BUILD
$ pushd systemc-2.3.0/BUILD
$ ../configure --prefix=/path/to/systemc-install
$ make
$ make install
$ popd

The same for SCML (use make install, make will not work):

$ tar xzf scml-2.1.3.tgz
$ mkdir scml-2.1.3/BUILD
$ pushd scml-2.1.3/BUILD
$ ../configure --prefix=/path/to/scml-install --with-systemc=/path/to/systemc-install CPPFLAGS='-fpermissive'
$ make install
$ popd

Configure nSIM with your newly built libraries. In $NSIM_HOME/systemc/scripts/config.sh set SYSTEMC_HOME and SCML_HOME to the installation paths of respective libraries. Set TLM_HOME to the same value as SYSTEMC_HOME. Set MW_HOME to empty string, set NSIM_HOME to the nSIM installation path.

Source $NSIM_HOME/systemc/scripts/setup.sh. This setup environment for the Platform.

$ . $NSIM_HOME/systemc/scripts/setup.sh

Building the Platform

Change dir to Platform directory.

Update reference to TLM directory in Makefile, because for some reasons TLM which goes with SystemC uses another directory structure than the one which is shipped separatly:

$ sed -i Makefile -e 's|\$(TLM_HOME)/include/tlm$|\$(TLM_HOME)/include/tlm_core|'

If you are going to use Ethernet, then you'll have to set capabilities. The side effect is that application with set capabilities won't search for shared libraries in LD_LIBRARY_PATH. To overcome this you need to either copy nSIM and SystemC shared libraries to system library directories (not recommended) or set rpath during build time. This guide uses second approach.

$ sed -i.bak Makefile \
  -e "s|LINK_OPTION=.*|LINK_OPTION := -Wl,-rpath=$(NSIM_HOME)/lib -Wl,-rpath=$(SYSTEMC_HOME)/lib-linux64|"

Build platform:

$ make

Or if you want to build Platform in headless mode then:

$ make EXTRA_CXXFLAGS=-DHEADLESS_MODE

If you are going to use Ethernet, then set capabilities:

$ sudo /usr/sbin/setcap cap_net_admin,cap_net_bind_service=pe ./sc_top

Running the Platform

Build Linux image using that guide. Copy kernel image to Platform directory or create a respective symlink to image. Alternatively in Platform directory edit properties.ini file to point to the valid kernel image location.

Environment variable SC_SIGNAL_WRITE_CHECK must be set to DISABLE to run Platform. Run:

$ SC_SIGNAL_WRITE_CHECK=DISABLE ./sc_top

If you've built normal Platform it will open an Xwindow with Linux terminal in it. If Ethernet is configured properly, than on your host system will be created TAP device with IP address 192.168.218.1, Linux on Platform will be available at IP 192.168.218.2. If you've built headless system then Ethernet will the only way to communicate with it (use telnet 192.168.218.2 to access the system).

To close system press Ctrl+C in the terminal which runs Platform (kill -SIGINT should work to). Command halt in Linux on Platform will halt the system, but Platform still will be running.

Clone this wiki locally