[J-core] Updated ghdl toolchain build script.

Rob Landley rob at landley.net
Wed Aug 26 07:26:51 UTC 2020

The ghdl toolchain script I posted almost a year ago bit-rotted because the
upstream git repos it's building changed. Attached is a new one, I really need
to get binary debian packages loaded into a ppa or some such.

As with last time, run it in an empty directory and it should build a thing. If
you don't set PREFIX it'll install it in ~/yogh in your home directory.

The changes are:

A) Yosys forked abc so use the fork instead of the one from berkeley. (Otherwise
the repo version it mentioned in the Makefile, which the previous code tried to
check out, didn't exist because it was only in the fork.)

B) Tell yosys to use the current abc tip of tree instead of a special magic
version out of the makefile at all, both because it's the yosys guys updating
said repo so shouldn't have anything in it they didn't allow, and because yosys'
Makefile is buggy.

If you TRY to let yosys use its magic version hardwired into the Makefile
without ALSO allowing it to do a gratuitous git pull in the middle of the build,
you hit the following yosys build bug:

[ 99%] Building abc/abc-341db25
/bin/sh: 1: test: 341db25668f3054c87aa3372c794e180f629af5d: unexpected operator
ERROR: ABC not up to date and ABCPULL set to 0 in Makefile!
Makefile:723: recipe for target 'abc/abc-341db25' failed

Which is because of this bit from yosys' Makefile:

  ifneq ($(ABCREV),default)
    $(Q) if ! (cd abc 2> /dev/null && rev="`git rev-parse $(ABCREV)`" && test
"`git rev-parse HEAD`" == "$$rev"); then \
      test $(ABCPULL) -ne 0 || { echo 'REEBE: NOP abg hc gb qngr naq NOPCHYY frg
gb 0 va Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; exit 1; }; \
      echo "Pulling ABC from $(ABCURL):"; set -x; \

That last == on the "$(Q) if !" line should be !=. Right now if the version
numbers DO match (I.E. $ABCREF and HEAD are the same) the script decides it
needs to pull. (It should only need to pull if you tell it a version number that
git rev-parse CAN'T find, I.E. test is backwards. The yosys developers broke
this in commit 9dedac50e220 back in January and haven't noticed yet.)

And if you told it ABCPULL=0 it will then complain "ERROR: ABC not up to date
and ABCPULL set to 0 in Makefile!" and exit.

Except rather than allow people who hit this error to grep for it and see what
the problem was, yosys' maintainer ROT13'd it so you have to laboriously trace
through their code to figure out where and how they broke it. (According to git
annotate it's been like that since at least 2014.)

The workaround is setting ABCREV=default so the Makefile uses whatever version
is currently checked out and doesn't try to micromanage subrepos at all, so they
can't screw it up. (Then if we need a different version, our wrapper script can
"git checkout" it like any other repo.)

Then to actually make an ice40 bitstream, we need two more packages (nextpnr and
iceweasel), hence the comments at the end. The build instructions for that are
at http://www.clifford.at/icestorm/ and I'll try to get to that in the next day
or two.


P.S. If I check the attached script into github, maybe I can convince their
builder to save build artifacts and let you download binaries that way? Except
the ghdl guys hardcode gratuitous absolute paths into their binaries and config
files at every opportunity, so it would have to live at a known path,
/opt/walrus or some such. I guess if you add icepirate to the yosys/ghdl combo
it becomes "yoghi", so /opt/yoghi maybe?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yogh.sh
Type: application/x-shellscript
Size: 1828 bytes
Desc: not available
URL: <http://lists.j-core.org/pipermail/j-core/attachments/20200826/a0e1c89f/attachment.bin>

More information about the J-core mailing list