use nixpkgs 19.03

* too much breakage on nixos-unstable
* we should track upstream yosys/nextpnr more closely than nixpkgs does
This commit is contained in:
Sebastien Bourdeauducq 2019-07-29 14:58:31 +08:00
parent 87acbacf87
commit 12032433ed
4 changed files with 99 additions and 30 deletions

View File

@ -15,7 +15,14 @@ Softcore system-on-chip on the Lattice ECP5 Versa board, built with a 100% Veril
* 100MHz clock frequency. * 100MHz clock frequency.
* Runs a Rust "hello world" program. * Runs a Rust "hello world" program.
Use nixpkgs unstable (known to work with ae71c13). Check https://nixbld.m-labs.hk/project/fpga for the status of the build with other nixpkgs versions. Use nixpkgs 19.03. If you are unfamiliar with Nix and just installed it on another (non-NixOS) distribution, simply run:
```
$ nix-channel --remove nixpkgs
$ nix-channel --add https://nixos.org/channels/nixos-19.03 nixpkgs
$ nix-channel --update
```
Optional: set up the M-Labs key and binary substituter for Nix (otherwise Nix will recompile LLVM, rustc, etc. on your machine). Optional: set up the M-Labs key and binary substituter for Nix (otherwise Nix will recompile LLVM, rustc, etc. on your machine).
Create the file ``~/.config/nix/nix.conf`` with the following contents: Create the file ``~/.config/nix/nix.conf`` with the following contents:
@ -27,6 +34,8 @@ trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDS
Run ``nix-build -A simplesoc_ecp5 release.nix`` Run ``nix-build -A simplesoc_ecp5 release.nix``
You can also build manually and use your distribution's packages, but YMMV.
Bypass the ispCLOCK device using the jumpers on your board. Bypass the ispCLOCK device using the jumpers on your board.
Create a ``versa.cfg`` file with: Create a ``versa.cfg`` file with:

View File

@ -1,12 +1,4 @@
{ stdenv, rustc, fetchFromGitHub }: { stdenv, rustc }:
let
compiler-builtins-src = fetchFromGitHub {
owner = "rust-lang-nursery";
repo = "compiler-builtins";
rev = "0.1.12";
sha256 = "0hkssvrh952kcz7w7aws3pqr05barg3qppqpji641b35xpbg9gyg";
};
in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "rust-riscv32i-crates"; name = "rust-riscv32i-crates";
src = rustc.src; src = rustc.src;
@ -18,7 +10,7 @@ in
mkdir -p ''${destdir} mkdir -p ''${destdir}
export RUSTC_BOOTSTRAP=1 export RUSTC_BOOTSTRAP=1
''${rustc} --crate-name core src/libcore/lib.rs ''${rustc} --crate-name core src/libcore/lib.rs
''${rustc} --crate-name compiler_builtins ${compiler-builtins-src}/src/lib.rs --cfg 'feature="compiler-builtins"' --cfg 'feature="mem"' ''${rustc} --crate-name compiler_builtins src/libcompiler_builtins/src/lib.rs --cfg 'feature="compiler-builtins"' --cfg 'feature="mem"'
''; '';
# ''${rustc} --crate-name alloc src/liballoc/lib.rs # ''${rustc} --crate-name alloc src/liballoc/lib.rs
# ''${rustc} --crate-name libc ${./libc_mini.rs} # ''${rustc} --crate-name libc ${./libc_mini.rs}

View File

@ -1,5 +1,73 @@
self: super: self: super:
rec { rec {
yosys = super.yosys.overrideAttrs(oa: rec {
name = "yosys-${version}";
version = "2019-07-27";
srcs = [
(super.fetchFromGitHub {
owner = "yosyshq";
repo = "yosys";
rev = "6538671c84a12114a991d59569eede3e0d368758";
sha256 = "1l6v94a9vh9krmfsmd3v8l8xciwf028xvg93qf80s8a75djm7bc3";
name = "yosys";
})
# NOTE: the version of abc used here is synchronized with
# the one in the yosys Makefile of the version above;
# keep them the same for quality purposes.
(super.fetchFromGitHub {
owner = "berkeley-abc";
repo = "abc";
rev = "5776ad07e7247993976bffed4802a5737c456782";
sha256 = "1la4idmssg44rp6hd63sd5vybvs3vr14yzvwcg03ls37p39cslnl";
name = "yosys-abc";
})
];
buildInputs = oa.buildInputs ++ [ super.zlib ];
});
nextpnr = super.nextpnr.overrideAttrs(oa: rec {
name = "nextpnr-${version}";
version = "2019-07-22";
src = super.fetchFromGitHub {
owner = "yosyshq";
repo = "nextpnr";
rev = "ba050c21b94e816f9dd69f69b23ad5105858f401";
sha256 = "1wxsv1lcbi6bvv5vryvjz9mj530iva85wh6b6pvnfff2i4yc3p9q";
};
buildInputs = oa.buildInputs ++ [ super.eigen ];
cmakeFlags = oa.cmakeFlags ++ [ "-DUSE_OPENMP=ON" ];
});
icestorm = super.icestorm.overrideAttrs(oa: rec {
name = "icestorm-${version}";
version = "2019-07-03";
src = super.fetchFromGitHub {
owner = "cliffordwolf";
repo = "icestorm";
rev = "792cef084a751e32f541332feb4905f8e49e9943";
sha256 = "115qmgcz5ndw4z8ivk1cdlz6i2dzhq195gr8y4fjrjcb5jlacz23";
};
});
trellis = super.trellis.overrideAttrs(oa: rec {
name = "trellis-${version}";
version = "2019-07-18";
srcs = [
(super.fetchFromGitHub {
owner = "symbiflow";
repo = "prjtrellis";
rev = "b27c0da5d20a4c105fe9be2b5f8d859316613f44";
sha256 = "12jcs64agv5yhqq4zwjp2vd9y248608hz1gj187g1cfqrv0yc8d5";
name = "trellis";
})
(super.fetchFromGitHub {
owner = "symbiflow";
repo = "prjtrellis-db";
rev = "b4d626b6402c131e9a035470ffe4cf33ccbe7986";
sha256 = "0k26lq6c049ja8hhqcljwjb1y5k4gcici23l2n86gyp83jr03ilx";
name = "database";
})
];
});
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"];

View File

@ -3,7 +3,7 @@ let
pkgs = import <nixpkgs> { overlays = [ (import ./overlay.nix) ]; }; pkgs = import <nixpkgs> { overlays = [ (import ./overlay.nix) ]; };
hx = import ./default.nix { inherit pkgs; }; hx = import ./default.nix { inherit pkgs; };
jobs = hx // { jobs = hx // {
inherit (pkgs) llvm_7 rustc cargo cargo-vendor; inherit (pkgs) yosys nextpnr icestorm trellis llvm_7 rustc cargo cargo-vendor;
helloworld_ecp5 = import ./examples/helloworld_ecp5.nix { inherit pkgs hx; }; helloworld_ecp5 = import ./examples/helloworld_ecp5.nix { inherit pkgs hx; };
helloworld_kintex7 = import ./examples/helloworld_kintex7.nix { inherit pkgs hx; }; helloworld_kintex7 = import ./examples/helloworld_kintex7.nix { inherit pkgs hx; };