Skip to content

Linux Virtual Appliance User Guide

Anton Kolesov edited this page Apr 4, 2016 · 25 revisions

This document is obsolete. Linux Virtual appliance is not available to external users. Please use ARC HS VDK.

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, following instructions from VirtualBox site. 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:

  • ARC Linux VP Environment: this will take you ~/snps where you can set your environment variables. Everything is already pre-configured, all you need to do is add nSIM license location information
  • 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.
  • ARCHS-VP: this will open a terminal in the base directory for the ARCHS virtual platform and set the proper path to development tools for this platform.

Select desired action from above list.

First, configure ARC nSIM license information

 $ vi ~/snps/setenv.sh

Update the line with “export LM_LICENSE_FILE=" by adding the path to the nSIM license file after the " =" sign and save your changes. NB: nSIM license must include support for the SystemC.

Source the updated environment

$ source ~/snps/setenv.sh

Start SystemC model for ARC HS platform using run_sim script:

$ ./run_sim.sh

For dual core ARC HS platform running SMP linux, start:

$ ./run_sim_smp.sh

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

Debugging application running on Linux

If you accessed the platform via one of the desktop shortcuts, the correct toolchain for your platform should already be on the path. You can check this with command

$ which arc-linux-gcc

If for some reason the toolchain is not on the path, you can add toolchain to the PATH as follows:

For ARC 700 VP

$ export PATH=/home/arc/snps/arc700_vp/host/usr/bin:$PATH

For ARCv2HS VP

$ export PATH=/home/arc/snps/arcv2hs_vp/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: (example for arcv2hs_vp platform, sysroot location will differ for other platforms)

$ arc-linux-gdb --quiet hello_world
(gdb) set sysroot ~/snps/arcv2hs_vp/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"
    • Single core ARC HS model: make EXTRA_CXXFLAGS="-fpermissive" ARCV2HS=1
    • Dual Core ARC HS model: make EXTRA_CXXFLAGS="-fpermissive" CONFIG_SMP=1 ARCV2HS=1

    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: Sharing 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 navigate to host folder to be shared. It is recommended to set "auto-mount" to true, so that folder will be mounted automatically. Check-on option "Make permanent" in case it is available. You also need to make sure that sharing is enabled on the source folder on the host. Then reboot your virtual machine. Your shared folder should be mounted to /media/sf_ in the Linux virtual appliance. For example if shared folder on host is named "Public", it will be mounted to /media/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

  • Q: I download file with wget application, however output file has zero length.

    A: This is a known problem of wget running on ARC HS Linux. As a workaround you can use: wget -O - url | cat > output_file. Note that neither wget -O output_file url, nor wget -O - url > output_file will work.

Clone this wiki locally