Skip to content

Linux Virtual Appliance User Guide

Francois Bedard edited this page May 15, 2014 · 25 revisions

This is a draft document and is subject to change without notice.

This is a manual on how to use Virtual Appliance for ARC Linux Virtual Platform.

Installing

  1. Download latest VirtualBox distribution from https://www.virtualbox.org/wiki/Downloads. VirtualBox Extension Pack is not required. Install VirtualBox. Start it.
  2. Click menu item "File > Import Appliance". Choose *.ova file of this virtual appliance.
  3. When importing a dialog box will prompt you for certain VM parameters. Review default values and edit if required. Most likely candidates for editing: VM name, amount of CPU cores and amount of RAM.

Running ARC Linux Virtual Platform

Start Virtual appliance.

Configure ARC nSIM license information

$ vi setenv.sh

Insert “export LM_LICENSE_FILE=” and save.

Source the updated environment

$ source ~/snps/setenv.sh

Change current directory to the ~/snps/virtual-appliance:

$ cd ~/snps/virtual-appliance

Start SystemC model:

$ SC_SIGNAL_WRITE_CHECK=DISABLE ./sc_top

Depending on the parameters used at compile time, one of the provided properties.ini will be used. For the default ARC 700 single core model properties_up_a7.ini will be used, which in turn will set appropriate nSIM properties file and vmlinux file.

Recompiling the model

Set required environment variables: NSIM_HOME, SYSTEMC_HOME, TLM_HOME and SCML_HOME. You can source ~/snps/setenv.sh to use packages provided with this virtual appliance.

Compile model:

$ make clean
$ make EXTRA_CXXFLAGS="-fpermissive"

By default model for ARC 700 is built. To build model for ARC HS pass following variables to the make:

  • ARC 700 model: make
  • Single core ARC HS model: make ARCV2HS=1
  • Dual Core ARC HS model: make CONFIG_SMP=1 ARCV2HS=1

Set required permissions to sc_top:

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

Your recompiled model is ready.

Debugging application running on Linux

Add toolchain to the PATH:

$ export PATH=/home/arc/snps/toolchain-arc700/host/usr/bin:$PATH

Compile application (source code for hello world is already included):

$ cd snps/pub/examples
$ arc-linux-gcc -g -o hello_world hello_world.c

For simplicity in this example we already work right in the NFS share. If you work in another directory then you will need to copy executable to the NFS share to make it available to the target.

Start gdbserver on target system:

[ARCLinux] $ cd /mnt/examples
[ARCLinux] $ gdbserver :49101 hello_world

Start GDB on host:

$ arc-linux-gdb --quiet hello_world
(gdb) set sysroot /home/arc/toolchain-a7/sysroot
(gdb) target remote 192.168.218.2:49101
(gdb) break main
(gdb) continue
(gdb) continue
(gdb) quit

Sharing files between host and virtual machine

To share files between virtual machine and physical host, open Virtual Machine Settings, go to "Shared Folders" section, and add there a folder. It is recommended to set "auto-mount" to true, so that folder will be mounted automatically. Then reboot your virtual machine. Your shared folder should be mounted to /mnt/sf_<name_of_share>. For example if you named share as "Public", then it will be mounted to "/mnt/sf_Public". Note that shared folders require functioning guest extensions on the virtual machine, so if you updated the kernel in virtual machine you will need to rebuild VirtualBox guest extensions, to get shared folders back.

FAQ

  • Q: I've issued "halt" command to the target. Linux halted, but SystemC model is still running.

    A: It is a known issue in the current SystemC model: it doesn't exit when CPU was halted. You need too close SystemC model with CTRL+C combinations (or send SIGINT via kill command).

  • Q: When SystemC model exits there is an error message about failed assertion.

    A: It is a known issue, which exibits itself only when exiting from the model, therefore it doesn't have any known real consequences.

Clone this wiki locally