Skip to content

Linux Virtual Appliance User Guide

Francois Bedard edited this page May 19, 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

The Desktop contains the following shortcuts:

  • Linux Virtual Platform Environment: this will take you ~/snps
  • ARC700-VP: this will open a terminal in the base directory for the ARC700 virtual platform and set the proper path to development tools for this platform.

Select desired action from above list.

Start Virtual appliance.

Configure ARC nSIM license information

 $ vi ~/snps/setenv.sh  

Update the line with “export LM_LICENSE_FILE=" by added the path to the nSIM license file after the " =" sign and save your changes.

Source the updated environment

$ source ~/snps/setenv.sh  

Start SystemC model for ARC 700 platform using run_sim script:

$ ./run_sim.sh 

Each run script starts appropriate prebuilt linux kernel on matching prebuilt SystemC model.

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

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.

  • Q: How do I recompile the model?

    A: 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 model is built. To build model for ARC HS pass following variables to the make: * ARC 700 model: make EXTRA_CXXFLAGS="-fpermissive"

    Set required permissions to sc_top:

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

    The sudo password for the appliance is arc. Your recompiled model is ready.

  • Q: How do share files between host and virtual machine?

    A: 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.

Clone this wiki locally