Tuesday, October 5, 2010

Lattice Diamond on Ubuntu 10.04 64 bit

For some reason, Lattice provides its new Diamond GUI for the second most popular Linux distribution instead of Ubuntu, the most popular distribution.

Here is how to fix their mistake :-). Additionally, they only provide 32 bit binaries but I have a 64 bit system. So this how-to solves that problem as well.

Installing the IDE

Step 1: Download Diamond's .rpm located here, and apply for a license.

Step 2: Install "alien", the .rpm to .deb package converter.
sudo apt-get install alien

Step 3: install "getlibs"
This handy script will install the 32-bit version of libraries even if you are running 64-bit Ubuntu. Since Diamond is 32 bit you will have to install some 32 bit stuff.

click here for info (http://ubuntuforums.org/showthread.php?t=474790)

Step 4: Install 32 bit libraries (if on 64 bit Ubuntu)
apt-get install ia-32libs
sudo getlibs -p libmotif3

I am doing this from memory...if you run diamond (later step) and get a missing .so, please run "getlibs -l " to install that library and post a comment so I can update this HOW-TO!

Step 5: Run alien on the diamond RPM.
When the diamond RPM is downloaded, run alien on it:
alien -d diamond_1_0-base-135-i386-linux.rpm

Wait for a very long time. This will ultimately have an error and drop you back to the Linux prompt. It will not hang (be patient). However you will find that it created a subdirectory called "diamond_1_0-base-1.0" off your current directory. Everything we need is in there. I'll copy it to /usr/local so it is accessible:

sudo cp -r diamond_1_0-base-1.0/usr/local /usr/local

Step 6: Copy the license
You should have gotten a license file in your email stream from step 1.
Save that file into the diamond subdirectory: /usr/local/diamond/1.0/license/license.txt

Step 7: Run it!
/usr/local/diamond/1.0/bin/lin/diamond

if you get any missing libraries, please attempt to "getlibs" (see step 4) and post a comment here so others can benefit from your pain :-).


Installing the Lattice USB Programmer

Before you actually program your board, you'll have to install drivers for the programmer dongle.

The Lattice USB programmer uses libusb so that is convenient as no kernel module needs to be built. I think there is another programmer that uses the FTDI 2232 chip that does require drivers to be installed. This how-to won't cover that one, or the parallel port programmer (which I was unable to get working).

Step 1: install libusb
sudo apt-get install libusb-1.0-0

Step 2: Add the USB device to "udev"

sudo emacs /etc/udev/rules.d/10-local.rules

Append this line:
#lattice
BUS=="usb",ACTION=="add",SYSFS{idVendor}=="1134",SYSFS{idProduct}=="8001",MODE=="0660",OWNER=="root",SYMLINK+="lattice-%n"

Step 3: Plug in the USB device programmer

You should see a device in /dev named "lattice":

~$ ls /dev/lat*
/dev/lattice-6


Step 4: Fix permissions.
Shown here is an impermanent fix. Every time you turn off your computer or remove the programmer you'll have to re-run this, since the device is removed and recreated during these events. I'm sure that some of you Ubuntu/Linux wizards can tell me how to make it permanent...

sudo chmod a+rw /dev/lat*

That's it! The ispVM programming tool should auto-detect the cable now.

Have fun and post some OSS designs!

16 comments:

  1. Alien didn't give me an error and appeared to complete normally, but it didn't produce a deb. I ran "alien -g diamond_1_1-base-50-i386-linux.rpm" so that it would just unpack the file and not try to make a deb.

    ReplyDelete
  2. Thx for this fix.

    I am running Diamont 1.1 on Ubuntu 10.10, works perfectly.
    Wonder why Lattice doesn't provide a .deb package.

    I will take a look on the USB permissions as soon as I have my devel-board.

    ReplyDelete
  3. Hi

    Thx a lot for this hint.

    As for the permissions:
    Just change the udev line to
    BUS=="usb",ACTION=="add",SYSFS{idVendor}=="1134",SYSFS{idProduct}=="8001",MODE=="0660",OWNER=="root",GROUP=="lattice",SYMLINK+="lattice-%n"
    (this will set the group to lattice)
    or if you want to allow write access to everyone:
    BUS=="usb",ACTION=="add",SYSFS{idVendor}=="1134",SYSFS{idProduct}=="8001",MODE=="0666",OWNER=="root",SYMLINK+="lattice-%n"


    greetz

    ReplyDelete
  4. something else:
    as it seems you might also need libqt3-mt for the programmer to work (install via getlib)

    ReplyDelete
  5. I'm running LinuxMint11 and I've got as far as
    stan@Ian ~ $ sudo apt-get install ia-32libs
    [sudo] password for stan:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package ia-32libs
    This should be the same as Ubuntu 11.04 Any ideas? Ian.

    ReplyDelete
  6. I'm trying ia32-libs your typo I guess Ian.

    ReplyDelete
  7. sudo getlibs -p libmotif3
    The following i386 packages will be installed: libmotif3
    Continue [Y/n]? y
    libmotif3 was not found in your repositories
    Make sure you have all repositories enabled and updated
    No packages to install

    I'm installing libmotif4 with Sybnaptic Ian

    ReplyDelete
  8. sudo alien -d diamond_1_2-base-92-i386-linux.rpm
    Warning: Skipping conversion of scripts in package diamond_1_2-base: preinst prerm
    Warning: Use the --scripts parameter to include the scripts.
    diamond_1_2-base-92-i386-linux.rpm is for architecture i386 ; the package cannot be built on this system
    stan@Ian ~/IanStuff/Lattice $ ls
    diamond_1_2-base-92-i386-linux.rpm getlibs-all.deb
    As you can see from ls nothing was created. Ian.

    ReplyDelete
  9. Thank you very much for the install guide!!
    I am able to generate the deb package, install it and run the Diamond 1.4 GUI. But as soon as I try to synthesize my design it says:
    >Warning: You are running on an unsupported platform 'synplify_pro' only supports unknown
    >current platform: unknown 3.0.0-14-generic-pae
    and
    >Error: Could not find /usr/local/diamond/1.4/synpbase/unknown/mbin/synbatch
    It seems that some environment variable is not set to the value 'linux' and so the path to synbatch is not correct ('unknown' instead of 'linux'). Any advice would be greatly appreciated!

    ReplyDelete
  10. On Linux 3.x you have to change a file if it stops with the 'unknown' platform error: synpbase/bin/config/platform_set contains "case $VERSION in" ... "2.*)". Change it to "*)" and become happy :)

    ReplyDelete
  11. Wow, that did the trick! Now the synthesis is working fine. Thank you so much for your advice :)

    ReplyDelete
  12. Thanks that fixed Diamond 1.4 on Linuxmint12 with 3.0.0.15 kernel 64. I had to convert the rps to deb on my antique 256Meg Hardy Heron. I needed ia32-libs and added libqt3-mt same as Diamond 1.2. Ian.

    ReplyDelete
  13. Thank you so much for the useful comments! On Gentoo you also have to edit Synplify's platform_set to make it synthesize.
    Best Regards!

    ReplyDelete
  14. A faster rpm extraction procedure is to use rpm2cpio and cpio (may need to apt-get install cpio rpm2cpio):

    $ rpm2cpio myfile.rpm | cpio -mvid

    ReplyDelete
  15. I didn't need the getlibs, for alien to work.
    Mint Linux 17.4 kernel->3.19.0-32-generic
    "1-26-2016" to work.. wow... Beats the hell out of
    having to mess with Windows 8.1. Praise the FPGA Gods!

    ReplyDelete