Download Diamond 64-bit for Linux: http://www.latticesemi.com/latticediamond
Install alien:
sudo apt-get install alien
Use alien to convert rpm to a dpkg compatible with Ubuntu:
sudo alien diamond_3_4-base_x64-80-x86_64-linux.rpm
This will take a long time. You will see warnings:
Warning: Skipping conversion of scripts in package diamond_3_4-base_x64: postinst preinst prerm Warning: Use the --scripts parameter to include the scripts.
Now install using dpkg:
sudo dpkg --install diamond-3-4-base-x64_3.4-81_amd64.deb
We still need to run the postinstall script. To see this script run:
rpm -qp --scripts diamond_3_4-base_x64-80-x86_64-linux.rpm
Manually run the postinstall script:
sudo su bash export RPM_INSTALL_PREFIX=/usr/local cd $RPM_INSTALL_PREFIX/diamond/3.4_x64/cae_library; tar xzf cae_library.tar.gz; rm -f cae_library.tar.gz cd $RPM_INSTALL_PREFIX/diamond/3.4_x64/docs; tar xzf docs.tar.gz; rm -f docs.tar.gz cd $RPM_INSTALL_PREFIX/diamond/3.4_x64/examples; tar xzf examples.tar.gz; rm -f examples.tar.gz cd $RPM_INSTALL_PREFIX/diamond/3.4_x64/ispfpga; tar xzf ispfpga.tar.gz; rm -f ispfpga.tar.gz cd $RPM_INSTALL_PREFIX/diamond/3.4_x64/synpbase; tar xzf synpbase.tar.gz; rm -f synpbase.tar.gz cd $RPM_INSTALL_PREFIX/diamond/3.4_x64/tcltk; tar xzf tcltk.tar.gz; rm -f tcltk.tar.gz exit exit
Diamond executable can be found in:
/usr/local/diamond/3.4_x64/bin/lin64/diamond
To install the MICO System Development tools. Download from:
You should download an .rpm called diamond_3_6-lm_x64-83-4-x86_64-linux.rpm
Follow the same install directions as above but with a different postinstall script shown below.
Manually run the postinstall script:
sudo su bash export RPM_INSTALL_PREFIX=/usr/local export micoPath=$RPM_INSTALL_PREFIX/latticemicosystem/3.6_x64/lm export micoDir=$RPM_INSTALL_PREFIX/latticemicosystem/3.6_x64/micosystem if [ -e $micoPath/micosystem/LatticeMicoLauncher ] then sed -e "s?lm32path?$micoDir?" $micoPath/micosystem/LatticeMicoLauncher > $micoPath/micosystem/LatticeMicoLauncher2 rm $micoPath/micosystem/LatticeMicoLauncher mv $micoPath/micosystem/LatticeMicoLauncher2 $micoPath/micosystem/LatticeMicoLauncher fi chmod -f 755 $micoPath/micosystem/LatticeMicoLauncher if [ -e $micoPath/micosystem/LatticeMico.csh ] then sed -e "s?lm32path?$micoDir?" $micoPath/micosystem/LatticeMico.csh > $micoPath/micosystem/LatticeMico.cs_ rm $micoPath/micosystem/LatticeMico.csh mv $micoPath/micosystem/LatticeMico.cs_ $micoPath/micosystem/LatticeMico.csh fi chmod -f 755 $micoPath/micosystem/LatticeMico.csh if [ -e $micoPath/micosystem/LatticeMico.sh ] then sed -e "s?lm32path?$micoDir?" $micoPath/micosystem/LatticeMico.sh > $micoPath/micosystem/LatticeMico.sh_ rm $micoPath/micosystem/LatticeMico.sh mv $micoPath/micosystem/LatticeMico.sh_ $micoPath/micosystem/LatticeMico.sh fi chmod -f 755 $micoPath/micosystem/LatticeMico.sh export diamondPath=`dirname $micoPath` if [ -e $micoPath/micosystem/mico32system.ini ] then sed -e "s?Root=.*?Root=$diamondPath?" $micoPath/micosystem/mico32system.ini > $micoPath/micosystem/mico32system.in_ rm $micoPath/micosystem/mico32system.ini mv $micoPath/micosystem/mico32system.in_ $micoPath/micosystem/mico32system.ini fi chmod -f 755 $micoPath/micosystem/mico32system.ini mv $micoPath/micosystem/mico32system.ini $micoPath/micosystem/latticemicosystem.ini if [ -e $RPM_INSTALL_PREFIX/diamond/3.6_x64/bin/lin/diamond ] then export temp=`dirname ${micoPath}` export dir=`dirname $temp` fi if [ -e ${micoPath}/micosystem/cp_pack ] then ${micoPath}/micosystem/cp_pack 3.6 "" $RPM_INSTALL_PREFIX rm -f ${micoDir}/cp_pack rm -f ${micoDir}/post_install rm -r -f ${micoPath} if [ -e $RPM_INSTALL_PREFIX/diamond/3.6_x64/bin/lin/diamond ] then rm -r -f $dir fi fi
Install some missing 32-bit libraries:
sudo apt-get install libgtk2.0-0:i386 libglib2.0-0:i386 libnspr4:i386 libstdc++5:i386
The executable is called:
LatticeMicoLauncher
References:
Before programming:
sudo chmod 777 /dev/bus/usb/003/075 sudo /sbin/rmmod ftdi_sio sudo /sbin/rmmod usbserial
To get UART working over the USB after programming the board:
sudo modprobe usbserial sudo modprobe ftdi_sio sudo chmod 777 /dev/ttyUSB*
The default location that diamond looks for the license is at: /usr/local/diamond/3.7_x64/license/license.dat So simply rename the license file and copy it to the path; or add your own location to $LM_LICENSE_FILE environment variable. Now try 'diamondc' and hopefully it does not complain about license.
If the above setup does not work and your machine has more than 1 network card. Here are the more complicated steps,
1. Make sure that Diamond's lmutil program can find the correct hostid. Run:
/usr/local/diamond/3.7_x64/ispfpga/bin/lin64/lmutil lmhostid
If you get this error: “diamond/3.7_x64/ispfpga/bin/lin64/lmutil: No such file or directory”, ⇒ go to step 2.
Otherwise it is likely you get this message, “The FLEXnet host ID of this machine is “000000000000””,⇒ go to step 3.
2. Run
file /usr/local/diamond/3.7_x64/ispfpga/bin/lin64/lmutil
, you will see “/usr/local/diamond/3.7_x64/ispfpga/bin/lin64/lmutil: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-lsb-x86-64.so.3, for GNU/Linux 2.6.9, stripped”. It is likely the interpreter file /lib64/ld-lsb-x86-64.so.3 does not exist. So create a symbolic link from existing one:
sudo ln -s /lib64/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
Re-run step 1.
3. Diamond's lmutil is not able to correctly detect the hostid. The following renames the network card to help lmutil to find it: - create file “/etc/udev/rules.d/70-persistent-net.rules” - put this line in the file with hostid replaced with yours.
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="ho:st:id:re:pl:ac", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"
4. Restart the machine and try again.
References: