quarta-feira, 1 de maio de 2013

Install Xilinx USB Cable Drivers 14.7 on Debian GNU/Linux Wheezy

For this installation we will not use the provided setup_usb script from Xilinx, because it makes the installation of the scripts in /etc/hotplug which were substituted by udev.
To start let us install the following packages
apt-get install fxload libusb-0.1-4 libusb-dev

After this take a look at the rules file provided by xilinx
cat /opt/Xilinx/14.7/ISE_DS/common/bin/lin64/xusbdfwu.rules

# version 0003
SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0008", MODE="666"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0007", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusbdfwu.hex -D $TEMPNODE"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0009", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xup.hex -D $TEMPNODE"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000d", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_emb.hex -D $TEMPNODE"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="000f", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xlp.hex -D $TEMPNODE"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0013", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xp2.hex -D $TEMPNODE"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03fd", SYSFS{idProduct}=="0015", RUN+="/sbin/fxload -v -t fx2 -I /usr/share/xusb_xse.hex -D $TEMPNODE"
As for the rules for rules file creation, i created a copy of the which consisted, on removing BUS=="usb , replacing SYSFS by ATTRS and $TEMPNODE by $tempnode. To do this let's use sed:
sed /opt/Xilinx/14.7/ISE_DS/common/bin/lin64/xusbdfwu.rules -e 's:BUS=="usb", ::g' -e 's:SYSFS:ATTRS:g' -e 's:TEMPNODE:tempnode:g' > /etc/udev/rules.d/xusbdfwu.rules
Now let's copy the usb firmware to the expected location (/usr/share), so udev can load the appropriate firmware to the device.
cp /opt/Xilinx/14.7/ISE_DS/common/bin/lin64/xusb*.hex /usr/share/
Let's restart udev.
/etc/init.d/udev restart
Now connect your device to the computer. If everything went okay the device enumeration should go this way:
kernel: [36003.892056] usb 2-1: new high-speed USB device number 4 using ehci_hcd
kernel: [36004.024493] usb 2-1: New USB device found, idVendor=03fd, idProduct=000d
kernel: [36004.024499] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
kernel: [36004.084649] usb 2-1: USB disconnect, device number 4
kernel: [36006.272080] usb 4-1: new full-speed USB device number 3 using uhci_hcd
kernel: [36006.411949] usb 4-1: not running at top speed; connect to a high speed hub
kernel: [36006.433946] usb 4-1: New USB device found, idVendor=03fd, idProduct=0008
kernel: [36006.433952] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: [36006.433956] usb 4-1: Product: XILINX    
kernel: [36006.433959] usb 4-1: Manufacturer: XILINX 
kernel: [36009.256112] usb 4-1: USB disconnect, device number 3
kernel: [36010.812067] usb 2-1: new high-speed USB device number 6 using ehci_hcd
kernel: [36010.944863] usb 2-1: New USB device found, idVendor=03fd, idProduct=0008
kernel: [36010.944869] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: [36010.944874] usb 2-1: Product: XILINX    
kernel: [36010.944877] usb 2-1: Manufacturer: XILINX 
What happens is that after the device is enumerated the udev loads the firmware into it through fxload, after that it gets enumerated and then it restarts it.So just after the second disconnect (third enumeration) the device is ready to used.
You will also need to create a link for the shared library, because impact will search for libusb in /usr/lib64/ and the libusb is installed on /usr/lib/x86_64-linux-gnu/
cd /usr/lib64/
ln -s ../lib/x86_64-linux-gnu/libusb-0.1.so.4 libusb.so
i also corrected the package names.

quinta-feira, 21 de março de 2013

Step by step guide to install Xilinx 14.7 on Debian GNU/Linux Wheezy

Installation performed on Debian wheezy

Download Xilinx_ISE_DS_Lin_14.7_1015_1.tar from Xilinx website.
Perform the following steps.
tar -xf Xilinx_ISE_DS_Lin_14.7_1015_1.tar 
cd Xilinx_ISE_DS_Lin_14.7_1015_1/
sudo ./xsetup

The installation is very easy, install everything under /opt.
To set the enviroment variables let's edit the ~/.bashrc and add the following at the end.
##Definições Xilinx
export LM_LICENSE_FILE="PORT@IP"
In this case i set the LM_LICENSE_FILE on the .bashrc because i am using a floating license, and in linux i can't use the xilinx license manager(xlcm) to set this variable(you can in windows). If you use a license file you can still use the xilinx license configuration manager.
when you want to run xps, ise or chipscope , or others, before run (Sh,Bash, ksh):
source /opt/Xilinx/14.7/ISE_DS/settings64.sh
There is a alternate version of script for c-shell in the same folder.
I am using settings64.sh since i am using a 64 bit OS, case you are using a 32 bit OS, use settings32.sh