diff --git a/pkgs/by-name/gl/glasgow/package.nix b/pkgs/by-name/gl/glasgow/package.nix index c193c2029b45..09ce3f00a1f9 100644 --- a/pkgs/by-name/gl/glasgow/package.nix +++ b/pkgs/by-name/gl/glasgow/package.nix @@ -1,33 +1,16 @@ { lib, - python3, + python3Packages, fetchFromGitHub, - fetchPypi, - sdcc, - yosys, icestorm, nextpnr, + sdcc, + yosys, }: -let - # glasgow uses importlib_resources' open_text(), removed in 7.x; pin it to 6.x. - pythonPackages = python3.pkgs.overrideScope ( - final: prev: { - importlib-resources = prev.importlib-resources.overridePythonAttrs (old: rec { - version = "6.5.2"; - src = fetchPypi { - pname = "importlib_resources"; - inherit version; - hash = "sha256-GF+Hre9bzCiESdmPtPugfOp4vANkVd1ExfxKL+eP7Sw="; - }; - doCheck = false; - }); - } - ); -in -pythonPackages.buildPythonApplication rec { +python3Packages.buildPythonApplication rec { pname = "glasgow"; - version = "0-unstable-2025-12-22"; + version = "0-unstable-2025-07-25"; # Similar to `pdm show`, but without the commit counter pdmVersion = let @@ -35,17 +18,17 @@ pythonPackages.buildPythonApplication rec { rev = lib.substring 0 7 src.rev; in "${tag}.1.dev0+g${rev}"; - # The latest commit ID touching the `firmware` directory, before a "deploy firmware" commit. - # Differs from rev! - firmwareGitRev = "8b5afc70"; + # Usually the latest commit ID touching the `firmware` directory. Differs from src/rev! + # Run `git log -1 --abbrev=8 --pretty=%h HEAD .` inside the firmware/fx2 dir. + firmwareGitRev = "12b5cfb3"; pyproject = true; src = fetchFromGitHub { owner = "GlasgowEmbedded"; repo = "glasgow"; - rev = "ccee116d8b59f25ed0874d152f6b9f9974b185f1"; - hash = "sha256-2fF0lPfRtpci76q4fEhWAwLBXP0kfIP3dH5z8u/+yd8="; + rev = "c424688ff0d7faee49198bbdb2a34b1026534350"; + hash = "sha256-0pVQg3FSBQ8A4eLnAxFdicOiCvAYmKwHnSoLGx1MLxM="; }; nativeBuildInputs = [ @@ -53,13 +36,14 @@ pythonPackages.buildPythonApplication rec { ]; build-system = [ - pythonPackages.pdm-backend + python3Packages.pdm-backend ]; - dependencies = with pythonPackages; [ + dependencies = with python3Packages; [ aiohttp amaranth cobs + enum-tools fx2 importlib-resources libusb1 @@ -67,11 +51,12 @@ pythonPackages.buildPythonApplication rec { platformdirs pyvcd typing-extensions + tqdm ]; nativeCheckInputs = [ # pytestCheckHook discovers way less tests - pythonPackages.unittestCheckHook + python3Packages.unittestCheckHook icestorm nextpnr yosys @@ -84,16 +69,16 @@ pythonPackages.buildPythonApplication rec { __darwinAllowLocalNetworking = true; preBuild = '' - make -C firmware GIT_REV_SHORT=${firmwareGitRev} LIBFX2=${pythonPackages.fx2}/share/libfx2 + make -C firmware/fx2 GIT_TREE_DIRTY=0 GIT_REV_SHORT=${firmwareGitRev} LIBFX2=${python3Packages.fx2}/share/libfx2 # Normalize the .ihex file, see ./software/deploy-firmware.sh. - ${pythonPackages.python.withPackages (p: [ p.fx2 ])}/bin/python firmware/normalize.py \ - firmware/glasgow.ihex firmware/glasgow.ihex + ${python3Packages.python.withPackages (p: [ p.fx2 ])}/bin/python firmware/fx2/normalize.py \ + firmware/fx2/build/firmware.ihex firmware/fx2/glasgow.ihex # Ensure the compiled firmware is exactly the same as the one shipped in the repo. - if ! cmp -s firmware/glasgow.ihex software/glasgow/hardware/firmware.ihex; then + if ! cmp -s firmware/fx2/glasgow.ihex software/glasgow/hardware/firmware-fx2.ihex; then echo >&2 "Firmware doesn't reproduce!" - diff -u software/glasgow/hardware/firmware.ihex firmware/glasgow.ihex + diff -u software/glasgow/hardware/firmware-fx2.ihex firmware/fx2/glasgow.ihex exit 1 fi