160.2. sigrok-firmware-fx2lafw-0.1.7
The firmware libsigrok uploads to a Cypress FX2 logic analyser, compiled here with sdcc
| Version | 0.1.7, release 1 |
| Shelf | eda — Electronics: schematic and PCB, circuit simulation, antenna modelling, FPGA synthesis and simulation, logic analysers and bench instruments |
| Phase | 41_system (System), 429 of 1047 in build order |
| Licence | GPL-2.0-or-later AND LGPL-2.1-or-later |
| Homepage | https://sigrok.org/wiki/Fx2lafw |
| Build time | 0.1 SBU |
| Installed size | 178.6 KiB in 15 files |
| Recipe | ports/core/eda/sigrok-firmware-fx2lafw/kpkgbuild |
About
fx2lafw is open firmware for the logic analysers built on Cypress’s FX2 USB microcontroller, most of them inexpensive boards with no firmware of their own. Such a board enumerates as a bare FX2. When libsigrok’s fx2lafw driver finds one, it uploads the matching fx2lafw-*.fw from /usr/share/sigrok-firmware into the chip’s RAM; without the file the device is listed by a scan and cannot be opened. The firmware is 8051 code, compiled here from source by the sdcc port, whose 8051 back end and device libraries are the whole toolchain it needs. See What is built from source.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/eda.txt:
The FX2 analysers are blank until libsigrok uploads this to them; sdcc compiles it.
Sources
sigrok-firmware-fx2lafw-0.1.7.tar.gz(142.0 KiB)
sha256a3f440d6a852a46e2c5d199fc1c8e4dacd006bc04e0d5576298ee55d056ace3b
upstream: https://sigrok.org/download/source/sigrok-firmware-fx2lafw/sigrok-firmware-fx2lafw-0.1.7.tar.gz
archive copy: sources-2/eda--sigrok-firmware-fx2lafw-0.1.7.tar.gz
Dependencies
Depends on: sdcc.
Required by (1): libsigrok.
Patches
build.sh applies these; kpkg applies nothing by itself.
sdcc-syntax.patch— sdcc from 4.2.3 on accepts an expression after__atonly in parentheses, as in__at (0x80+0), and an interrupt number only as__interrupt(N). The release spells both the older way, sofx2lib/include/fx2regs.h, every interrupt handler infx2lib/lib/interrupts/and inautovector.h, and the handlers infx2lafw.candinclude/scope.incdo not compile with the sdcc port. The patch rewrites those declarations in the accepted spelling and changes no address or vector.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install sigrok-firmware-fx2lafw'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/eda/sigrok-firmware-fx2lafw.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/eda/sigrok-firmware-fx2lafw
echo 'a3f440d6a852a46e2c5d199fc1c8e4dacd006bc04e0d5576298ee55d056ace3b sigrok-firmware-fx2lafw-0.1.7.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/sigrok-firmware-fx2lafw
SRC=$SRC_ROOT/sigrok-firmware-fx2lafw-0.1.7
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sigrok-firmware-fx2lafw-0.1.7.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/sdcc-syntax.patch"
./configure --prefix=/usr
make
make DESTDIR=$PKG install
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/sigrok-firmware-fx2lafw, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf sigrok-firmware-fx2lafw-0.1.7-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/sigrok-firmware-fx2lafw, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/sigrok-firmware-fx2lafw, /usr/share/sigrok-firmware.
Notes
The package holds firmware images for the FX2, not programs for the host, and nothing in it runs on KDOS itself. Its configure only looks for sdcc and sdas8051, sdar, and objcopy or makebin, refuses an sdcc older than 3.4.0, and writes the makefile; there are no switches to set.