Installation of Xilinx ISE 6.3 or ISE 7.1 under Linux (Kernel 2.6.9 / 2.6.11)

Content

Preface

This guide is based on the article FPGA-FAQ: How to get the Xilinx parallel cable to work on Linux kernels 2.6.x. System configuration: Linux Debian with kernel 2.6.9, self compiled.

If feasible you should install the latest version of ISE, because version 7.1 seems to have fixed the problem of system hang during synthesis process.

If you have any questions, suggestions or solutions, please send me a mail.

Installation of Xilinx ISE/EDK using Debian

The installation has to be executed as user root and you have to mount cdrom with executable rights. Do the following as user root:
apt-get install libmotif3 libcurl3
mount -o exec /cdrom
cd /cdrom/
export DISPLAY=:0
./setup
I have chosen /opt/xilinx as installation directory.

If you don't work with Red Hat Enterprise 3.0, Kernel 2.4, you better deselect Platform Cable USB Driver and Parallel Cable Drivers. That's what I did.

When the installation of disk 1 has finished, unmount it and go on with cd 2 and 3 the same way.

Afterwards I have installed the ISE Service Packe 3 (simply unpack and run setup).

EDK can be installed the same way.

ISE (and EDK) have the silly habit to save temporary files in the current working directory. So I have written a small shell script to load all nessessary shell variables (runs settings.sh) and to change to ~/.xilinx before starting ISE.
#!/bin/bash
############################
#     ISE start script     #
#                          #
#    by Stefan Endrullis   #
############################

# Please adapt these values to your system configuration.
XILINX_DIR=/opt/xilinx
# less importantly
XILINX_USER_DIR=~/.xilinx


### script begin ###

# create XILINX_USER_DIR if nessessary and change dir
if [ ! -d ${XILINX_USER_DIR} ]; then
mkdir ${XILINX_USER_DIR}
fi
cd ${XILINX_USER_DIR}

# load settings
. ${XILINX_DIR}/settings.sh

# start xilinx ise
${XILINX_DIR}/bin/lin/ise
And here the same for EDK, whereat setup.sh (code bellow) is a small script setting additional shell variables.
#!/bin/bash
############################
#     EDK start script     #
#                          #
#    by Stefan Endrullis   #
############################

# Please adapt these values to your system configuration.
XILINX_DIR=/opt/xilinx
EDK_DIR=/opt/edk
# less importantly
XILINX_USER_DIR=~/.xilinx


### script begin ###

# create XILINX_USER_DIR if nessessary and change dir
if [ ! -d ${XILINX_USER_DIR} ]; then
mkdir ${XILINX_USER_DIR}
fi
cd ${XILINX_USER_DIR}

# load settings
. ${XILINX_DIR}/settings.sh
. ${EDK_DIR}/setup.sh

# start xilinx ise
${EDK_DIR}/bin/lin/XPS_GUI
Code of setup.sh:
export XILINX_EDK=/opt/edk
export LD_LIBRARY_PATH=${XILINX_EDK}/bin/lin:${LD_LIBRARY_PATH}
export PATH=${XILINX_EDK}/bin/lin:${XILINX_EDK}/gnu/microblaze/lin/bin:\
${XILINX_EDK}/gnu/powerpc-eabi/lin/bin:${PATH}

Install WinDriver

First install the kernel sources for your running kernel.

You can download the WinDriver from http://www.jungo.com/dnload.html. This requires a free registration. Now you can unpack the file:
tar xzf WD700LN.tgz
cd WinDriver/redist
./configure
make
make install
In my case make install returns the following:
FATAL: Error inserting windrvr6 (/lib/modules/2.6.11stefan/kernel/drivers/misc/wi
ndrvr6.ko): Invalid module format
make: *** [install] Fehler 1
You can solve this problem by inserting the following line into the makefile:
CC=gcc-3.3
make install installs the driver, loads it, and creates the new device /dev/windrvr6. After creation it's owned by user root and nobody else has the right to access the device. If you want to use it as a normal user you have to set the rw-rights. In my case:
chown stefan:users /dev/windrvr6
chmod 660 /dev/windrvr6

Install the Xilinx driver

Kernel sources have to be installed.

Then do the following, but please check the patch against bad code:
wget ftp://ftp.xilinx.com/pub/utilities/fpga/linuxdrivers.tar.gz
wget http://stefan.endrullis.de/downloads/fpga/linuxdrivers.patch
tar xzf linuxdrivers.tar.gz
cd linuxdrivers
patch -Np1 <../linuxdrivers.patch
Now change to xpc4drvr and rename the old Xilinx makefile:
cd xpc4drvr
mv Makefile Makefile_old
Create a new makefile (name must be Makefile) with the following content (replace by tabulator):
RUN_VERSION=`uname -r`

KERNEL_SOURCE_DIR=/lib/modules/${RUN_VERSION}/build
MODULE_INSTALL_DIR=/lib/modules/${RUN_VERSION}/kernel/drivers/misc/

GCC_BIN=gcc-3.3

obj-m := xpc4drv.o
xpc4drv-objs := xpc4.o ioctl_3.a

1:
make CC=${GCC_BIN} -C ${KERNEL_SOURCE_DIR} M=`pwd`

default:
make CC=${GCC_BIN} -C ${KERNEL_SOURCE_DIR} M=`pwd` modules

install:
cp ./xpc4drv.ko ${MODULE_INSTALL_DIR}

help:
make CC=${GCC_BIN} -C ${KERNEL_SOURCE_DIR} M=`pwd` help

clean:
rm *.o *.mod.c *.ko

.PHONY: default
Thereafter:
make
insmod ./xpc4drv.ko
insmod does not print anything if successful. If you see an error message, e.g the following output
insmod: error inserting './xpc4drv.ko': -1 Invalid module format
you can get more helpful information by running dmesg | tail, e.g.:
xpc4drv: version magic '2.6.11 SMP preempt PENTIUM4 gcc-4.0' should be '2.6.11 SMP preempt PENTIUM4 gcc-3.3'
If dmesg | tail is printing xpc4drvr: init_module, the module was successfully loaded and you can install it:
make install

Register device at hotplug

cd path_to_ise_installation/bin/lin/
touch /etc/hotplug/usb.usermap
sh setup_pcusb
Unfortunately the script setup_pcusb failed to work on my system, therefore I did some modifications. Regrettably I don't remember what the modifications where.

If you want to put the XUP-board into operation using ISE 7.1, you should in accordance with the following article incorporate a small modification into /etc/hotplug/usb.usermap. I am not sure if this is still necessary with ISE 8.1, but in any case it seems not harmful. In particular you have to set the value of idProduct from 0x0007 to 0x0009. Maybe this is superfluous in newer versions of ISE.

Then I have restarted hotplug.
/etc/init.d/hotplug restart
Amongst other things the following was printed:
      xusbdfwu: loaded successfully
microcontroller type: fx2
single stage:  load on-chip memory
open RAM hexfile image usb/xusbdfwu.fw/xusbdfwu.hex
stop CPU
write on-chip, addr 0x1b2f len   10 (0x000a)
write on-chip, addr 0x0178 len   53 (0x0035)
write on-chip, addr 0x15fd len  112 (0x0070)
write on-chip, addr 0x1000 len  543 (0x021f)
...
write on-chip, addr 0x047a len  486 (0x01e6)
write on-chip, addr 0x1509 len  128 (0x0080)
write on-chip, addr 0x0479 len    1 (0x0001)
write on-chip, addr 0x0660 len  115 (0x0073)
... WROTE: 6934 bytes, 71 segments, avg 97
reset CPU
Well, we are happy that something happens at all, and the board was recognized.

Interestingly the Product id of the XUP board changes from 0x0009 to 0x0008 (verifiable with lsusb). And without this change the USB data transfer does not work for me.

USB transfer in iMPACT

iMPACT can be started directly ( path_to_ise_installation/bin/lin/impact) or from ISE.

After system restart you have to load both driver modules to be able to use USB transfer in iMPACT. Because this was not enough in my case, I have tried several combinations to find out in which order the modules have to be unloaded and loaded. And this USB init scipt is the result (adjust red markings):
#!/bin/bash
##############################
# USB init script for iMPACT #
#                            #
#     by Stefan Endrullis    #
##############################

VENDOR_ID=03fd
PRODUCT_ID=0008

##############################

# prevent hacking
PATH=/sbin:/bin:/usr/sbin:/usr/bin

rmmod xpc4drvr
rmmod windrvr6

modprobe windrvr6
chown stefan:users /dev/windrvr6
chmod 660 /dev/windrvr6
modprobe xpc4drvr

echo -n "Please turn on the board."
while [ `lsusb -d "$VENDOR_ID:$PRODUCT_ID" | wc -l` != "1" ]; do
  printf ".";
  sleep 1;
done
echo "OK"

echo -n "Initialising USB devices..."
/etc/hotplug/usb.rc restart
echo "OK"

After running the script the USB transfer should work.

The best way to test whether the board is reachable is to select Cable Auto Connect in the menu Output. If the connection could not be established, you can look into the log of iMPACT by clicking View->View Log File. Here you can get useful information like...
Connecting to cable (Usb Port - USB21).
Checking cable driver.
File version of /opt/xilinx/bin/lin/xusbdfwu.hex = 1018(dec), 03FA.
File version of /etc/hotplug/usb/xusbdfwu.fw/xusbdfwu.hex = 1018(dec), 03FA.
 Cannot access /dev/windrvr6 - Permission denied.
Cable connection failed.
If you find the following in the log,
Connecting to cable (Usb Port - USB21).
Checking cable driver.
File version of /opt/xilinx/bin/lin/xusbdfwu.hex = 1018(dec), 03FA.
File version of /etc/hotplug/usb/xusbdfwu.fw/xusbdfwu.hex = 1018(dec), 03FA.
Cable connection failed.
I suggest you to run the USB init scipt again and then try to use iMPACT.

If you are working with the EDK, then the fastest way to perform the USB transfer is to run make -f system.make download from your project directory. In advance you have to run the Xilin setup scripts in order to setup the PATH variable for iMPACT and the other programs. The following script settings.sh does the job:
#!/bin/bash

. /opt/ise/settings.sh
. /opt/edk/setup.sh
. /opt/edk/settings.sh
You only have to run . settings.sh and everything will be configured. The dot may not be left out. It guaranties that the variables, set by the script, are taken over by the shell.

Note: You can use lsusb to list all attached USB devices. Since I use the XUP board, it gives me the following output:
Bus 002 Device 008: ID 03fd:0008 Xilinx, Inc.
If the connection with iMPACT fails, you should check whether the device can be found by lsusb. It seems that the board switches itself off after some idle time. Then it helps to turn it off and on again. Afterwards lsusb should list it again.

FAQ

Q: When running ./setup I get the following error message:
/cdrom/platform/lin/bin/lin
/cdrom/platform/lin/xilsetup: error while loading shared libraries: libXm.so.3: cannot open shared object file: No such file or directory


************ setup done! ***************
A: libXm.so.3 is within the Debian package libmotif3 (apt-get install libmotif3 libcurl3).

Q: When running make -f system.make download I get the following error message:
make -f system.make download

*********************************************
Downloading Bitstream onto the target board
*********************************************
impact -batch etc/download.cmd
make: impact: Command not found
make: *** [download] Fehler 127
A: The system variables are not set. You can call . settings.sh to solve the problem.