As some of you might know, next to a BsC in computer science, I also have a degree in electronics. I never used to do anything with that long-gone knowledge, but since a few week backs, I revived an old hobby of mine : Retro computing.
I’m especially fond of the MSX, which I also own myself. It was also the first computer I get aquited to.
Going back to that era also mean going back to the time you can create your own hardware, and writing software often meant assembly and in-depth hardware knowledge. There days, most is abstracted away by drivers and high-level interfaces (DirextX, OpenGL), and modern compilers take away most need to learn and use assembly language.
Doing you own hardware there days is more ’easy’ then back in the 80’s due to the arrival of FPGA’s, which provide you with the means to create complex hardware platforms at a cheap price. Boards with an Lattice ECP5 or Gowin FPGA are very affordable these days (< 100 Euro’s>). Developing for FPGA’s is done in either Verilog or VHDL (yes, other HDL’s also exist, I know, but those are far from mainstream), two Hardware Description Languages. Looks like a regular programming language (the Verilog language looks like C), but its a descriptive language, which means you don’t always get what you want. Hardware also involved timing and concurrency by default, which both don’t play a vital role in software development. Being able to do both makes you a better developer, being it in hardware or in software.
With FPGA’s in most cases come… vendor tools. In the software world, most is free. In the hardware world, most is priced involving lots of digits. For homebrew development, most vendors (Lattice, Intel, Gowin) provide ‘free’ versions that are usually limited in features and device support. The paid versions start at approx. 3k USD per year, and that goes up to 100k.
This blog is about Lattice Diamond, tooling that comes from the vendor and does ECP5 FPGA’s. Without a license, you can use the most common devices. For hobby stuff, I own 2 devices : A Lenovo T580 and a Dell XPS13, both running Fedora Core 42. The T580 also runs windows because I play games on steam as well.
So, lets get this thing running.
Your journey starts at the download site for the Diamond software. Pick the Linux RPM version (no, that doesn’t actually deliver an RPM).
Create a new empty dir, and unpack the zip file in that directory. You’ll find a single file, called <version>_Diamond_lin.run
. Run that binary (as a user, NOT as root), and install it in a proper place. I place all vendor software in /opt
, so the installation ends up in /opt/lscc/diamond/
You need to manually create the menu item, the program it needs to run is <install_dir>/bin/lin64/diamond
.
If you run it, some things you’ll notice (run it from the termimal to start with) : Tons of errors on missing glibc symbols, and some things crash (floorplan editor being one). This is caused by Diamond using its own set of shared objects, but still depending on some system QT libs. It also relies on the system’s libxml2, and that version delivered in a supported OS (RHEL 7, RHEL8) differs from what is there in FC42.
The embedded SO’s are most likely done to prevent issues on somewhat “older” RHEL versions. For me, this resulted in all kinds of errors because it also uses system provided SO’s. FC 34’s libs are in all cases new then what is embedded in the Diamond distribution.
For the libstdc++ issue, I solved it with a
find <install_dir> -name '*libstdc++*so*' -print0 | xargs -0 rm
The second issue is that using certain functionality result in a coredump. Opening a project, and selecting Floorplan View results in a crash and a coredump. The backtrace gives :
#0 0x00007f1973cd7388 xmlSAX2Comment (libxml2.so.2 + 0x32388)
#1 0x00007f1958525d7f pr_parse (libbaspr.so + 0x125d7f)
#2 0x00007f19584fe446 _ZN11PR_PREFCNTL15syntax_chk_loadEPKcS1_S1_S1_ (libbaspr.so + 0xfe446)
#3 0x00007f195eeb4d1e _ZN7PrfData8loadDataEv (libcommondata.so.1 + 0xb4d1e)
#4 0x00007f1964d76245 _ZN15PNHeavyDutyTask15loadCommondDataEv (libpnmaindll.so + 0x176245)
#5 0x00007f1964d768e5 _ZN15PNHeavyDutyTask7runTaskEv (libpnmaindll.so + 0x1768e5)
#6 0x00007f1974c8b86c n/a (libQtCore.so.4 + 0x8b86c)
#7 0x00007f197427ff54 start_thread (libc.so.6 + 0x71f54)
#8 0x00007f197430332c __clone3 (libc.so.6 + 0xf532c)
So, it crashes somewhere in libxml.so.2. That SO is however not part of the Diamon distribution, and is taken from the system path. The version that Diamond assumes, and the version that FC42 provides are binary incompatible.
The only way to fix this is to provide an older version of libxml, and making that specifically available to Diamon. If you install this in the normal system location, you will brick things for sure.
The recipe that worked for me :
git clone https://github.com/GNOME/libxml2.git
cd libxml2
git checkout v2.10.4
./autogen.sh
./configure --without-python
make
cd .libs
cp -d ibxml2.so.2 libxml2.so.2.10.4 <install_dir>/bin/lin64/
That should repairs the non-working functionality.
I haven’t used all functionality (yet), so there can be other (hidden) issues. I’ll update this blog when I encounter and fix an issue.