Browse Source

clean up firmware compilation

pull/1/head
parent
commit
d9b42a0807
  1. 8
      firmware/default.nix
  2. 3
      overlay.nix

8
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;

3
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; };
}
Loading…
Cancel
Save