I'm overdue to provide an update on how to run Virtual System Platform (VSP) and Incisive on the latest version of Ubuntu. My last article was very helpful to many people and users provided additional insight about what worked for them.
Just before the holiday break we delivered our latest version of the Zynq Virtual Platform to some early beta users. One of the delivery options we have been using is to deliver a Virtual Machine with all of the software pre-installed and configured so it's easy to download and run. This eliminates the need to download and configure additional software such as models and compilers.
Another compelling event was the update of Virtual System Platform to use the infrastructure from the Incisive 11.1 release. For us, "infrastructure" mostly means the supported platforms and for SystemC simulation it means the provided set of GNU compilers for compiling SystemC models. Starting with 11.1 only 64-bit machines are supported (although you can generate and run 32-bit executables). One the reasons the 64-bit machine is important is that the supplied version of g++ only runs on 64-bit machines.
To make a long story short, these modifications required me to provide a new 64-bit Ubuntu Virtual Machine for the Zynq delivery, so I thought this is a good time to update interested readers on using Ubuntu 11.10 with the latest Virtual System Platform and Incisive 11.1. As usual, my work is almost exclusively SystemC Virtual Platforms so I don't use everything in Incisive, but I'm sure much of the information is still relevant. The same information probably also applies to older versions like Ubuntu 10.10, but since it is 2012 now, I thought it was a good time to get caught up and use Ubuntu 11.10 for my daily work.
For anybody new to VirtualBox, the initial setup is always the same:
- Download and install VirtualBox
- Download an .iso file from Ubuntu and install it into a new Virtual Machine
- After the install is done, reboot and then install all updates Using Ubuntu Update Manager
- Reboot again and install Guest Additions using Devices -> Install Guest Additions on the VirtualBox menu
- Reboot again and the system is ready to use
There are many resources on using VirtualBox so do some reading if you want to learn more about how to do it and how it works.
One additional trick if you want to use shared folders to access the same data from the host and the guest machines; make sure to run usermod to add your user account to the vboxsf group. Without this step you will have permission issues when accessing the shared folders from the Ubuntu guest and may be tempted to try sudo to copy files.
$ sudo usermod -a -G vboxsf <user>
After adding the user account to the vboxsf group you may need to log out and log back in for it to be complete. You can always use the groups command to see which groups a user is part of.
Modifications for Virtual System Platform
Now for the modifications for Virtual System Platform to run on Ubuntu. Some of these are the same as in previous articles and some were provided by user feedback, but I captured them all here so it's easy to tell what still applies.
Virtual System Platform requires csh in various places. Install it using:
$ sudo apt-get install csh
The default sh is dash and breaks some scripts so change sh to be bash NOT dash:
$ sudo dpkg-reconfigure dash
Virtual System Platform currently runs all simulations as 32-bit applications so install 32-bit libraries:
$ sudo apt-get install ia32-libs
This package helps g++ with 32-bit support, without it you may hit compiler and linker errors using the Cadence g++:
$ sudo apt-get install g++-multilib
Recently, some Virtual System Platform users had trouble with FlexLM utilities that are provided as part of the platform. Programs like lmutil just give a strange error:
bash: /home/jasona/VSP11.10-v010/tools/bin/lmutil: No such file or directory
The solution to get these working is to install LSB:
$ sudo apt-get install lsb
As covered before, gdb doesn't work because of a security concern that a debugger can modify a program and open a security hole -- so to enable gdb:
edit /etc/sysctl.d/10-ptrace.conf and change the 1 to 0
Virtual System Platform also requires /tmp to be writable, after install it is not -- so make /tmp writable by anybody using chmod. Depending on your Ubuntu version this may or may not be needed, but it's good to check it.
The biggest challenge if you are using the Cadence provided g++ is to make it work on a platform that has a different library layout than the officially supported Linux distributions. In the case of 64-bit Ubuntu 11.10 the 64-bit libraries are in /lib and 32-bit libraries are in /lib32. A 64-bit Red Hat distribution has 32-bit libraries in /lib and 64-bit libraries in /lib64. These differences require some tweaks to the Cadence g++ to make it work on Ubuntu. There are 2 modifications to make the Cadence supplied compiler work.
Edit `ncroot`/tools/systemc/files/specs/specfile.lnx86.gnu line 59 to look in /usr/lib32 instead of /usr/lib (which has 64-bit libs).
LINKER_SHARED_LIB_OPT = -L/usr/lib32
Edit the `ncroot`/tools/cdsgcc/gcc/bin/cdsgcc wrapper line 143 to add /usr/lib32 without this you will get error linking the crt?.o files.
With these changes you should be able to compile and run SystemC simulations on Ubuntu 11.10. If you have other code that is compiled with the Cadence supplied compiler and you invoke g++ directly make sure to use -m32 if you want 32-bit output. Without this you will get 64-bit output. Programs like irun and ncsc_run will add the -m32 automatically.
One last note, on Ubuntu 11.10 the fonts in SimVision are unattractive. This can be fixed by installing additional fonts:
$ sudo apt-get install ttf-mscorefonts-installer
Make sure to either run the fc-cache program to update the font cache or just reboot and it will update.
Hopefully all of this info will help readers who are interested in running Ubuntu 11.10 and Virtual System Platform or Incisive either natively or inside VirtualBox.
I don't have any big summary of 2011 or predictions for 2012, but I wanted to share a favorite moment from 2011. As with any software development project things get a little crazy when the time comes to ship. We have a team of people working on the Zynq Virtual Platform that is spread across 3 continents, and for me, living in the Central time zone, it means I have nearly zero working time overlap with the India team. This results in a number of late night meetings to talk about and debug various issues, and leads to a general lack of sleep on both sides of the globe.
I couldn't help but start laughing one day last fall when I pulled the Embedded System Design Magazine from my mail box with the title "Avoiding late night debugging". The article didn't help me much, but I admit the cover was pretty appealing. After a two week break in which no late night debugging was done, we are back to work (including late night debugging) and look forward to working with many of you in 2012.