also build riscv64 binutils

This commit is contained in:
Sebastien Bourdeauducq 2019-06-08 19:25:38 +08:00
parent b22d85ba52
commit 8388018db7
2 changed files with 7 additions and 6 deletions

View File

@ -16,10 +16,11 @@ rec {
heavycomps = pkgs.callPackage ./heavycomps.nix { inherit nmigen; }; 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 { }; 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 = { lib = {
symbiflow = import ./eda/symbiflow.nix { inherit pkgs; inherit (drvs) yosys; }; symbiflow = import ./eda/symbiflow.nix { inherit pkgs; inherit (drvs) yosys; };

View File

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