-
Notifications
You must be signed in to change notification settings - Fork 48
Building nSIM OSCI Linux Virtual Platform
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.
Software:
- libSDL development package needs to be installed
- SystemC 2.3.0
- SCML 2.1.3
- nSIM 2013.06 or later
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 withoutsudo
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 havesudo
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.
Note. You need to create directories where you will install SystemC and SCML before building them, which is why we use mkdir
in the instructions below.
Build and install SystemC:
$ tar xzf systemc-2.3.0.tgz
$ mkdir systemc-2.3.0/BUILD
$ pushd systemc-2.3.0/BUILD
$ mkdir -p /path/to/systemc-install
$ ../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
$ mkdir -p /path/to/scml-install
$ ../configure --prefix=/path/to/scml-install \
--with-systemc=/path/to/systemc-install CPPFLAGS='-fpermissive'
$ make install
$ popd
Please note that make install command should be used for scml building and installation at once instead of separate execution of make and make install.
On attempt to execute make after configuration this kind of error messages may appear:
In file included from ../../../src/scml2_testing/memory_element_value_proxy.cc:12:0:
../../../src/scml2_testing/../scml2_testing/test_memory_element.h:13:19: fatal error: scml2.h: No such file or directory
#include <scml2.h>
^
compilation terminated.
In file included from ../../../src/scml2_testing/initiator_socket_proxy_base.cc:11:0:
../../../src/scml2_testing/../scml2_testing/initiator_socket_proxy_base.h:14:19: fatal error: scml2.h: No such file or directory
#include <scml2.h>
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
Change dir to Platform directory.
Build platform for ARC 700:
$ make CPU=arc700
Or if you want to run Linux without UART and PGU then build Platform in "headless" mode:
$ make CPU=arc700 HEADLESS_MODE=1
If you are going to use Ethernet, then set capabilities:
$ sudo setcap cap_net_admin,cap_net_bind_service=pe sc_top
Same options apply for ARC HS model:
$ make CPU=archs
With HS you can also build dual-core model:
$ make CPU=archs NUM_CORES=2
Note that current platform implementation doesn't support more than two cores for ARC HS systems, and more than one core for ARC 700 systems.
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.
Before running the Platform make sure that xterm is installed on your host.
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 too). Command halt
in Linux on Platform will halt the system, but Platform still will be running.
Make sure GDB server is enabled in the platform configuration file properties.ini and port number on which GDB server will accept connections is specified.
[bool]
top.nsim_1./model_config/halt_on_reset: true
top.nsim_1./debugger_config/gdb_server/enabled: true
[uint]
top.nsim_1./debugger_config/gdb_server/port: 12345
Now start the platform as usual:
$ SC_SIGNAL_WRITE_CHECK=DISABLE ./sc_top
In a separate terminal window start GDB client and proceed as with normal remote GDB debug session
$ arc-elf32-gdb -q vmlinux
Reading symbols from vmlinux...(no debugging symbols found)...done.
(gdb) target remote localhost:12345
Remote debugging using localhost:12345
0x00000000 in ?? ()
(gdb) load
(gdb) b arc_cache_init
Breakpoint 1 at 0x80160b0e
(gdb) c
Continuing.
Breakpoint 1, 0x80160b0e in arc_cache_init ()
(gdb) c