Xilinx USB II Cable driver under Gentoo Linux

P

Petter Gustad

Guest
I'm looking for pointers to an installation guide on how to install
the Xilinx USB II Cable driver under Gentoo Linux?

I just took a quick look at the installation script(1) and found
checks for specific releases (grep -c -i "SUSE" /proc/version) rather
than checks for functionality and features, which is a bad thing when
it comes to portability across distributions. Also a quick ./configure
and make resulted in lots of warnings and errors. Hence I wanted to
know if anybody else have walked up this path already.

I checked http://en.gentoo-wiki.com/ which seem to be down, at least I
get only a blank page.


1)https://secure.xilinx.com/webreg/clickthrough.do?cid=103670&license=RefDesLicense&filename=install_drivers.tar.gz

//Petter
--
..sig removed by request.
 
On Wed, 02 Nov 2011 14:57:07 +0100, Petter Gustad wrote:

I'm looking for pointers to an installation guide on how to install the
Xilinx USB II Cable driver under Gentoo Linux?

I just took a quick look at the installation script(1) and found checks
for specific releases (grep -c -i "SUSE" /proc/version) rather than
checks for functionality and features, which is a bad thing when it
comes to portability across distributions. Also a quick ./configure and
make resulted in lots of warnings and errors. Hence I wanted to know if
anybody else have walked up this path already.

I checked http://en.gentoo-wiki.com/ which seem to be down, at least I
get only a blank page.


1)https://secure.xilinx.com/webreg/clickthrough.do?
cid=103670&license=RefDesLicense&filename=install_drivers.tar.gz

//Petter
You don't want to use the WinDrvr that Xilinx provides, it doesn't work
for any modern kernel. Set the following variable in your shell before using chipscope or impact

setenv XIL_IMPACT_USE_LIBUSB 1

Then do the following setup (this for Redhat)

#!/bin/csh -f
yum -y install libusb libusb1 fxload
cp $XILINX/bin/lin64/*.hex /usr/share
cd /usr/lib64
ln -s libusb-1.0.so.0.0.0 libusb.so
cp setup_pcusb $XILINX/bin/lin64
setup_pcusb
xusbdfwu.rules /etc/udev/rules.d

-------------------------------
xusbdfwu.rules
# version 0003
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0008", MODE="666"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $tempnode"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="03fd", ATTR{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $tempnode"

-------------------------------
setup_pcusb

#!/bin/sh
# Copyright (c) 2005 Xilinx, Inc. All rights reserved.
#
# Xilinx, Inc.
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
# COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
# ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE.
#

TP_PCUSB_HEX_FILE="xusbdfwu.hex"

TP_KERNEL_VERSION=`uname -r`
# check if udev is running on version 2.6.13* and later
TP_MAJOR_VERSION=`echo $TP_KERNEL_VERSION | cut -f 1 -d "."`
TP_MINOR_VERSION=`echo $TP_KERNEL_VERSION | cut -f 2 -d "."`
TP_MINOR_SUBVERSION=`echo $TP_KERNEL_VERSION | cut -f 3 -d "." | cut -f 1 -d "-"`

#TP_USE_UDEV="0"
#TP_UDEV_ENABLED=`ps -e | grep -c udevd`
TP_UDEV_ENABLED="1"

if [ $TP_MAJOR_VERSION = "2" ]
then
if [ $TP_MINOR_VERSION = "6" ]
then
test $TP_MINOR_SUBVERSION -ge "13"
if [ $? = "0" ]
then
if [ $TP_UDEV_ENABLED = "1" ]
then
TP_USE_UDEV="1"
fi;
fi;
fi;
fi;

# $1 - destination directory
# $2 - driver name
update_hex_file ()
{
TP_INSTALL_DRIVER="1" # default to install
#TP_DRV_SRC_PATH="/etc/hotplug/usb/xusbdfwu.fw"
TP_DRIVER_FILE=$1/$2
get_hex_file_version $TP_DRIVER_FILE
if [ $? = "1" ]
then
TP_DEST_VERSION=$TP_DRIVER_VER
TP_DRIVER_FILE=$2
get_hex_file_version $TP_DRIVER_FILE
TP_SRC_VERSION=$TP_DRIVER_VER
if [ $TP_DEST_VERSION -lt $TP_SRC_VERSION ]
then
echo "--File $TP_DRIVER_FILE is newer than the destination file."
else
echo "--File $TP_DRIVER_FILE is already updated."
TP_INSTALL_DRIVER="0"
fi;
else
echo "--Error getting file version for $TP_DRIVER_FILE."
fi;

if [ $TP_INSTALL_DRIVER = "1" ]
then
echo "--Updating $2 file."
# Copy hex file to the fw directory.
mkdir -p $1
/bin/cp -p $2 $1
fi;
}

update_usermap ()
{
TP_ID_PRESENT=`cat /etc/hotplug/usb.usermap | grep xusbdfwu | grep -i -c $1`
if [ $TP_ID_PRESENT = "0" ]
then
echo "--Adding Product ID $1 to the usermap."
echo "xusbdfwu 0x0003 0x03fd 0x$1 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000" >> /etc/hotplug/usb.usermap
else
echo "--Product ID $1 is already in the usermap."
fi;
}

file_exists ()
{
if [ -f $1 ]
then
echo "--File $1 exists."
return 1
else
echo "--File $1 does not exist."
return 0
fi;
}

get_hex_file_version ()
{
TP_DRIVER_VER="0000"
file_exists $1
if [ $? = "1" ]
then
TP_VERSION_STRING=`grep ":0219B900" $1`
#TP_HEX_VERSION=`expr substr $TP_VERSION_STRING 10 4`
TP_HEX_VERSION=${TP_VERSION_STRING:9:4}
TP_DRIVER_VER=`printf "%d" 0x$TP_HEX_VERSION`
echo "--File $1 version = "$TP_DRIVER_VER
return 1
else
return 0
fi;
}

# arg1 = file, arg2 = version string
get_rules_file_version ()
{
TP_DRIVER_VER="0000"
file_exists $1
if [ $? = "1" ]
then
TP_VER_STR_LINE=`cat $1 | grep "$2"`
TP_DRIVER_VER=${TP_VER_STR_LINE:10:4}
echo "--File $1 version = "$TP_DRIVER_VER
return 1
else
return 0
fi;
}

if [ $TP_USE_UDEV = "0" ]
then
update_hex_file /etc/hotplug/usb/xusbdfwu.fw xusbdfwu.hex
update_hex_file /etc/hotplug/usb/xusbdfwu.fw xusb_xlp.hex
update_hex_file /etc/hotplug/usb/xusbdfwu.fw xusb_emb.hex
update_hex_file /etc/hotplug/usb/xusbdfwu.fw xusb_xpr.hex
update_hex_file /etc/hotplug/usb/xusbdfwu.fw xusb_xup.hex
update_hex_file /etc/hotplug/usb/xusbdfwu.fw xusb_xp2.hex
update_hex_file /etc/hotplug/usb/xusbdfwu.fw xusb_xse.hex

# Copy loader script file to the usb directory.
/bin/cp -p xusbdfwu /etc/hotplug/usb
chmod 775 /etc/hotplug/usb/xusbdfwu
/bin/cp -p xusb_xlp /etc/hotplug/usb
chmod 775 /etc/hotplug/usb/xusb_xlp
/bin/cp -p xusb_emb /etc/hotplug/usb
chmod 775 /etc/hotplug/usb/xusb_emb
/bin/cp -p xusb_xpr /etc/hotplug/usb
chmod 775 /etc/hotplug/usb/xusb_xpr
/bin/cp -p xusb_xup /etc/hotplug/usb
chmod 775 /etc/hotplug/usb/xusb_xup
/bin/cp -p xusb_xp2 /etc/hotplug/usb
chmod 775 /etc/hotplug/usb/xusb_xp2
/bin/cp -p xusb_xse /etc/hotplug/usb
chmod 775 /etc/hotplug/usb/xusb_xse

# Add entries to usermap
update_usermap "0007"
update_usermap "0009"
update_usermap "000d"
update_usermap "000f"
update_usermap "0013"
update_usermap "0015"

update_usermap "0008"

else

update_hex_file /usr/share xusbdfwu.hex
update_hex_file /usr/share xusb_xlp.hex
update_hex_file /usr/share xusb_emb.hex
update_hex_file /usr/share xusb_xpr.hex
update_hex_file /usr/share xusb_xup.hex
update_hex_file /usr/share xusb_xp2.hex
update_hex_file /usr/share xusb_xse.hex

TP_INSTALL_DRIVER="1"
TP_DRIVER_FILE="/etc/udev/rules.d/xusbdfwu.rules"
get_rules_file_version $TP_DRIVER_FILE "# version"
if [ $? = "1" ]
then
TP_DEST_VERSION=$TP_DRIVER_VER
TP_DRIVER_FILE="xusbdfwu.rules"
get_rules_file_version $TP_DRIVER_FILE "# version"
TP_SRC_VERSION=$TP_DRIVER_VER
if [ $TP_DEST_VERSION -lt $TP_SRC_VERSION ]
then
echo "--File $TP_DRIVER_FILE is newer than the destination file."
else
echo "--File $TP_DRIVER_FILE is already updated."
TP_INSTALL_DRIVER="0"
fi;
else
echo "--Error getting file version for $TP_DRIVER_FILE."
fi;

if [ $TP_INSTALL_DRIVER = "1" ]
then
echo "--Updating rules file."
/bin/cp -p xusbdfwu.rules /etc/udev/rules.d
fi;
fi;

# End of file.
 
General Schvantzkoph <schvantzkoph@yahoo.com> writes:

You don't want to use the WinDrvr that Xilinx provides, it doesn't work
for any modern kernel. Set the following variable in your shell before using chipscope or impact

setenv XIL_IMPACT_USE_LIBUSB 1

Then do the following setup (this for Redhat)
Thank you for the script. I don't seem to have a libusb1 on Gentoo,
but I'll try to walk through the script and see if I can get it to
work.

I also noticed that there's a similar approach described at:

http://www.george-smart.co.uk/wiki/Xilinx_JTAG_Linux

But the driver fails to compile since it can't find a 32-bit ibftdi on
my 64-bit system...

//Petter
--
..sig removed by request.
 
On 11/03/11 09:19, Petter Gustad wrote:
General Schvantzkoph <schvantzkoph@yahoo.com> writes:

You don't want to use the WinDrvr that Xilinx provides, it doesn't work
for any modern kernel. Set the following variable in your shell before using chipscope or impact

setenv XIL_IMPACT_USE_LIBUSB 1

Then do the following setup (this for Redhat)
If you use ISE newer than 11 you don't even have to set the
XIL_IMPACT_USE_LIBUSB variable. Just make sure you have a symlink
/lib/libusb.so to your actual libusb-[version].so file.
Then make sure you have the xusbdwfu.rules from $XILINX/ISE/bin/lin64/
at /etc/udev/rules.d/, fxload installed and the *.hex files from
$XILINX/ISE/bin/lin64/ copied to /usr/share/.

This works fine for me with Gentoo and dev-libs/libusb from portage for
any recent ISE version.

HTH
 
rndhro <rnd@hro.org> writes:

On 11/03/11 09:19, Petter Gustad wrote:
General Schvantzkoph <schvantzkoph@yahoo.com> writes:

You don't want to use the WinDrvr that Xilinx provides, it doesn't work
for any modern kernel. Set the following variable in your shell before using chipscope or impact

setenv XIL_IMPACT_USE_LIBUSB 1

Then do the following setup (this for Redhat)

If you use ISE newer than 11 you don't even have to set the
Thanks. I'm using v13.3i. I got it working now.

XIL_IMPACT_USE_LIBUSB variable. Just make sure you have a symlink
/lib/libusb.so to your actual libusb-[version].so file.
BTW, I don't like to replace system wide so files. I prefer to do
something like:

mkdir ~/libusb
ln -s /usr/lib/libusb-1.0.so.0.0.0 ~/libusb/libusb.so
LD_LIBRARY_PATH=~/libusb:$LD_LIBRARY_PATH impact

//Petter
--
..sig removed by request.
 

Welcome to EDABoard.com

Sponsor

Back
Top