Xilinx Driver Installation in Fedora 19

Pre-requisit Packages

  • GCC Compiler
    You can install with command
    $sudo yum install gcc make
  • libusb development package
    In order to compile usb driver library for Xilinx Tools, libusb development package needed to be installed. It can be installed via command
    $sudo yum install libusb libusb-devel
  • fxload package
    fxload package can be installed via command
    $sudo yum install fxload
  • git
    git is used to download libusb-driver source code from a public git repository. git can be installed via command
    $sudo yum install git

Install pcusb driver

In this blog, Xilinx 14.6 is used as an example. In Xilinx 14.6 package, the pcusb installation script has not been updated to work with 3.x kernels. So, we need to modify install pcusb installation script a bit to use udev no matter what.

Open pcusb setup script “setup_pcusb” under <Xilinx_ISE_DS_DIR>/ISE/bin/lin64/install_script/install_drivers/linux_drivers/pcusb
[tinghui.wang@localhost ~]$cd /opt/Xilinx/14.6/ISE_DS/ISE/bin/lin64/install_script/install_drivers/
linux_drivers/pcusb/

[tinghui.wang@localhost pcusb]$ sudo vim setup_pcusb
[sudo] password for tinghui.wang:

Assign TP_USE_UDEV to 1 by inserting TP_USE_UDEV="1" after kernel version checking as follows:
45 else
46 TP_USE_UDEV=$1
47 fi;
48
49 TP_USE_UDEV="1"
50
51 if [ $TP_USE_UDEV = "1" ]
52 then
53 echo "--Using udev..."
54 fi;

Then install pcusb driver by typing following in the terminal:
[tinghui.wang@localhost pcusb]$ sudo ./setup_pcusb
--Using udev...
--File /usr/share/xusbdfwu.hex does not exist.
--File version of /usr/share/xusbdfwu.hex = 1030
--Updating xusbdfwu.hex file.
--File /usr/share/xusb_xlp.hex does not exist.
--File version of /usr/share/xusb_xlp.hex = 0000.
--Updating xusb_xlp.hex file.
--File /usr/share/xusb_emb.hex does not exist.
--File version of /usr/share/xusb_emb.hex = 0000.
--Updating xusb_emb.hex file.
--File /usr/share/xusb_xpr.hex does not exist.
--File version of /usr/share/xusb_xpr.hex = 0000.
--Updating xusb_xpr.hex file.
--File /usr/share/xusb_xup.hex does not exist.
--File version of /usr/share/xusb_xup.hex = 0000.
--Updating xusb_xup.hex file.
--File /usr/share/xusb_xp2.hex does not exist.
--File version of /usr/share/xusb_xp2.hex = 0000.
--Updating xusb_xp2.hex file.
--File /usr/share/xusb_xse.hex does not exist.
--File version of /usr/share/xusb_xse.hex = 0000.
--Updating xusb_xse.hex file.
--File /etc/udev/rules.d/xusbdfwu.rules does not exist.
--File version of /etc/udev/rules.d/xusbdfwu.rules = 0000.
--Updating rules file.

Install Digilent Driver Files

To let Xilinx iMPACT work with Digilent boards, we need to install Digilent plugin. Digilent plugin comes with Xilinx Design Suite, located at <Xilinx_ISE_Suite>/ISE/bin/lin64/digilent/
[tinghui.wang@localhost ~]$ cd /opt/Xilinx/14.6/ISE_DS/ISE/bin/lin64/digilent/
[tinghui.wang@localhost digilent]$ sudo ./install_digilent.sh

Modify Udev Rules

In Fedora 19, the syntax for udev rules has been updated. So, we need to modify the rule files as well. Here is the /etc/udev/rules.d/xusbdfwu.rules
1 # version 0003
2 ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0008", MODE="666"
3 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode"
4 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode"
5 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode"
6 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode"
7 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode"
8 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="03fd", ATTRS{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode"

In /etc/udev/rules.d/52-digilent-usb.rules, 38 ATTRS{idVendor}=="1443", MODE:="666" 39 ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{manufacturer}=="Digilent", MODE="666", RUN+="/usr/local/sbin/dftdrvdtch %s{busnum} %s{devnum}"
You also need to create a third acl rule file to auto change the mode of the device. The one I created is named
1 ENV{MAJOR}=="", GOTO="acl_end"
2 ENV{ACL_MANAGE}=="0", GOTO="acl_end"
3 ACTION!="add|change", GOTO="acl_apply"
4
5 SUBSYSTEM=="usb", ATTRS{idVendor}=="03fd", ATTR{idProduct}=="0008", ENV{ACL_MANAGE}="1"
6
7 # apply ACL for all locally logged in users
8 LABEL="acl_apply", ENV{ACL_MANAGE}=="1", TEST=="/var/run/ConsoleKit/database", \
9 RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}"
10
11 LABEL="acl_end"
12 #

Compile libusb-driver.so for Xilinx Tools

Download libusb-driver source files from git://git.zerfleddert.de/usb-driver
[tinghui.wang@localhost Downloads]$ git clone git://git.zerfleddert.de/usb-driver
Cloning into 'usb-driver'...
remote: Counting objects: 751, done.
remote: Compressing objects: 100% (525/525), done.
remote: Total 751 (delta 455), reused 412 (delta 226)
Receiving objects: 100% (751/751), 129.08 KiB | 117.00 KiB/s, done.
Resolving deltas: 100% (455/455), done.

Get into usb-driver folder. Run make to compile libusb-driver.so:
[tinghui.wang@localhost usb-driver]$ make cc -Wall -fPIC -DUSB_DRIVER_VERSION="\"2013-09-10 22:28:10\"" usb-driver.c xpcu.c parport.c config.c jtagmon.c -o libusb-driver.so -ldl -lusb -lpthread -shared parport.c: In function 'parport_transfer': parport.c:21:23: warning: variable 'last_pp_write' set but not used [-Wunused-but-set-variable] static unsigned char last_pp_write = 0; ^ cc -DDEBUG -Wall -fPIC -DUSB_DRIVER_VERSION="\"2013-09-10 22:28:10\"" usb-driver.c xpcu.c parport.c config.c jtagmon.c -o libusb-driver-DEBUG.so -ldl -lusb -lpthread -shared Built library is 64 bit. Run `make lib32' to build a 32 bit version [tinghui.wang@localhost usb-driver]$
Ignore all the warnings, and you will see libusb-driver.so under the folder.

Environment Settings

We need to use libusb-driver.so for iMPACT, so we specify LD_PRELOAD environment variable. You can do this in .bashrc environment setting file or export it before using iMPACT.
export LD_PRELOAD="~/Download/usb-driver/libusb-driver.so"

Advertisements

One thought on “Xilinx Driver Installation in Fedora 19

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s