Friday, 13 August 2010

Digilent Adept2 on Ubuntu

[UPDATE] Just discovered this a load of misguided rubbish. The digilent script uses "bash". Ubuntu uses "dash" as "sh" and isn't compatible. To run the do "sudo bash" not "sudo sh"

Back in February I bought a Nexys2 from Digilent for a very reasonable sum, at least in FPGA terms. However, I can not stand developing any code in Windows; I just find it awkward. At the time my options for programming the Nexys2 was limited:

  1. Use the windows-only Digilent tool (Adept)
  2. Use a perl script and custom firmware called nexy2prog.
The problem with nexy2prog is that the changes to the FPGA are not permanent when using this very handy programmer.

Fast-forward to now and I find that Digilent has created a Linux client for the Adept programmer. It does the job for what I need: upload my bitfiles to the FPGA PROM. An added bonus is that it's command-line (there is no gui). Once installed I have had no problems; the documentation is lacking and the argument passing to the CLI program is not that intuitive nor described in "-h" but it does at least help you when you pass the wrong arguments.

The main issue is the installer. Frankly I get the feeling the person tasked to write the installer was a bit green. Admittedly, i'm no good at Bash but I can at least see that the bash used in Adept's installer is using very strange code. The main example is extraneous parenthesis. Example 1, right at the start of one of the installers (
mname=($(uname -m))
That will not work and causes the script to exit it's execution. It should look like this:
mname=$(uname -m)

Example 2:
if [[ "${manpath}" == */usr/local/man* ]]
Those extra [] and "" are just unnecessary.

The thing is these issues (along with a couple that are just nit-picking) are throughout the over-engineered installer-scripts that are up to 700 lines in length (that are very well documented. A huge plus).

I did go through and clean up one of the installer-scripts and it installed fine but honestly, it's pointless and here I've outlined how you can go from a +1000 line installer scripts (both of the scripts) to just 16lines (at least on 32bit Ubuntu):

Make sure you have downloaded the 32bit Adept runtime and utilities and saved them in the same common directory. Then:

tar xaf digilent.adept*.tar.gz
cd digilent.adept*-i686/
sudo -s
cp -av lib/* /usr/local/lib/
mkdir /usr/local/lib/firmware
cp -av firmware/* /usr/local/lib/firmware/
mkdir -p /usr/local/share/digilent/data
cp -a jtscdvclist.txt /usr/local/share/digilent/data/
cp -av 52-digilent-usb.rules /etc/udev/rules.d/
echo "/usr/local/lib/" >> /etc/
/sbin/udevadm control --reload-rules
cd ../

tar xaf adept.utilities*1-i686.tar.gz
cd adept.utilities*1-i686/
cp -av bin/* /usr/local/bin/

There you have it. Done. (At least on my machine and this procedure cannot be guaranteed to work on yours. :D )


  1. Hello,
    I got the adept2 for linux and did install it correctly using the available installer scripts. But my problem is how are we going to actually use the Adept2 to program the device or transfer data through the USB. There seems to be no manual on how to use the adept2 package in linux.

    Please give me some guidance on how to program the device once you have a .bit or any other programming file made by Xilinx ISE.


    thusi87 at gmail dot com

  2. Look at the "djtgcfg" binary installed by the utilities package.
    For instance, pushing your bit file on your board could be:
    ./djtgcfg prog -d Nexys2 -i 0 -f myprog.bit

    Have a look at "man djtgcfg" to see.

  3. thanks fred...silly me.. but did figure it out later.

  4. I made a small GUI for Adept. I tested it on ubuntu, but I think it will work on any linux.