From d9b42a0807ab9c3cb13a8567e868bca89186693c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 9 Jun 2019 00:05:40 +0800 Subject: [PATCH] clean up firmware compilation --- firmware/default.nix | 8 ++------ overlay.nix | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/firmware/default.nix b/firmware/default.nix index c9bc25d..12373b3 100644 --- a/firmware/default.nix +++ b/firmware/default.nix @@ -1,4 +1,4 @@ -{ rustPlatform, rust-riscv32i-crates, binutils-riscv32, rustc, cargo }: +{ rustPlatform, rust-riscv32i-crates, binutils-riscv32 }: rustPlatform.buildRustPackage rec { name = "helloworld"; @@ -7,14 +7,10 @@ rustPlatform.buildRustPackage rec { src = ./.; cargoSha256 = "0kf2pnfylfmzm0qvi4jfci43qvrnj1v5f037sb9zpvfqyddhdffl"; - # HACK - rustc overlay does not update rustPlatform. Find out why. - configurePhase = ''echo XXX ${rustPlatform.rust.rustc} ${rustPlatform.rust.cargo}''; - buildPhase = '' export CARGO_HOME=$(mktemp -d cargo-home.XXX) export RUSTFLAGS="-L ${rust-riscv32i-crates}/lib/rustlib/riscv32i-unknown-none-elf/lib -C linker=${binutils-riscv32}/bin/riscv32-unknown-elf-ld -C link-arg=-Tlink.x" - export RUSTC=${rustc}/bin/rustc - ${cargo}/bin/cargo build --release --target riscv32i-unknown-none-elf + cargo build --release --target riscv32i-unknown-none-elf ''; doCheck = false; diff --git a/overlay.nix b/overlay.nix index b5ea8a6..a3b4d80 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,5 +1,5 @@ self: super: -{ +rec { llvm_7 = super.llvm_7.overrideAttrs(oa: { name = oa.name + "-riscv"; cmakeFlags = oa.cmakeFlags ++ ["-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=RISCV"]; @@ -7,4 +7,5 @@ self: super: rustc = super.rustc.overrideAttrs(oa: { patches = oa.patches ++ [ ./compilers/rustc-riscv32i.patch ]; }); + rustPlatform = super.makeRustPlatform { inherit rustc; inherit (super) cargo; }; }