Compare commits

...

2 Commits

3 changed files with 6 additions and 9 deletions

View File

@ -7,8 +7,8 @@
buildPhase = buildPhase =
'' ''
mkdir $out mkdir $out
${yosys}/bin/yosys -p "read_ilang $src/top.il; synth_ecp5 -top top -json $out/top.json" ${yosys}/bin/yosys -p "read_ilang $src/top.il; synth_ecp5 -top top -nomux -json $out/top.json"
${pkgs.nextpnr}/bin/nextpnr-ecp5 --json $out/top.json --textcfg $out/top.config `cat $src/device` --lpf $src/top.lpf ${pkgs.nextpnr}/bin/nextpnr-ecp5 --json $out/top.json --textcfg $out/top.config `cat $src/device` --lpf $src/top.lpf --freq 100
${pkgs.trellis}/bin/ecppack --svf-rowsize 100000 --svf $out/top.svf $out/top.config $out/top.bit ${pkgs.trellis}/bin/ecppack --svf-rowsize 100000 --svf $out/top.svf $out/top.config $out/top.bit
''; '';
}; };

View File

@ -1,4 +1,4 @@
{ rustPlatform, rust-riscv32i-crates, binutils-riscv32, rustc, cargo }: { rustPlatform, rust-riscv32i-crates, binutils-riscv32 }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
name = "helloworld"; name = "helloworld";
@ -7,14 +7,10 @@ rustPlatform.buildRustPackage rec {
src = ./.; src = ./.;
cargoSha256 = "0kf2pnfylfmzm0qvi4jfci43qvrnj1v5f037sb9zpvfqyddhdffl"; cargoSha256 = "0kf2pnfylfmzm0qvi4jfci43qvrnj1v5f037sb9zpvfqyddhdffl";
# HACK - rustc overlay does not update rustPlatform. Find out why.
configurePhase = ''echo XXX ${rustPlatform.rust.rustc} ${rustPlatform.rust.cargo}'';
buildPhase = '' buildPhase = ''
export CARGO_HOME=$(mktemp -d cargo-home.XXX) 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 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 build --release --target riscv32i-unknown-none-elf
${cargo}/bin/cargo build --release --target riscv32i-unknown-none-elf
''; '';
doCheck = false; doCheck = false;

View File

@ -1,5 +1,5 @@
self: super: self: super:
{ rec {
llvm_7 = super.llvm_7.overrideAttrs(oa: { llvm_7 = super.llvm_7.overrideAttrs(oa: {
name = oa.name + "-riscv"; name = oa.name + "-riscv";
cmakeFlags = oa.cmakeFlags ++ ["-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=RISCV"]; cmakeFlags = oa.cmakeFlags ++ ["-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=RISCV"];
@ -7,4 +7,5 @@ self: super:
rustc = super.rustc.overrideAttrs(oa: { rustc = super.rustc.overrideAttrs(oa: {
patches = oa.patches ++ [ ./compilers/rustc-riscv32i.patch ]; patches = oa.patches ++ [ ./compilers/rustc-riscv32i.patch ];
}); });
rustPlatform = super.makeRustPlatform { inherit rustc; inherit (super) cargo; };
} }