glasgow: 0-unstable-2025-01-26 -> 0-unstable-2025-07-28

In addition to bringing all the new features since then, upstream now
uses the same sdcc version, and with an additional normalization phase,
we come up with exactly the same firmware as them (and validate this).

We previously had both the committed firmware blob from upstream, as
well as our built firmware in our output, and only used the upstream one
due to a packaging bug (changed path).

Dependencies were slightly reordered, instead of propagatedBuildInputs
we now use dependencies, and build-system is used instead of
nativeBuildInputs to more align with python package style. I also
documented why pytestCheckHook cannot be used.
This commit is contained in:
Florian Klink
2025-07-28 20:49:02 +02:00
parent 22747d1832
commit ea86aa9af0
+30 -13
View File
@@ -11,54 +11,71 @@
python3.pkgs.buildPythonApplication rec {
pname = "glasgow";
version = "0-unstable-2025-01-26";
version = "0-unstable-2025-07-28";
# from `pdm show`
realVersion =
let
tag = builtins.elemAt (lib.splitString "-" version) 0;
rev = lib.substring 0 7 src.rev;
in
"${tag}.1.dev2085+g${rev}";
"${tag}.1.dev2611+g${rev}";
# the latest commit ID touching the `firmware` directory, can differ from rev!
firmwareGitRev = "4fe35360";
pyproject = true;
src = fetchFromGitHub {
owner = "GlasgowEmbedded";
repo = "glasgow";
rev = "2a67f79d6025a06e98277956cbb036c4237960f1";
sha256 = "sha256-THunn3Oz+eldjQ72TGuq4Egnn6fiMiGG/UtYVRc/tfU=";
rev = "18442e9684cdda4bb2cbd2be9c31b3c6dffc625a";
hash = "sha256-b0kpgCHMk5Ylj4hY29sHRzY/zI1JXReHioHxHSO4h5E=";
};
nativeBuildInputs = [
python3.pkgs.pdm-backend
sdcc
];
propagatedBuildInputs = with python3.pkgs; [
typing-extensions
build-system = [
python3.pkgs.pdm-backend
];
dependencies = with python3.pkgs; [
aiohttp
amaranth
cobs
fx2
importlib-resources
libusb1
packaging
platformdirs
fx2
libusb1
pyvcd
aiohttp
typing-extensions
];
nativeCheckInputs = [
# pytestCheckHook discovers way less tests
python3.pkgs.unittestCheckHook
yosys
icestorm
nextpnr
yosys
];
unittestFlags = [ "-v" ];
enableParallelBuilding = true;
__darwinAllowLocalNetworking = true;
preBuild = ''
make -C firmware LIBFX2=${python3.pkgs.fx2}/share/libfx2
cp firmware/glasgow.ihex software/glasgow
make -C firmware GIT_REV_SHORT=${firmwareGitRev} LIBFX2=${python3.pkgs.fx2}/share/libfx2
# Normalize the .ihex file, see ./software/deploy-firmware.sh.
${python3.withPackages (p: [ p.fx2 ])}/bin/python firmware/normalize.py \
firmware/glasgow.ihex firmware/glasgow.ihex
# Ensure the compiled firmware is exactly the same as the one shipped in the repo.
cmp -s firmware/glasgow.ihex software/glasgow/hardware/firmware.ihex
cd software
export PDM_BUILD_SCM_VERSION="${realVersion}"
'';