This is an old revision of the document!
Working with Xilinx FPGAs on FreeBSD
Wojciech A. Koszek
wkoszek@FreeBSD.org
http://FreeBSD.czest.pl/~wkoszek/
This page documents steps necessary to get Xilinx ISE 11.1 IDE running on FreeBSD 9 system. Please contact the author if information found here didn't let you to get Xilinx FPGA toolkit working, are inappropriate or obsolete.
Introduction to free Xilinx ISE environment
ISE WebPack is a free variant of ISE Design Suite supporting most popular FPGA chips manufactured by Xilinx. This version should be enough for you in most of the cases and its use will be documented here.
Short theory behind the ISE and FreeBSD relationship – Xilinx delivers ISE binaries compiled for Linux machines. In FreeBSD, we're able to get Linux binaries to work with a help of so called Linuxolator – Linux emulation layer present in the kernel and within the base system.
Below, I present steps necessary to get your system prepared to execute Linux binaries. Later, I show how to unpack, run and install ISE environment step by step. I outline tasks necessary to get FPGAs programmed. At the end, procedure of running couple of ISE tools is documented.
System preparation
Linux emulation layer can either be enabled permanently in your kernel configuration
file, or be enabled by loading linux.ko kernel module:
# kldload linux.ko
Typical solution is to enable it through /boot/loader.conf, to make it work just
after system startup:
linux_load="YES"
You can verify whether the module has been properly loaded by inspecting kldstat
output:
# kldstat | grep linux 2 2 0xc0aa1000 2e988 linux.ko
ISE installation tools require an access to the emulated Linux process file system. You can mount it with a command:
mount -t linprocfs linprocfs /compat/linux/proc
You can verify whether the file system got properly mounted by inspecting mount
output:
# mount | grep linprocfs linprocfs on /compat/linux/proc (linprocfs, local)
Kernel-related part of Linux emulation enabling procedure should be finished
now. We still have to install Linux libraries necessary by xsetup, installation
program.
This tutorial is being written with new, fresh FreeBSD 9-CURRENT system running next to me. Apart from X11 and ViM, nothing has been installed. Installer and command-line utilities as well as “ise” – graphical frontend require couple of packages installed:
%ls /var/db/pkg/ | grep linux drwxr-xr-x 2 root wheel 512 Jan 9 15:48 linux-f10-expat-2.0.1 drwxr-xr-x 2 root wheel 512 Jan 9 15:48 linux-f10-fontconfig-2.6.0 drwxr-xr-x 2 root wheel 512 Jan 12 02:09 linux-f10-png-1.2.37 drwxr-xr-x 2 root wheel 512 Jan 9 15:48 linux-f10-xorg-libs-7.4_1 drwxr-xr-x 2 root wheel 512 Jan 9 15:47 linux_base-f10-10_2
You can see full list of packages installed at a time of writing this tutorial here (while most of ports has been installed as a part of ImageMagic installation, so that obtaining screenshots could be possible):
Moreover, you are supposed to create dynamic link to /compat/linux/opt in your
main root directory:
# ln -s /compat/linux/opt /opt
This will prevent you from running into “not enough disk space warning”.
Basically, this is the end of Linuxolator preparation. Now, we're going to start installation.
Obtaining Xilinx ISE environment
In order to obtain Xilinx ISE WebPack, you must visit this site:
http://www.xilinx.com/tools/webpack.htm
In order to proceed, one needs to have an account on the Xilinx
page. After successful account creation, you have to log in and
download WebPack package. Successful process should result in
having .tar file on your disk:
wkoszek@laptop:/media/Multimedia$ ls Xilinx_11.1_WebPack_SFD.tar -rw-r--r-- 1 wkoszek wkoszek 2868316160 5 paź 17:04 Xilinx_11.1_WebPack_SFD.tar
There were numerous of reports about inability to install Xilinx ISE 11.1 on multiple systems, including Microsoft Windows and GNU/Linux. While writing this tutorial, several problems appeared as well. Most problems come from inappropriate archive file, which may get destroyed due to connection interruption. This is checksum of the correct file:
# md5 /home/wkoszek/Xilinx_11.1_WebPack_SFD.tar MD5 (/home/wkoszek/Xilinx_11.1_WebPack_SFD.tar) = 42ce70bd3f78e68295175db2441c8b3a # sha1 /home/wkoszek/Xilinx_11.1_WebPack_SFD.tar SHA1 (/home/wkoszek/Xilinx_11.1_WebPack_SFD.tar) =2b57b4fb00914e50d1b0a4d0a49e511ca56e85fb
While you're logged in your profile on Xilinx page, you need to point a mouse pointer to “File size” section in Download manager – small window will show up and checksum will be presented
Most of the problems come from the lack of checksum verification. Remember about it, since it can save you a lot of time.
Unpack the archive and change the directory:
# tar xf Xilinx_11.1_WebPack_SFD.tar # cd Xilinx_11.1_WebPack_SFD
Apart from xsetup, nice xinfo program is available for verifying,
that we can actually start X11 program in emulation, and we can observe
how our configuration actually look like:
# ./bin/lin/xinfo
Here's the exported information about my reference system: xinfo_ref9.txt]
Installation procedure
Having system and libraries prepared should let us to get the installer running:
# ./bin/lin/xsetup
And basically, ISE installation should be ready.
| On reference system..: {{electronics/fpga/freebsd_xilinx/thumb_13_ise.jpg}} |
FPGA processor programming
Once you have software tools working it would be quite nice to see that you can actually upload something to your FPGA board and see that it actually works. In terms of programming, two options exist:
A. You're Spartan 3e Starter Kit (S3ESK) user
B. You're other FPGA board user
B isn't documented here, because author doesn't have any bigger standalone FPGA board
Option A is quite comfortable, since this board is really popular and a lot of people has been dealing with it in UNIXish systems. The board, basically, has JTAG cable embedded in itself. It is based on Cypress FX2 chip (also known as EZ-USB). This is 8051 microcontroller dealing with USB communication. It supports reenumeration – processor implements special kind of protocol, letting a user to submit a code which is being used later to program the controller. Once it's finished, it detaches from USB bus and attaches back as a different, target device. Together with modularity, some problems exist. You have to have a software dealing with reenumeration. In order to save you some time, here is a brief background behind tools:
- Xilinx ISE brings native
libusbbased driver together with software installation i should really try to use this one
- before Xilinx ISE listened, where was a kernel driver that never worked for anyone, until a reverse engineered driver for GNU/Linux for
libusbappeared here: http://rmdir.de/~michael/xilinx/
- Probably first tool to program S3ESK out-of-IDE was http://www.rogerstech.force9.co.uk/xc3sprog/index.html, but you won't be really happy with it unless you use parallel port JTAG adapter with cable and JTAG IDC connector.
- Andrew Rogers' work has been extended by bringing USB support (libusb). Project is called XUP: http://inisyn.org/src/xup/
- Newest
xc3sprogcreated not so long ago lives in sourceforge as well; compiles under FreeBSD with minor tweaks; try it out, since it seems to support not only FX2-based cables
- There exists
fxloadfor Windows that deployslibusb: http://wiki.epfl.ch/cfavi/fxload-libusb. It can be trivially changed and compiled without problems on FreeBSD. Check if it works
- There's http://volodya-project.sourceforge.net/fx2_programmer.php working natively with libusb. test if it compiles and works'.
Ideas
* take information on the page http://rmdir.de/~michael/xilinx/, and try to create
TCP/IP enabled wrapper library for Linux; copy it on FreeBSD and implement FreeBSD-based
libusb client to programmer could be used.
This will result in having Xilinx ISE WebPack installed.
Script for Wiki link generation wiki_gen.sh Script for thumbnail generation thumb_gen.sh