From ad34d49f3d751d56d5e76d0fa1736d7fdca172b6 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 21 Feb 2025 17:04:56 +0200 Subject: [PATCH 01/10] Fix shell.nix ``` [nix-shell:~/joyofhardware/RiscV-Formal]$ riscv64-unknown-linux-gnu-gcc bash: /nix/store/xq4q2vv9ii7z2k2qp82jd180xdb0r4fv-gcc-riscv64-unknown-linux-gnu-14-20241116/bin/riscv64-unknown-linux-gnu-gcc: cannot execute binary file: Exec format error ``` `pkgs.pkgsCross.riscv64` is for running on riscv64 `pkgs.pkgsCross.riscv64.buildPackages` is for running on the build system and compiling code for riscv64 `nativeBuildInputs` is for packages which run on the build system and compile code for riscv64 with `__splicedPackages` we can avoid having to specify `buildPackages` and have the dependency attributes (`nativeBuildInputs`) pick the `buildHost` version of the package --- shell.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell.nix b/shell.nix index fb93d74..f5f7ad1 100644 --- a/shell.nix +++ b/shell.nix @@ -1,10 +1,10 @@ { pkgs ? import {} }: let - riscv64-linux = pkgs.pkgsCross.riscv64; + riscv64-linux = pkgs.pkgsCross.riscv64.__splicedPackages; in pkgs.mkShell { - buildInputs = [ + nativeBuildInputs = [ riscv64-linux.gcc riscv64-linux.binutils riscv64-linux.glibc @@ -13,4 +13,4 @@ pkgs.mkShell { shellHook = '' echo "RISC-V Linux cross-compilation environment initialized!" ''; -} \ No newline at end of file +} From fec992cf2ac4602fcc2597c98876526c817d0108 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 22 Feb 2025 22:13:14 +0200 Subject: [PATCH 02/10] Add flake `haskell.nix` is quite different from normal nix infra but seems to be working fine here. Works with ghc 9.6.6 --- flake.lock | 577 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 66 ++++++ shell.nix | 16 -- 3 files changed, 643 insertions(+), 16 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2e83210 --- /dev/null +++ b/flake.lock @@ -0,0 +1,577 @@ +{ + "nodes": { + "HTTP": { + "flake": false, + "locked": { + "lastModified": 1451647621, + "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", + "owner": "phadej", + "repo": "HTTP", + "rev": "9bc0996d412fef1787449d841277ef663ad9a915", + "type": "github" + }, + "original": { + "owner": "phadej", + "repo": "HTTP", + "type": "github" + } + }, + "cabal-32": { + "flake": false, + "locked": { + "lastModified": 1603716527, + "narHash": "sha256-X0TFfdD4KZpwl0Zr6x+PLxUt/VyKQfX7ylXHdmZIL+w=", + "owner": "haskell", + "repo": "cabal", + "rev": "48bf10787e27364730dd37a42b603cee8d6af7ee", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.2", + "repo": "cabal", + "type": "github" + } + }, + "cabal-34": { + "flake": false, + "locked": { + "lastModified": 1645834128, + "narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=", + "owner": "haskell", + "repo": "cabal", + "rev": "5ff598c67f53f7c4f48e31d722ba37172230c462", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.4", + "repo": "cabal", + "type": "github" + } + }, + "cabal-36": { + "flake": false, + "locked": { + "lastModified": 1669081697, + "narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=", + "owner": "haskell", + "repo": "cabal", + "rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.6", + "repo": "cabal", + "type": "github" + } + }, + "cardano-shell": { + "flake": false, + "locked": { + "lastModified": 1608537748, + "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", + "owner": "input-output-hk", + "repo": "cardano-shell", + "rev": "9392c75087cb9a3d453998f4230930dea3a95725", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "cardano-shell", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1672831974, + "narHash": "sha256-z9k3MfslLjWQfnjBtEtJZdq3H7kyi2kQtUThfTgdRk0=", + "owner": "input-output-hk", + "repo": "flake-compat", + "rev": "45f2638735f8cdc40fe302742b79f248d23eb368", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "hkm/gitlab-fix", + "repo": "flake-compat", + "type": "github" + } + }, + "ghc-8.6.5-iohk": { + "flake": false, + "locked": { + "lastModified": 1600920045, + "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", + "owner": "input-output-hk", + "repo": "ghc", + "rev": "95713a6ecce4551240da7c96b6176f980af75cae", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "release/8.6.5-iohk", + "repo": "ghc", + "type": "github" + } + }, + "hackage": { + "flake": false, + "locked": { + "lastModified": 1740097423, + "narHash": "sha256-DsGw8i2CJIw+AaMDn01tDS6frU2d80u5LXmGHuW3kUM=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "83d083a4931b48b5ba555e52b1bbbf4da55f1a24", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "hackage-for-stackage": { + "flake": false, + "locked": { + "lastModified": 1740097413, + "narHash": "sha256-R8387ERJhPpy6Q/BM6EOHNl/AZ7a8KjippJhil2NsUg=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "e10eff533209542e11345b2930404938d4a9fe8d", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "for-stackage", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskellNix": { + "inputs": { + "HTTP": "HTTP", + "cabal-32": "cabal-32", + "cabal-34": "cabal-34", + "cabal-36": "cabal-36", + "cardano-shell": "cardano-shell", + "flake-compat": "flake-compat", + "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", + "hackage": "hackage", + "hackage-for-stackage": "hackage-for-stackage", + "hls-1.10": "hls-1.10", + "hls-2.0": "hls-2.0", + "hls-2.2": "hls-2.2", + "hls-2.3": "hls-2.3", + "hls-2.4": "hls-2.4", + "hls-2.5": "hls-2.5", + "hls-2.6": "hls-2.6", + "hls-2.7": "hls-2.7", + "hls-2.8": "hls-2.8", + "hls-2.9": "hls-2.9", + "hpc-coveralls": "hpc-coveralls", + "iserv-proxy": "iserv-proxy", + "nixpkgs": [ + "haskellNix", + "nixpkgs-unstable" + ], + "nixpkgs-2305": "nixpkgs-2305", + "nixpkgs-2311": "nixpkgs-2311", + "nixpkgs-2405": "nixpkgs-2405", + "nixpkgs-2411": "nixpkgs-2411", + "nixpkgs-unstable": "nixpkgs-unstable", + "old-ghc-nix": "old-ghc-nix", + "stackage": "stackage" + }, + "locked": { + "lastModified": 1740099110, + "narHash": "sha256-6sEIo/jd7UgbILXNqaiwN/GilAfks8FBaH79uq0nkZw=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "81eb79ff6065dfd00b7e5ce46d636fc32a1efef4", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, + "hls-1.10": { + "flake": false, + "locked": { + "lastModified": 1680000865, + "narHash": "sha256-rc7iiUAcrHxwRM/s0ErEsSPxOR3u8t7DvFeWlMycWgo=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "b08691db779f7a35ff322b71e72a12f6e3376fd9", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "1.10.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.0": { + "flake": false, + "locked": { + "lastModified": 1687698105, + "narHash": "sha256-OHXlgRzs/kuJH8q7Sxh507H+0Rb8b7VOiPAjcY9sM1k=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "783905f211ac63edf982dd1889c671653327e441", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.0.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.2": { + "flake": false, + "locked": { + "lastModified": 1693064058, + "narHash": "sha256-8DGIyz5GjuCFmohY6Fa79hHA/p1iIqubfJUTGQElbNk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "b30f4b6cf5822f3112c35d14a0cba51f3fe23b85", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.2.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.3": { + "flake": false, + "locked": { + "lastModified": 1695910642, + "narHash": "sha256-tR58doOs3DncFehHwCLczJgntyG/zlsSd7DgDgMPOkI=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "458ccdb55c9ea22cd5d13ec3051aaefb295321be", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.3.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.4": { + "flake": false, + "locked": { + "lastModified": 1699862708, + "narHash": "sha256-YHXSkdz53zd0fYGIYOgLt6HrA0eaRJi9mXVqDgmvrjk=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "54507ef7e85fa8e9d0eb9a669832a3287ffccd57", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.4.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.5": { + "flake": false, + "locked": { + "lastModified": 1701080174, + "narHash": "sha256-fyiR9TaHGJIIR0UmcCb73Xv9TJq3ht2ioxQ2mT7kVdc=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "27f8c3d3892e38edaef5bea3870161815c4d014c", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.5.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.6": { + "flake": false, + "locked": { + "lastModified": 1705325287, + "narHash": "sha256-+P87oLdlPyMw8Mgoul7HMWdEvWP/fNlo8jyNtwME8E8=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "6e0b342fa0327e628610f2711f8c3e4eaaa08b1e", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.6.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.7": { + "flake": false, + "locked": { + "lastModified": 1708965829, + "narHash": "sha256-LfJ+TBcBFq/XKoiNI7pc4VoHg4WmuzsFxYJ3Fu+Jf+M=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "50322b0a4aefb27adc5ec42f5055aaa8f8e38001", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.7.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.8": { + "flake": false, + "locked": { + "lastModified": 1715153580, + "narHash": "sha256-Vi/iUt2pWyUJlo9VrYgTcbRviWE0cFO6rmGi9rmALw0=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "dd1be1beb16700de59e0d6801957290bcf956a0a", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.8.0.0", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hls-2.9": { + "flake": false, + "locked": { + "lastModified": 1720003792, + "narHash": "sha256-qnDx8Pk0UxtoPr7BimEsAZh9g2WuTuMB/kGqnmdryKs=", + "owner": "haskell", + "repo": "haskell-language-server", + "rev": "0c1817cb2babef0765e4e72dd297c013e8e3d12b", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "2.9.0.1", + "repo": "haskell-language-server", + "type": "github" + } + }, + "hpc-coveralls": { + "flake": false, + "locked": { + "lastModified": 1607498076, + "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", + "type": "github" + }, + "original": { + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "type": "github" + } + }, + "iserv-proxy": { + "flake": false, + "locked": { + "lastModified": 1717479972, + "narHash": "sha256-7vE3RQycHI1YT9LHJ1/fUaeln2vIpYm6Mmn8FTpYeVo=", + "owner": "stable-haskell", + "repo": "iserv-proxy", + "rev": "2ed34002247213fc435d0062350b91bab920626e", + "type": "github" + }, + "original": { + "owner": "stable-haskell", + "ref": "iserv-syms", + "repo": "iserv-proxy", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1735821806, + "narHash": "sha256-cuNapx/uQeCgeuhUhdck3JKbgpsml259sjUQnWM7zW8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d6973081434f88088e5321f83ebafe9a1167c367", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2305": { + "locked": { + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2311": { + "locked": { + "lastModified": 1719957072, + "narHash": "sha256-gvFhEf5nszouwLAkT9nWsDzocUTqLWHuL++dvNjMp9I=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7144d6241f02d171d25fba3edeaf15e0f2592105", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-23.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2405": { + "locked": { + "lastModified": 1735564410, + "narHash": "sha256-HB/FA0+1gpSs8+/boEavrGJH+Eq08/R2wWNph1sM1Dg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e7a8f391f1a490460760065fa0630b5520f9cf8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2411": { + "locked": { + "lastModified": 1737255904, + "narHash": "sha256-r3fxHvh+M/mBgCZXOACzRFPsJdix2QSsKazb7VCXXo0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eacdab35066b0bb1c9413c96898e326b76398a81", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1737110817, + "narHash": "sha256-DSenga8XjPaUV5KUFW/i3rNkN7jm9XmguW+qQ1ZJTR4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "041c867bad68dfe34b78b2813028a2e2ea70a23c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "old-ghc-nix": { + "flake": false, + "locked": { + "lastModified": 1631092763, + "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", + "owner": "angerman", + "repo": "old-ghc-nix", + "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", + "type": "github" + }, + "original": { + "owner": "angerman", + "ref": "master", + "repo": "old-ghc-nix", + "type": "github" + } + }, + "root": { + "inputs": { + "haskellNix": "haskellNix", + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "stackage": { + "flake": false, + "locked": { + "lastModified": 1740096702, + "narHash": "sha256-fwXgQnLUbL3U8091RaskwGeTe0pRLCaAPh8ZkIiaTBc=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "64d492737ba6c3eecf7f81dc9184dc8c1482fd06", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7e9ef01 --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +{ + inputs = { + nixpkgs = { + url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + utils.url = "github:numtide/flake-utils"; + haskellNix.url = "github:input-output-hk/haskell.nix"; + + }; + + outputs = + inputs: + inputs.utils.lib.eachDefaultSystem ( + system: + let + pkgs = import inputs.nixpkgs { + localSystem = system; + overlays = [ + inputs.haskellNix.overlay + (_: prev: { + riscv-formal = prev.callPackage ( + { + haskell-nix, + qemu, + }: + haskell-nix.hix.project { + compiler-nix-name = "ghc948"; + # This works + #compiler-nix-name = "ghc966"; + src = builtins.path { + path = ./.; + name = "riscv-formal-source"; + }; + shell = + let + riscv64-linux = prev.pkgsCross.riscv64-embedded.__splicedPackages; + in + { + tools = { + cabal = { }; + hlint = { }; + }; + nativeBuildInputs = [ + qemu + riscv64-linux.gcc + riscv64-linux.binutils + riscv64-linux.glibc + ]; + }; + } + ) { }; + }) + ]; + }; + flake = pkgs.riscv-formal.flake { }; + in + flake + ); + + nixConfig = { + # https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html#setting-up-the-binary-cache + extra-substituters = [ "https://cache.iog.io" ]; + extra-trusted-public-keys = [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; + allow-import-from-derivation = true; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index f5f7ad1..0000000 --- a/shell.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs ? import {} }: - -let - riscv64-linux = pkgs.pkgsCross.riscv64.__splicedPackages; -in -pkgs.mkShell { - nativeBuildInputs = [ - riscv64-linux.gcc - riscv64-linux.binutils - riscv64-linux.glibc - ]; - - shellHook = '' - echo "RISC-V Linux cross-compilation environment initialized!" - ''; -} From 3c14139753da181408d2de0addba7807d3e89ecb Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 21 Feb 2025 23:13:45 +0200 Subject: [PATCH 03/10] Rename rv_formal.cabal to rvFormal It appears that the convention is to use the package name as the filename ``` error: path '/nix/store/3bljihq1ighvsr9ghaw5fvflcdapsrff-haskell-project-plan-to-nix-pkgs/.plan.nix/rvFormal.nix' does not exist ``` --- cabal.project | 2 +- rv_formal.cabal => rvFormal.cabal | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename rv_formal.cabal => rvFormal.cabal (100%) diff --git a/cabal.project b/cabal.project index 255da59..3675f5f 100644 --- a/cabal.project +++ b/cabal.project @@ -1,5 +1,5 @@ packages: - rv_formal.cabal + rvFormal.cabal packages: . builddir: build diff --git a/rv_formal.cabal b/rvFormal.cabal similarity index 100% rename from rv_formal.cabal rename to rvFormal.cabal From c82dfbe2a77ce4d7381111b844421e8aa1ec96ad Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 22 Feb 2025 21:44:28 +0200 Subject: [PATCH 04/10] hello_world: Fix stat with coreutils(linux) the development nix shell has coreutils --- rv_tests/hello_world/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rv_tests/hello_world/Makefile b/rv_tests/hello_world/Makefile index 468fa6f..7a70dc4 100644 --- a/rv_tests/hello_world/Makefile +++ b/rv_tests/hello_world/Makefile @@ -28,7 +28,7 @@ $(ELF): $(SRC) $(LDSCRIPT) $(BIN): $(ELF) $(OBJCOPY) -O binary $(ELF) $(BIN) # Pad the binary to a multiple of 4 bytes - size=$$(stat -f%z $(BIN)); \ + size=$$(stat -c %s $(BIN)); \ padding=$$(( (4 - (size % 4)) % 4 )); \ [ $$padding -ne 0 ] && dd if=/dev/zero bs=1 count=$$padding >> $(BIN) || true From c75ad4fa70a7f0b8ec203d3a5843733eb96bbcb3 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 22 Feb 2025 22:15:33 +0200 Subject: [PATCH 05/10] Remove `stack.yaml` Seems unneeded ``` trace: haskell-nix.project : both 'stack.yaml' and 'cabal.project' files exist. Using 'cabal.project'. set 'projectFileName = "stack.yaml";' to override this.' ``` --- stack.yaml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 stack.yaml diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index cb1198d..0000000 --- a/stack.yaml +++ /dev/null @@ -1,10 +0,0 @@ -resolver: lts-21.20 - -extra-deps: - - GenericPretty-1.2.2 - - clash-ghc-1.8.1 - - clash-prelude-1.8.1 - - clash-lib-1.8.1 - - concurrent-supply-0.1.8 - - prettyprinter-interp-0.2.0.0 - - pretty-show-1.10 From 2b9895f1cc9c6013fb96509c43264cd70076b2fc Mon Sep 17 00:00:00 2001 From: Artturin Date: Sat, 22 Feb 2025 22:29:46 +0200 Subject: [PATCH 06/10] Use newer ghc Old output of `cabal run main --ghc-options="-D_RAM_DEPTH=2048" -- --firmware=./rv_tests/hello_world/hello.bin` ``` Simulating Machine Decoded instruction: AUIPC (UTypeFields 23 11 0) | Binary: 0b0000_0000_0000_0000_0000_0101_1001_0111 (1431) Decoded instruction: ADDI (ITypeFields 19 11 0 11 28) | Binary: 0b0000_0001_1100_0101_1000_0101_1001_0011 (29722003) Decoded instruction: LBU (ITypeFields 3 10 4 11 0) | Binary: 0b0000_0000_0000_0101_1100_0101_0000_0011 (378115) Decoded instruction: Unimplemented | Binary: 0b0000_0010_1011_0111_1100_0101_0001_1001 (45597977) Decoded instruction: Unimplemented | Binary: 0b1000_0000_0010_0011_0001_0000_0000_0000 (2149781504) Decoded instruction: Unimplemented | Binary: 0b0000_0101_1000_0101_0000_0000_1010_0010 (92602530) Decoded instruction: Unimplemented | Binary: 0b1010_0000_0000_0001_1011_1111_1100_0101 (2684469189) Decoded instruction: Unimplemented | Binary: 0b0110_1100_0110_1100_0110_0101_0100_1000 (1819043144) Decoded instruction: JAL (JTypeFields 111 24 975876) | Binary: 0b0111_0111_0010_0000_0010_1100_0110_1111 (1998597231) Decoded instruction: JAL (JTypeFields 111 4 822670) | Binary: 0b0110_0100_0110_1100_0111_0010_0110_1111 (1684828783) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_1010_0010_0001 (2593) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Last state: Machine {cpu = RISCVCPU {pc = 60, gpr = 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> Nil, fpr = 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0:> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> Nil, privilegeLevel = MachineMode}, peripherals = Peripherals {ram = 3 :> 29722003 :> 378115 :> 45597977 :> 2149781504 :> 92602530 :> 2684469189 :> 1819043144 :> 1998597231 :> 1684828783 :> 2593 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :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 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> Nil}} Executed for 16 cycles Simulation complete ``` New output ``` Simulating Machine Decoded instruction: AUIPC (UTypeFields 23 11 0) | Binary: 0b0000_0000_0000_0000_0000_0101_1001_0111 (1431) Decoded instruction: ADDI (ITypeFields 19 11 0 11 28) | Binary: 0b0000_0001_1100_0101_1000_0101_1001_0011 (29722003) Decoded instruction: LBU (ITypeFields 3 10 4 11 0) | Binary: 0b0000_0000_0000_0101_1100_0101_0000_0011 (378115) Decoded instruction: Unimplemented | Binary: 0b0000_0010_1011_0111_1100_0101_0001_1001 (45597977) Decoded instruction: Unimplemented | Binary: 0b1000_0000_0010_0011_0001_0000_0000_0000 (2149781504) Decoded instruction: Unimplemented | Binary: 0b0000_0101_1000_0101_0000_0000_1010_0010 (92602530) Decoded instruction: Unimplemented | Binary: 0b1010_0000_0000_0001_1011_1111_1100_0101 (2684469189) Decoded instruction: Unimplemented | Binary: 0b0110_1100_0110_1100_0110_0101_0100_1000 (1819043144) Decoded instruction: JAL (JTypeFields 111 24 975876) | Binary: 0b0111_0111_0010_0000_0010_1100_0110_1111 (1998597231) Decoded instruction: JAL (JTypeFields 111 4 822670) | Binary: 0b0110_0100_0110_1100_0111_0010_0110_1111 (1684828783) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_1010_0010_0001 (2593) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Decoded instruction: Unimplemented | Binary: 0b0000_0000_0000_0000_0000_0000_0000_0000 (0) Last state: Machine {cpu = RISCVCPU {pc = 60, gpr = 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> Nil, fpr = 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0:> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 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 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> 0 :> Nil}} Executed for 16 cycles Simulation complete ``` As you can see both are the same --- flake.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 7e9ef01..6ff7998 100644 --- a/flake.nix +++ b/flake.nix @@ -24,9 +24,7 @@ qemu, }: haskell-nix.hix.project { - compiler-nix-name = "ghc948"; - # This works - #compiler-nix-name = "ghc966"; + compiler-nix-name = "ghc966"; src = builtins.path { path = ./.; name = "riscv-formal-source"; From 56a80fe749e226ab6fa14f1ea8aed5298e240584 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 14 Mar 2025 00:17:51 +0200 Subject: [PATCH 07/10] Riscv config --- flake.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 6ff7998..0c33b1c 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,19 @@ }; shell = let - riscv64-linux = prev.pkgsCross.riscv64-embedded.__splicedPackages; + #riscv64-linux = prev.pkgsCross.riscv64-embedded.__splicedPackages; + riscv64-linux = (import prev.pkgs.path { + localSystem = system; + crossSystem = { + + config = "riscv64-none-elf"; + libc = "newlib"; + gcc = { + arch = "rv64g"; + abi = "lp64d"; + }; + }; + }).__splicedPackages; in { tools = { From ac8a2ea2388c08ab532bcc03fc7e012c426e3ce6 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 14 Mar 2025 00:43:24 +0200 Subject: [PATCH 08/10] flake.nix: Comments --- flake.nix | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index 0c33b1c..500d77e 100644 --- a/flake.nix +++ b/flake.nix @@ -31,19 +31,25 @@ }; shell = let - #riscv64-linux = prev.pkgsCross.riscv64-embedded.__splicedPackages; - riscv64-linux = (import prev.pkgs.path { - localSystem = system; - crossSystem = { + riscv64-linux = prev.pkgsCross.riscv64-embedded.__splicedPackages; + # Everything here builds and runs without needing the below crossSystem + #riscv64-linux = (import prev.pkgs.path { + # localSystem = system; + # crossSystem = { - config = "riscv64-none-elf"; - libc = "newlib"; - gcc = { - arch = "rv64g"; - abi = "lp64d"; - }; - }; - }).__splicedPackages; + # config = "riscv64-none-elf"; + # libc = "newlib"; + # gcc = { + # # Both sets work to build and run hello_world + # # This matches what is in the makefile + # #arch = "rv64ima"; + # #abi = "lp64"; + # # This matches what you asked for on matrix + # #arch = "rv64g"; + # #abi = "lp64d"; + # }; + # }; + #}).__splicedPackages; in { tools = { From 0960ceb53ac076d313d65d0279274a8b801f8a96 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 14 Mar 2025 01:09:02 +0200 Subject: [PATCH 09/10] rv_tests/hello_world: Rename PREFIX var to CROSS_PREFIX and make it configurable And set it in devShell --- flake.nix | 3 +++ rv_tests/hello_world/Makefile | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 500d77e..06f0db8 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,9 @@ riscv64-linux.binutils riscv64-linux.glibc ]; + shellHook = '' + export CROSS_PREFIX="riscv64-none-elf" + ''; }; } ) { }; diff --git a/rv_tests/hello_world/Makefile b/rv_tests/hello_world/Makefile index 7a70dc4..f362111 100644 --- a/rv_tests/hello_world/Makefile +++ b/rv_tests/hello_world/Makefile @@ -1,9 +1,9 @@ # RISC-V toolchain -PREFIX = riscv64-unknown-elf -CC = $(PREFIX)-gcc -AS = $(PREFIX)-as -LD = $(PREFIX)-ld -OBJCOPY = $(PREFIX)-objcopy +CROSS_PREFIX ?= riscv64-unknown-elf +CC = $(CROSS_PREFIX)-gcc +AS = $(CROSS_PREFIX)-as +LD = $(CROSS_PREFIX)-ld +OBJCOPY = $(CROSS_PREFIX)-objcopy QEMU = qemu-system-riscv64 # Compilation flags From 8037eeba195145762de6cf9b1e0a2fd81368cd9c Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 14 Mar 2025 01:43:26 +0200 Subject: [PATCH 10/10] flake.nix: Remove cross glibc On darwin in `nativeBuildInputs` ``` error: Package _glibc-nolibgcc-2.40-36_ in /nix/store/813bk6hvhfjjjmzlk2cxgxgd25yqq5f8-source/pkgs/development/libraries/glibc /default.nix:214 is not available on the requested hostPlatform: hostPlatform.config = "aarch64-apple-darwin" ``` in `buildInputs` ``` is not available on the requested hostPlatform: hostPlatform.config = "riscv64-none-elf" ``` --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 06f0db8..17fea13 100644 --- a/flake.nix +++ b/flake.nix @@ -60,7 +60,6 @@ qemu riscv64-linux.gcc riscv64-linux.binutils - riscv64-linux.glibc ]; shellHook = '' export CROSS_PREFIX="riscv64-none-elf"