Monday, December 6, 2010

Xilinx Coolrunner II & Xubuntu

After a few days wait the Xilinx Coolrunner II kit arrived in the post.


The Coolrunner is a CPLD which contains Macrocells, which are a step up from the basic gate array of a PLD and the XC2C256 on this board has 256 macrocells configured via an interconnect matrix.


Xilinx provide a programming suite, ISE, which is available for Windows and Linux. However they don't directly support Ubuntu. 


Here is a brief howto to get the ISE running on  Xubuntu.


The main hurdle with the ISE is that it requires a USB driver,  windrvr6, in order to use the Platform cable (DLC9G). However it is possible to configure Xubuntu to use libusb and to get the programming tool, iMPACT, to use this instead.


1.Install prerequisites..


apt-get fxload
apt-get libusb


2. Configure the udev rules


These load the correct hex file when the device is attached.


jamesb@Jalapeno:~$ cat /etc/udev/rules.d/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"


3. Install the hex files.


These can be found in the ${XILINX}/ISE/bin/lin directory.


jamesb@Jalapeno:~$ ls -al /usr/share/*.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusbdfwu.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusbdfwu.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_emb.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_emb.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xlp.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xlp.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xp2.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xp2.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xpr.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xpr.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xse.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xse.hex
lrwxrwxrwx 1 root root 48 2010-12-05 21:32 /usr/share/xusb_xup.hex -> /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/xusb_xup.hex




You can use ln -s to create the symlinks..



4. Setup some scripts to start up ISE and IMPACT


 jamesb@Jalapeno:~/bin$ cat ise
#!/bin/bash

source /opt/Xilinx/12.3/ISE_DS/settings32.sh
export XIL_IMPACT_USE_LIBUSB=1
XIL_IMPACT_USE_LIBUSB=1 /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/ise &





#!/bin/bash

source /opt/Xilinx/12.3/ISE_DS/settings32.sh
export XIL_IMPACT_USE_LIBUSB=1
XIL_IMPACT_USE_LIBUSB=1 /opt/Xilinx/12.3/ISE_DS/ISE/bin/lin/impact &



So, assuming that worked, plug in the platform cable and you should get an orange light.. you're good to go!


I suppose I'd better go off and write some code now.. byee..




My environment :-


Xubuntu  10.10
Linux Jalapeno 2.6.35-23-generic #41-Ubuntu SMP Wed Nov 24 10:18:49 UTC 2010 i686 GNU/Linux
Xilinx_ISE_DS_Lin_12.3_M.70d.1.0 in /opt/Xilinx/12.3/ISE_DS/
Platform Cable DLC9G


Linky :-


http://www.xilinx.com/support/download/index.htm
http://www.xilinx.com/support/documentation/coolrunner-ii.htm


YMMV etc.

No comments:

Post a Comment