New Horizons

Welcome to my blog

My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and have
my own company


You are welcome to contact me
and ask questions or make comments
about my blog.


New Horizons
What's new
Starting a blog
Writing a blog
Using an RSS reader

Zynq Design From Scratch
Started February 2014
1 Introduction
Changes and updates
2 Zynq-7000 All Programmable SoC
3 ZedBoard and other boards
4 Computer platform and VirtualBox
5 Installing Ubuntu
6 Fixing Ubuntu
7 Installing Vivado
8 Starting Vivado
9 Using Vivado
10 Lab 1. Create a Zynq project
11 Lab 1. Build a hardware platform
12 Lab 1. Create a software application
13 Lab 1. Connect to ZedBoard
14 Lab 1. Run a software application
15 Lab 1. Benchmarking ARM Cortex-A9
16 Lab 2. Adding a GPIO peripheral
17 Lab 2. Create a custom HDL module
18 Lab 2. Connect package pins and implement
19 Lab 2. Create a software application and configure the PL
20 Lab 2. Debugging a software application
21 Running Linux from SD card
22 Installing PetaLinux
23 Booting PetaLinux
24 Connect to ZedBoad via ethernet
25 Rebuilding the PetaLinux kernel image
26 Running a DHCP server on the host
27 Running a TFTP server on the host
28 PetaLinux boot via U-boot
29 PetaLinux application development
30 Fixing the host computer
31 Running NFS servers
32 VirtualBox seamless mode
33 Mounting guest file system using sshfs
34 PetaLinux. Setting up a web server
35 PetaLinux. Using cgi scripts
36 PetaLinux. Web enabled application
37 Convert from VirtualBox to VMware
38 Running Linaro Ubuntu on ZedBoard
39 Running Android on ZedBoard
40 Lab2. Booting from SD card and SPI flash
41 Lab2. PetaLinux board bringup
42 Lab2. Writing userspace IO device driver
43 Lab2. Hardware debugging
44 MicroZed quick start
45 Installing Vivado 2014.1
46 Lab3. Adding push buttons to our Zynq system
47 Lab3. Adding an interrupt service routine
48 Installing Ubuntu 14.04
49 Installing Vivado and Petalinux 2014.2
50 Using Vivado 2014.2
51 Upgrading to Ubuntu 14.04
52 Using Petalinux 2014.2
53 Booting from SD card and SPI flash
54 Booting Petalinux 2014.2 from SD card
55 Booting Petalinux 2014.2 from SPI flash
56 Installing Vivado 2014.3

Chipotle Verification System

EE Times Retrospective Series
It all started more than 40 years ago
My first job as an electrical engineer
The Memory (R)evolution
The Microprocessor (R)evolution

Four soft-core processors
Started January 2012
Table of contents
OpenRISC 1200
Nios II

Using the Spartan-6 LX9 MicroBoard
Started August 2011
Table of contents
Problems, fixes and solutions

FPGA Design From Scratch
Started December 2006
Table of contents
Acronyms and abbreviations

Actel FPGA design
Designing with an Actel FPGA. Part 1
Designing with an Actel FPGA. Part 2
Designing with an Actel FPGA. Part 3
Designing with an Actel FPGA. Part 4
Designing with an Actel FPGA. Part 5

A hardware designer's best friend
Zoo Design Platform

Installing Cobra Command Tool
A processor benchmark

Porting a Unix program to Mac OS X
Fixing a HyperTerminal in Mac OS X
A dream come true

Stockholm by bike

The New York City Marathon

Kittelfjall Lappland

Tour skating in Sweden and around the world
Wild skating
Tour day
Safety equipment
A look at the equipment you need
Skate maintenance
Books, photos, films and videos
Weather forecasts

38000 feet above see level
A trip to Spain
Florida the sunshine state

Photo Albums
Seaside Florida
Ronda Spain
Sevilla Spain
Cordoba Spain
Alhambra Spain
KittelfjÀll Lapland
Landsort Art Walk
Skating on thin ice

100 Power Tips for FPGA Designers

Adventures in ASIC
Computer History Museum
Design & Reuse
d9 Tech Blog
EDA Cafe
EDA DesignLine
Eli's tech Blog
FPGA Arcade
FPGA Central
FPGA developer
FPGA Journal
FPGA World
Lesley Shannon Courses
Mac 2 Ubuntu
Programmable Logic DesignLine
World of ASIC

If you want to be updated on this weblog Enter your email here:

rss feed

Saturday, November 26, 2011
FPGA design from scratch. Part 83
Building a virtual machine

A virtual machine (VM) is a completely isolated guest operating system installation within a normal host operating system. Modern virtual machines are implemented with either software emulation or hardware virtualization or (in the most cases) both together.

Wouldn't it be nice to put everything we have done so far in  a virtual machine and run it on any computer we like (my MacBook Pro for example).
Let us find out if it is possible. We will start by choosing a virtualization product.

Choosing a virtualization product

There are several virtualization products to choose from. Here are
four examples:

After taking a closer look at the alternatives I decided to go for VirtualBox.


VirtualBox is a powerful x86 and AMD64/Intel64 virtualization  product for enterprise as well as home use. Not only is VirtualBox a feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL) version 2. Here is the User Guide and here are some How To tutorials.

Installing VirtualBox

For information on how to install and setup VirtualBox see Using VirtualBox Part 1-3 in this blog.

Guest OS

We will install Debian 6.0.3 (Squeeze) in our virtual machine. For more information see We are free to use any other Linux OS we prefer, but it will be harder to follow this guide with another Linux OS running. Both Xilinx and PetaLogix are recommending RedHat Enterprise or Cent OS.

Fixes to Debian 6.0.3

The Debian installation will not work right out of the box. Here are a few things we have to fix:

  • Changing default shell
  • Adding missing packages
  • Adding gmake
  • Replace Acroread PDF reader

Changing default shell

Debian uses dash as their default shell. Most of the PetaLogix scripts are written to use bash as the default shell. You can find out what the default shell is by executing the following command:

--> ls -al /bin/sh

If the /bin/sh links to dash use this command to change from dash to bash:

--> sudo dpkg-reconfigure dash

Adding missing packages

The Debian OS doesn't include all the software we need but it can easily be added using the command: sudo apt-get install <package>. Here is one example:

--> sudo apg-get install gawk

Adding gmake

PetaLogix and Xilinx uses gmake for running their makefiles. Debian call their the gmake program
make. To add the gmake program we just execute the following command:

--> sudo ln -s /usr/bin/make /usr/bin/gmake

Replacing Acroread

Xilinx supports only the Acroread program for displaying PDF files. Acroread is not installed in Debian and is not part of the normal repository. Instead we can use evince or xpdf.

--> sudo ln -s /usr/bin/evince /usr/bin/acroread

VirtualBox setup

Connecting USB ports

Our LX9 MicroBoard has two USB ports. They are recognized by their names and when we connect our board to the host computer they will show up in the VirtualBox USB settings window. We will add them to the USB Device Filter list (click the icon with the + to the right) which will make the USB ports always connected in our virtual machine. 

Shared folders

Shared folders makes it possible to move files between our host computer and the guest. We will setup a directory called Shared that will be shared with our guest OS.

Network connections

We will use the Bridged Adapter network setup. More information about networking will follow later on in this tutorial. 

VirtualBox running

Use this command to start VirtualBox:

--> virtualbox &

Booting Debian

Select the virtual machine to run and click the Start button. This is what it looks like when the Debian Linux is running in our virtual machine.

Installing Xilinx Design Suite

We will install the lastest version of Design Suite (13.3). Follow the instruction in
part 51 to install the Xilinx software.

Installing PetaLinux SDK

Follow the instruction in part 73 to install the PetaLinux SDK.

Setting up TFTP and NFS servers

Follow the instruction in part 74 to install and start TFTP and NFS servers.

Mounting shared file system

Use the following command to mount the shared file system in directory Host in our guest OS:

--> sudo mount -t vboxsf -o uid=1000,gid=1000 Shared ~/Host

Fixing problems with permissions

I ran into some problems when using the usb ports from the guest OS. I don't really understand why but here are some fixes to the problems. There may be other ways to solve it.

Starting GTKterm

When trying to connect to ttyUSB0 I got the following error message. There seems to be some problems with the file permissions.

This is what the file permissions looks like for the file ttyUSB0:

One easy fix is to add us to the unix group dialout. Let's open  System->Administration->Users and Groups:

Click Manage Groups and select dialout.

Click the Properties button and mark our name . We must have root permissions.

Click OK and we are done. Logout and login for the changes to take affect.

Adding a group using a Linux command

There is a much easier way using the usermod command:

--> sudo /usr/sbin/usermod -a -G dialout svan

Running iMPACT

When starting iMPACT we get the following error message:

USB setup

Starting with 10.1 Service Pack 1, the libusb package can be used to connect to the Platform Cable USB on the Linux platforms. This package replaces the functionality provided by the Jungo windrvr6 module. The use of libusb provides an alternative approach for users who encounter problems during the building and installation of the existing driver solution.

Here is a listing of the USB device nodes. We have no write permission.

Writing udev rules

udev is targeted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistent device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. The udev rules can be found in the directory: /etc/udev/rules.d

Editing udev rules

The rules file for our JTAG to USB connection is called 52-diligent-usb.rules. We will edit this file and add a group statement (GROUP="plugdev") like this:

After restarting our guest the permission looks like this:

Running Xilinx Platform Studio XPS

We can configure the FPGA from XPS.

PetaLinux console in the virtual machine

We will start GTKterm and setup the port configuration. When we press the program button on the MicroBoard the PetaLinux will boot and display the login screen on the console in the virtual machine.

Writing our first application program

Follow the instructions in part 77-78 on how to write an application program in c.

Explore new things

Our virtual machine is up and running. We are all set and ready for new adventures.

Top  Previous  Next

Posted at 09:35 by


Leave a Comment:


Homepage (optional)


Previous Entry Home Next Entry