{ ^_^ } sinustrom Solving life, one problem at a time!

Setting up Gentoo for the Atlys FPGA Development board

Author: Zoltan Puskas
Categories: electronics linux

Having bought an Atlys FPGA development board I wanted to use it with my existing computer setups. Most vendors support Windows out of the box and usually some RPM based distribution, mostly Red Hat. Sometimes they even might support a DEB based distribution like Debian or Ubuntu. So here is how you can make it work with your Gentoo setup.

This little how-to is intended to document how to prepare a Gentoo (~amd64) system for FPGA development using a Digilent Atlys Spartan-6 FPGA development board using Xilinx ISE Webpack and other tools.

Installing Exar Serial Drivers

Get the appropriate driver for your kernel version from Exar. Unpack vizzini module to /usr/src (you will need to rebuild and install the module every time you have a new kernel version anyhow) and build it.

# unzip -d /usr/src xr21v141x-lnx-*.zip
# make && make modules_install

Since the board is not always connected to the computer there is no need to have the module loaded all the time (using the /etc/modprobe.d/ infrastructure). Loading the vizzini module on demand can be done through udev. Create the following udev rule as /etc/udev/rules.d/51-vizzini-usbserial.rules:

ATTRS{idVendor}=="04e2", MODE="666"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="04e2", ATTRS{idProduct}=="1410", RUN+="/sbin/modprobe -b vizzini"

There should now be a /dev/ttyUSB0 serial device whenever you connect the Atlys board using the UART USB plug.

Installing Digilent Adept tools

Before installing Digilent Adept tools you must install the dependencies:

# emerge libusb libftd2xx

Get the packages from Digilent and unpack them:

# ls digilent.adept.* | xargs -I FILE tar -xvf "FILE"

Enter each directory and install them using the install.sh scripts. The installation should finish successfully. If it asks whether rewrite libfdt2xx.so or not, choose no.

Older adept tools fail to detect udev and will install the hotplug related stuff instead. Since most of us don’t use hotplug anymore, just remove that stuff and install the udev rules from the adept runtime directory.

# rm -rf /etc/hotplug/usb/digilentusb rm /etc/hotplug/usb.usermap
# cp 52-digilent-usb.rules /etc/udev/rules.d/
# chown root:root /etc/udev/rules.d/52-digilent-usb.rules
# chmod -x /etc/udev/rules.d/52-digilent-usb.rules

The udev rule /etc/udev/rules.d/52-digilent-usb.rules has to be fixed since it is outdated.

ATTRS{idVendor}=="1443", MODE="666"
ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{manufacturer}=="Digilent", MODE="666", RUN+="/usr/local/sbin/dftdrvdtch %s{busnum} %s{devnum}"

To check if the installation was successful plug the board into the computer and run the following command(s):

$ djtgcfg enum
Found 1 device(s) Device:
Atlys Product Name: Atlys
User Name: Atlys
Serial Number: 111111111111

$ dadutil enum
Found 1 device(s) Device:
Atlys Product Name: Atlys
User Name: Atlys
Serial Number: 111111111111
user$ dadutil showinfo -d Atlys
Product Name: Atlys
User Name: Atlys
Serial Number: 210178399998
Product ID: 00C0010C
Firmware Version: 0303
Device Transport Type: 00010001 (USB)
Device Capabilities: 0000000D
DJTG - JTAG scan chain access
DEPP - Asynchronous Parallel Input/Output
DSTM - Streaming Synchronous Parallel Input/Output

The dadutil program can be used to manage the device (serial number, user name, etc.) while the djtgcfg can be used to download bit files to the FPGA/erase the FPGA. For usage information read the man pages.

Also the udev rule will call dftdrvdtch with the USB bus number and USB device number, however I’m not sure what it does. It has no help and the README.txt in the installation directory wasn’t specific about the function either.

Installing Xilinx ISE Webpack

Go to the Xilinx site and get the WebPack and the license file from them. The installation will require 16GB of disk space (in contrast my entire operating system including a big bunch of software/development tools installed with the corresponding source code tarballs present requires ~14GB disk space!) so be sure to have enough space in /opt.

# tar -xvf Xilinx_ISE_DS_Lin_14.1_P.15xf.0.1.tar
# cd Xilinx_ISE_DS_Lin_14.1_P.15xf.0.1
# ./xsetup

For me the license manager hung up when I tried to specify the license file path, so I had to kill it. Otherwise the installation finished normally. To overcome the license manager problem simply copy the xilinx.lic file into ~/.Xilinx.

$ mkdir ~/.Xilinx
$ cp xilinx.lic ~/.Xilinx

In order to enable programming the Atlys board from Impact using the Digilent USB cable a plugin has to be installed which can be obtained from Digilent’s site.

# tar -xvf libCseDigilent_2.1.7-x86_64.tar.gz
# cd libCseDigilent_2.1.7-x86_64/ISE13x/plugin
# chmod -x libCseDigilent.xml
# chown root:root *
# mkdir -p /opt/Xilinx/14.1/ISE_DS/ISE/lib/lin64/plugins/Digilent/libCseDigilent
# cp * /opt/Xilinx/14.1/ISE_DS/ISE/lib/lin64/plugins/Digilent/libCseDigilent/

After this you should be able to download bit files into the FPGA using the Impact tool. For the time being I have no means to download to the platform flash.

Known issues

In some cases when running core generator at the very end it might fail with the following message:

Core Generator create command completed successfully.
terminate called after throwing an instance of 'Port_ThrException::Exception'

However the generation of the files itself succeeds, apparently only adding them to the project fails. This can be worked around by adding the \*.xco file manually to the project.