Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed legacy toolchain from default devshell #55

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions examples/automotive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
```
Comment on lines +36 to +44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is merged already so it is fine, but I would like to see a comment here mentioning that the xmake -P examples/automotive/legacy command needs to be run in the .#env-with-everything Nix environment, as otherwise unsuspecting users who try and build the demo will get errors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point thanks alex

2 changes: 1 addition & 1 deletion examples/automotive/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Copyright lowRISC Contributors.
-- SPDX-License-Identifier: Apache-2.0

includes("cheri", "legacy")
includes("cheri")
41 changes: 30 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -39,21 +37,31 @@
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/
'';
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;
version = "";
pname = "sonata-software-documentation";
src = fileset.toSource {
root = ./.;
Expand Down Expand Up @@ -173,7 +181,6 @@
++ [
lrPkgs.uf2conv
lrPkgs.cheriot-audit
lrPkgs.lowrisc-toolchain-gcc-rv32imcb
pkgs.python3Packages.pyserial
mdutilsPkgs.default
];
Expand All @@ -183,8 +190,20 @@
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];
};
Comment on lines +193 to +196
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me, but would it be possible to just have a legacy environment or equivalent that does not include the simulator build? It its quite a lengthy process to build the sim, and as far as I'm aware this isn't needed to build legacy baremetal software.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to avoid having too many environments, so I thought I'd make a catchall everything environment. But I suppose people can always overlay environments, open to changing

};
packages = {
inherit
sonata-exercises
sonata-examples
sonata-tests
sonata-software-documentation
sonata-automotive-demo-legacy-component
;
};
packages = {inherit sonata-exercises sonata-examples sonata-tests sonata-software-documentation;};
checks = {inherit tests-simulator;};
apps = builtins.listToAttrs (map (program: {
inherit (program) name;
Expand Down