Browse Source

also build riscv64 binutils

pull/1/head
parent
commit
8388018db7
  1. 5
      default.nix
  2. 8
      firmware/default.nix

5
default.nix

@ -16,10 +16,11 @@ rec {
heavycomps = pkgs.callPackage ./heavycomps.nix { inherit nmigen; };
binutils-riscv = pkgs.callPackage ./compilers/binutils.nix { platform = "riscv32"; };
binutils-riscv32 = pkgs.callPackage ./compilers/binutils.nix { platform = "riscv32"; };
binutils-riscv64 = pkgs.callPackage ./compilers/binutils.nix { platform = "riscv64"; };
rust-riscv32imc-crates = pkgs.callPackage ./compilers/rust-riscv32imc-crates.nix { };
fw-helloworld = pkgs.callPackage ./firmware { inherit rust-riscv32imc-crates binutils-riscv; };
fw-helloworld = pkgs.callPackage ./firmware { inherit rust-riscv32i-crates binutils-riscv32; };
};
lib = {
symbiflow = import ./eda/symbiflow.nix { inherit pkgs; inherit (drvs) yosys; };

8
firmware/default.nix

@ -1,4 +1,4 @@
{ rustPlatform, rust-riscv32imc-crates, binutils-riscv }:
{ rustPlatform, rust-riscv32i-crates, binutils-riscv32 }:
rustPlatform.buildRustPackage rec {
name = "helloworld";
@ -9,14 +9,14 @@ rustPlatform.buildRustPackage rec {
buildPhase = ''
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
export RUSTFLAGS="-L ${rust-riscv32imc-crates}/lib/rustlib/riscv32imc-unknown-none-elf/lib -C linker=${binutils-riscv}/bin/riscv32-unknown-elf-ld -C link-arg=-Tlink.x"
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"
cargo build --release --target riscv32imc-unknown-none-elf
'';
doCheck = false;
installPhase = ''
mkdir -p $out
cp target/riscv32imc-unknown-none-elf/release/helloworld $out
${binutils-riscv}/bin/riscv32-unknown-elf-objcopy -O binary target/riscv32imc-unknown-none-elf/release/helloworld $out/helloworld.bin
cp target/riscv32i-unknown-none-elf/release/helloworld $out
${binutils-riscv32}/bin/riscv32-unknown-elf-objcopy -O binary target/riscv32i-unknown-none-elf/release/helloworld $out/helloworld.bin
'';
}
Loading…
Cancel
Save