2012-03-21

Installing Xilinx ISE under Linux

One of the tasks when starting with CPLD (or FPGA) development is to install the tool suite provided by the chip vendor. In the case of the XC9572XL this is the Xilinx ISE software. Xilinx provides a free WebPack version, which contains all the basic tools needed for the first designs.

On my initial test, I installed ISE 12.2, since I had in on a DVD somewhere. But for every start, it printed the error ‘couldn’t load XPCOM’, and some views weren’t working. So I started investigating. One of the things I wanted to make sure was that the installed version supported the Xilinx Parallel JTAG Cable III (a.k.a. DLC5), since I intended to build one. So I downloaded an older ISE version from Xilinx (10.1), and installed that one. Its release notes didn’t mention the DLC5, but the iMPACT tool (which is used for programming the CPLD) knows about it. This meant that the documentation was no reliable way to find out whether a version supports that cable or not - I needed to install them.

So I downloaded ISE 13.4, and installed it too. And lo’ and behold - it also knows about this cable type. It also looked better that the older ones (which were sometimes really ugly) and seemed easier to use. But it still reported some strange errors (about ‘cannot load XPCOM’ and the like), and still some things did not work. The installation needs to be run as root, btw.

First I tested whether it makes a difference to run it as user vs. root - nope. The I tried to preload the XPCOM libraries of Firefox since it seemed to to find them. This helped, but now I got errors about a wrong version of libstdc++ - strange. As last resort, I did run the program under strace, and looked which libraries are searched in which places (ISE WebBench provides many libraries in its own version). It turns out that ISE wanted to start a Firefox, but it changes the environment so Firefox cannot find its libraries. And when I changed the ISE environment to make Firefox work, ISE didn’t.

The solution is to create my own start script for Firefox, which sets the proper environment, and tell ISE to use this one. The script looks like:

#!/bin/sh
# reset the library path
LD_LIBRARY_PATH=/usr/lib/gcc/i686-linux-gnu/4.6:/usr/lib/gcc/i686-linux-gnu/4.4:/usr/lib/firefox-10.0.2:/lib:/usr/lib:/usr/lib/i386-linux-gnu/:/lib/i386-linux-gnu:/usr/lib/firefox-10.0.2
# first look for an running instance
# if none can be found, create one.
/usr/bin/firefox -a any -remote "openURL($1,new-tab)" || /usr/bin/firefox $1

But since ISE insists on running as root (at least in my case, it might be possible to change the permissions to make it run as normal user), one needs to set a new $HOME, because Firefox otherwise complains that it cannot write to its .mozilla directory (because it’s run as root too). So we need a special starter for ISE too. But this is no big hassle, and we need one for the cable drivers anyway.

Xilinx provides its own peripheral drivers for its USB and parallel cables, but the run only under the supported Linux distributions (and Kubuntu is not supported). But there is a solution in the form of the drivers on Michaels pages. Just download them, compile them and preload them in the start script:

#!/bin/sh
# fix $DISPLAY so ISE doesn't complain
export DISPLAY=`echo $DISPLAY | sed 's/\.[0-9]*$//'`
# set $HOME so FireFox doesn't complain (and we avoid to accidentally breaking the users instance)
export HOME=/opt/Xilinx
# preload ISE config
source /opt/Xilinx/13.4/ISE_DS/settings32.sh
# preload drivers
export LD_PRELOAD=/opt/Xilinx/usb-driver-HEAD-2d19c7c/libusb-driver.so
# and run ISE
/opt/Xilinx/13.4/ISE_DS/ISE/bin/lin/ise

When using this script, one can use all tools (including the iMPACT programming tool) directly from ISE. When running iMPACT initially, choose to setup the cable automatically (make sure it is connected), and it will be configured properly).

When you get messages about “cable locked” or so, call iMPACT in batch mode to clear these locks.

If you want to run iMPACT manually, use the following script:

#!/bin/sh
export LD_PRELOAD=/opt/Xilinx/usb-driver-HEAD-2d19c7c/libusb-driver.so
/opt/Xilinx/13.4/ISE_DS/ISE/bin/lin/impact $*

If you don’t want to build a parallel cable, you can skip all this driver and pre-load stuff, and use iMPACT for just generating XSVF files. A good work-flow was to start iMPACT once and set the project up, and then create a XSVF file each time when the main ISE tool has finished its synthesis (just right-click on the shown CPLD, ‘create XSVF’, and it will ask for reloading the source file).

One drawback of the newer versions is their disk usage. Where 10.1 uses about 2 GB, 12.2 takes 4 and 13.4 about 7 GB. And one cannot just install only parts of that, or remove them afterwards (the tools just complain that they need them). The only parts I could remove were all the IP cores, which saved at least one GB.

Update

Since I wrote this post, I re-installed my Linux to move over to the 64-bit version of Kubuntu. Doing so required me to re-install also the Xilinx ISE tools. During that, I found out that all the special configuration for ISE is not needed anymore. I installed ISE 12.4, and it worked right from the beginning. The only issue I had was that it didn’t remember the last project on startup. The reason for that is that somehow the directory ~/.config/Xilinx gets created with root as owner. I changed that to my user, and everything was fine.

The cable driver gets compiled automatically into a 64-bit version, and works out-of-the-box too. I just needed to start the 64-bit version of iMPACT too. Don’t forget to add your user to the groups needed for parallel port access (‘lp’ in my case), otherwise it would need to be started as root.

Update 2

I also wrote a small introduction into using iMPACT in batch mode.

Posted by Hendrik Lipka at 2012-03-21 (Google)
Categories: software electronics fpga