1
0
Fork 0

build Urukul CPLD gateware

This commit is contained in:
Sebastien Bourdeauducq 2019-07-03 23:01:31 +08:00
parent 07daeb2572
commit 8de1dbdd53
5 changed files with 81 additions and 6 deletions

View File

@ -104,12 +104,13 @@ rec {
migen = python3Packages.buildPythonPackage rec {
name = "migen";
src = fetchFromGitHub {
owner = "m-labs";
repo = "migen";
rev = "caab41469f5a0cb4014bc00a03898a0b76b00dd1";
sha256 = "06zbbbjzlbyq2nlp13hyk8diw06zrffc37n4b6cxzk1i2aq8g83m";
};
#src = fetchFromGitHub {
# owner = "m-labs";
# repo = "migen";
# rev = "caab41469f5a0cb4014bc00a03898a0b76b00dd1";
# sha256 = "06zbbbjzlbyq2nlp13hyk8diw06zrffc37n4b6cxzk1i2aq8g83m";
#};
src = /home/sb/migen;
propagatedBuildInputs = with python3Packages; [ colorama sphinx sphinx_rtd_theme ];

View File

@ -38,6 +38,23 @@
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
"m-labs": { "type": "sysbuild", "value": "artiq:main:generated-nix", "emailresponsible": false }
}
},
"urukul": {
"enabled": 1,
"hidden": false,
"description": "Urukul CPLD gateware",
"nixexprinput": "nixScripts",
"nixexprpath": "urukul.nix",
"checkinterval": 172800,
"schedulingshares": 1,
"enableemail": false,
"emailoverride": "",
"keepnr": 10,
"inputs": {
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-19.03", "emailresponsible": false },
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
"urukulSrc": { "type": "git", "value": "git://github.com/quartiq/urukul", "emailresponsible": false }
}
}
}
EOF

6
urukul.nix Normal file
View File

@ -0,0 +1,6 @@
{ pkgs ? import <nixpkgs> {} }:
let
jobs = import ./urukul/default.nix { inherit pkgs; };
in
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) jobs

20
urukul/default.nix Normal file
View File

@ -0,0 +1,20 @@
{ pkgs ? import <nixpkgs> {} }:
let
migen = (pkgs.callPackage ../artiq/pkgs/python-deps.nix {}).migen;
ise = import ./ise.nix { inherit pkgs; };
in
{
urukul-cpld = pkgs.stdenv.mkDerivation {
name = "urukul-cpld";
src = <urukulSrc>;
buildInputs = [(pkgs.python3.withPackages(ps: [migen]))] ++ (builtins.attrValues ise);
phases = ["buildPhase" "installPhase"];
buildPhase = "python $src/urukul_impl.py";
installPhase =
''
mkdir -p $out $out/nix-support
cp build/urukul.jed $out
echo file binary-dist $out/urukul.jed >> $out/nix-support/hydra-build-products
'';
};
}

31
urukul/ise.nix Normal file
View File

@ -0,0 +1,31 @@
# Install ISE in /opt and add to /etc/nixos/configuration.nix:
# nix.sandboxPaths = ["/opt"];
{ pkgs, isePath ? "/opt/Xilinx/14.7/ISE_DS" }:
let
makeXilinxEnv = name: pkgs.buildFHSUserEnv {
inherit name;
targetPkgs = pkgs: (
with pkgs; [
ncurses5
zlib
libuuid
xorg.libSM
xorg.libICE
xorg.libXrender
xorg.libX11
xorg.libXext
xorg.libXtst
xorg.libXi
]
);
profile =
''
source ${isePath}/common/.settings64.sh ${isePath}/common
source ${isePath}/ISE/.settings64.sh ${isePath}/ISE
'';
runScript = name;
};
in
pkgs.lib.attrsets.genAttrs ["xst" "ngdbuild" "cpldfit" "taengine" "hprep6"] makeXilinxEnv