From ae5fa38e488f3361d543ce16b56ca62934998eeb Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Thu, 17 Oct 2024 06:12:31 +0100 Subject: [PATCH 1/4] nix: Removed legacy toolchain from default devshell The lowrisc-it legacy toolchain only supports linux so removed it from the default environment so macos users can use default environment. Made a new `env-with-everything` environment that includes everything (and therefore only supports linux). --- flake.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 222342e..7c24660 100644 --- a/flake.nix +++ b/flake.nix @@ -173,7 +173,6 @@ ++ [ lrPkgs.uf2conv lrPkgs.cheriot-audit - lrPkgs.lowrisc-toolchain-gcc-rv32imcb pkgs.python3Packages.pyserial mdutilsPkgs.default ]; @@ -183,6 +182,10 @@ packages = [sonataSystemPkgs.sonata-simulator] ++ default.nativeBuildInputs; SONATA_SIM_BOOT_STUB = "${sonataSystemPkgs.sonata-sim-boot-stub.out}/share/sim_boot_stub"; }; + env-with-everything = pkgs.mkShell { + name = "sonata-sw-with-everything"; + packages = env-with-sim.nativeBuildInputs ++ [lrPkgs.lowrisc-toolchain-gcc-rv32imcb]; + }; }; packages = {inherit sonata-exercises sonata-examples sonata-tests sonata-software-documentation;}; checks = {inherit tests-simulator;}; From 41636e3cb72278bf81f14cdb8a002f548b52ef34 Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Thu, 17 Oct 2024 06:34:02 +0100 Subject: [PATCH 2/4] xmake: removed legacy build from examples build You will now have to build the legacy component seperately with: ```sh xmake -P examples/automotive/legacy ``` --- examples/automotive/README.md | 10 ++++++++++ examples/automotive/xmake.lua | 2 +- flake.nix | 7 +------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/automotive/README.md b/examples/automotive/README.md index 7f3f3a8..fdd8c38 100644 --- a/examples/automotive/README.md +++ b/examples/automotive/README.md @@ -32,3 +32,13 @@ The demo does feature different applications which can run with varying amounts of hardware availability, as detailed in the library documentation, but the minimum requirement is at least the two boards and the connecting Ethernet cable. + +## Building + +The cheriot componenents of this demo are built along with the rest of the examples. +However, the legacy component needs to be build seperately. + +```sh +xmake -P examples +xmake -P examples/automotive/legacy/ +``` diff --git a/examples/automotive/xmake.lua b/examples/automotive/xmake.lua index d0d99fc..fda9683 100644 --- a/examples/automotive/xmake.lua +++ b/examples/automotive/xmake.lua @@ -1,4 +1,4 @@ -- Copyright lowRISC Contributors. -- SPDX-License-Identifier: Apache-2.0 -includes("cheri", "legacy") +includes("cheri") diff --git a/flake.nix b/flake.nix index 7c24660..48e6601 100644 --- a/flake.nix +++ b/flake.nix @@ -39,12 +39,7 @@ inherit (pkgs.lib) fileset getExe; commonSoftwareBuildAttributes = { - buildInputs = - cheriotPkgs - ++ [ - lrPkgs.uf2conv - lrPkgs.lowrisc-toolchain-gcc-rv32imcb - ]; + buildInputs = cheriotPkgs ++ [lrPkgs.uf2conv]; installPhase = '' mkdir -p $out/share/ cp build/cheriot/cheriot/release/* $out/share/ From a64727000b3b97c1e29f728c4a0da02ed87a1a35 Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Thu, 17 Oct 2024 06:41:19 +0100 Subject: [PATCH 3/4] ci: Added automotive legacy component build to ci --- .github/workflows/ci.yml | 1 + flake.nix | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 554ab58..ac6d334 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: run: | nix build -L .?submodules=1#sonata-exercises nix build -L .?submodules=1#sonata-examples + nix build -L .?submodules=1#sonata-automotive-demo-legacy-component nix build -L .?submodules=1#sonata-tests - name: Run Nix Checks diff --git a/flake.nix b/flake.nix index 48e6601..c6f3a94 100644 --- a/flake.nix +++ b/flake.nix @@ -47,6 +47,21 @@ dontFixup = true; }; + sonata-automotive-demo-legacy-component = pkgs.stdenvNoCC.mkDerivation { + name = "sonata-automotive-demo-legacy-component"; + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [./examples/automotive ./third_party]; + }; + buildInputs = with lrPkgs; [xmake lowrisc-toolchain-gcc-rv32imcb]; + buildPhase = "xmake -P ./examples/automotive/legacy/"; + installPhase = '' + mkdir -p $out/share/ + cp build/ilp32/rv32imc/release/automotive_demo_send_legacy $out/share + ''; + dontFixup = true; + }; + sonata-software-documentation = lrDoc.buildMdbookSite { inherit version; pname = "sonata-software-documentation"; @@ -182,7 +197,15 @@ packages = env-with-sim.nativeBuildInputs ++ [lrPkgs.lowrisc-toolchain-gcc-rv32imcb]; }; }; - packages = {inherit sonata-exercises sonata-examples sonata-tests sonata-software-documentation;}; + packages = { + inherit + sonata-exercises + sonata-examples + sonata-tests + sonata-software-documentation + sonata-automotive-demo-legacy-component + ; + }; checks = {inherit tests-simulator;}; apps = builtins.listToAttrs (map (program: { inherit (program) name; From 804e8c7106697a66c9e51903df731b7cf6a98d7b Mon Sep 17 00:00:00 2001 From: Hugo McNally Date: Thu, 17 Oct 2024 06:44:45 +0100 Subject: [PATCH 4/4] nix: removed version, we weren't keeping it up to date. --- flake.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index c6f3a94..036d939 100644 --- a/flake.nix +++ b/flake.nix @@ -27,8 +27,6 @@ mdutils, }: let system_outputs = system: let - version = "0.0.1"; - pkgs = import nixpkgs {inherit system;}; lrPkgs = lowrisc-nix.outputs.packages.${system}; mdutilsPkgs = mdutils.outputs.packages.${system}; @@ -63,7 +61,7 @@ }; sonata-software-documentation = lrDoc.buildMdbookSite { - inherit version; + version = ""; pname = "sonata-software-documentation"; src = fileset.toSource { root = ./.;