forked from M-Labs/nix-scripts
Compare commits
203 Commits
Author | SHA1 | Date |
---|---|---|
Sebastien Bourdeauducq | f4a1a01e2f | |
Sebastien Bourdeauducq | 3cfc45e524 | |
Sebastien Bourdeauducq | 7256e73ffa | |
Sebastien Bourdeauducq | c0e2eee49d | |
Sebastien Bourdeauducq | b72d035311 | |
Sebastien Bourdeauducq | 05be2516c6 | |
Sebastien Bourdeauducq | 98f03c4833 | |
Florian Agbuya | 02ffc97089 | |
Sebastien Bourdeauducq | 54af3e9297 | |
Sebastien Bourdeauducq | d419b3628b | |
Sebastien Bourdeauducq | 6f72969ec9 | |
Sebastien Bourdeauducq | 052da73d2b | |
Sebastien Bourdeauducq | e097cb96f5 | |
Sebastien Bourdeauducq | 5bab9a19a5 | |
Sebastien Bourdeauducq | d24244541a | |
Robert Jördens | e16033c5fe | |
Sebastien Bourdeauducq | 8da02c60da | |
Robert Jördens | d9a6bdb674 | |
Sebastien Bourdeauducq | e457e3a2d5 | |
Sebastien Bourdeauducq | 2930368075 | |
Sebastien Bourdeauducq | bd612201ed | |
Sebastien Bourdeauducq | 7a9960df69 | |
Sebastien Bourdeauducq | 48af866c61 | |
Robert Jördens | 0ddaddb1dd | |
Robert Jördens | 033e75859e | |
Sebastien Bourdeauducq | 2bf0053836 | |
Sebastien Bourdeauducq | b8bfd3752f | |
Sebastien Bourdeauducq | 70c7289e37 | |
Sebastien Bourdeauducq | a410dd9c32 | |
Sebastien Bourdeauducq | 99629db276 | |
Sebastien Bourdeauducq | f0bbc40ca6 | |
Robert Jördens | e807e7d970 | |
SingularitySurfer | a9ef893ace | |
SingularitySurfer | ff98ed88c1 | |
Sebastien Bourdeauducq | 46f6e33837 | |
Sebastien Bourdeauducq | 76f691b641 | |
Sebastien Bourdeauducq | 8e0ff1d2ff | |
Leon Riesebos | eddcdb4043 | |
Sebastien Bourdeauducq | e340fa7548 | |
Sebastien Bourdeauducq | e5bc3d4598 | |
Sebastien Bourdeauducq | 22f555e7bd | |
Sebastien Bourdeauducq | 58f30f5d87 | |
Sebastien Bourdeauducq | 85fea0ba59 | |
Sebastien Bourdeauducq | bbb883ed82 | |
Sebastien Bourdeauducq | f819d41a77 | |
Sebastien Bourdeauducq | 906093d5e7 | |
mwojcik | 04cfdb54e1 | |
mwojcik | bc460e9490 | |
Sebastien Bourdeauducq | 5cec649d42 | |
Sebastien Bourdeauducq | ab95c16fb9 | |
Sebastien Bourdeauducq | 9bfc4aae59 | |
Sebastien Bourdeauducq | 2f493ab9d3 | |
mwojcik | 3d0e51171b | |
mwojcik | 3df3b7daa0 | |
Sebastien Bourdeauducq | 0fae14a5ad | |
Sebastien Bourdeauducq | 1500722258 | |
mwojcik | 5f90f65d59 | |
Sebastien Bourdeauducq | a069c0aba3 | |
mwojcik | 778dab71a2 | |
Sebastien Bourdeauducq | 436e0d8c88 | |
Sebastien Bourdeauducq | 9a8a59c525 | |
Sebastien Bourdeauducq | eff8968d26 | |
Sebastien Bourdeauducq | a3240b8fee | |
Sebastien Bourdeauducq | 926582acbd | |
Sebastien Bourdeauducq | 300ec387e3 | |
Sebastien Bourdeauducq | c0bf6837d9 | |
Sebastien Bourdeauducq | 679cd25a68 | |
Sebastien Bourdeauducq | e8bb121ece | |
Leon Riesebos | fddbc02db7 | |
Leon Riesebos | 71fd6ed87d | |
Leon Riesebos | 0ef16d8a7d | |
Robert Jördens | 3562f6f189 | |
Sebastien Bourdeauducq | 9a3d7451df | |
Sebastien Bourdeauducq | adc49f1f1c | |
Sebastien Bourdeauducq | 90bc26adc4 | |
Sebastien Bourdeauducq | ce89fc09bb | |
Robert Jördens | b0e723d565 | |
Sebastien Bourdeauducq | 09fd2cf946 | |
Sebastien Bourdeauducq | ecf6d1258a | |
Sebastien Bourdeauducq | d532f43278 | |
Sebastien Bourdeauducq | 3994e503bb | |
Sebastien Bourdeauducq | 1bcfecb9d7 | |
Sebastien Bourdeauducq | 8cb6a0bfd8 | |
Robert Jördens | 643ce70b4c | |
Sebastien Bourdeauducq | 46e745d310 | |
Sebastien Bourdeauducq | ae16ada2e3 | |
Sebastien Bourdeauducq | 7be44217fc | |
Sebastien Bourdeauducq | 70d07a336c | |
Sebastien Bourdeauducq | f8202340ea | |
Sebastien Bourdeauducq | 2c611a924d | |
mwojcik | 70a7719874 | |
Harry Ho | 2d179ac712 | |
mwojcik | 6146aa84dd | |
Sebastien Bourdeauducq | 62c16ce859 | |
Sebastien Bourdeauducq | d739286ff5 | |
Sebastien Bourdeauducq | 45eba9809e | |
Sebastien Bourdeauducq | 575ef05cd5 | |
mwojcik | cf0d3d70e6 | |
ciciwu | 06e1c2975e | |
Sebastien Bourdeauducq | 58f0452f84 | |
Sebastien Bourdeauducq | c706b6e0f4 | |
Sebastien Bourdeauducq | 8d4ffe3a77 | |
Sebastien Bourdeauducq | 9a08799d9b | |
Sebastien Bourdeauducq | 392237b486 | |
Sebastien Bourdeauducq | 6bdf39ef1f | |
Sebastien Bourdeauducq | 2afb9c94f3 | |
Sebastien Bourdeauducq | b456cee553 | |
Sebastien Bourdeauducq | 6416764277 | |
Sebastien Bourdeauducq | 57cc7a0a33 | |
Sebastien Bourdeauducq | c16bcd74d8 | |
Sebastien Bourdeauducq | 65e9f77019 | |
Sebastien Bourdeauducq | 70086fbfe0 | |
Sebastien Bourdeauducq | 88b98ac644 | |
Sebastien Bourdeauducq | 1754b13b73 | |
Sebastien Bourdeauducq | 1899a4f818 | |
Sebastien Bourdeauducq | fcc91513ec | |
Sebastien Bourdeauducq | 07620ae716 | |
Sebastien Bourdeauducq | 3fea3066ac | |
Sebastien Bourdeauducq | 54157028c9 | |
Sebastien Bourdeauducq | 4e00857fe1 | |
Sebastien Bourdeauducq | 45c3fa1817 | |
Sebastien Bourdeauducq | 91a583c960 | |
Sebastien Bourdeauducq | 498cb074af | |
Leon Riesebos | b438bf34b8 | |
Leon Riesebos | 80969c53d4 | |
Leon Riesebos | 8f4183157e | |
Sebastien Bourdeauducq | 108309388e | |
mwojcik | 495dc7ee4e | |
Sebastien Bourdeauducq | 9d34f0d091 | |
Sebastien Bourdeauducq | be78fd8b77 | |
Sebastien Bourdeauducq | 73a895b6e9 | |
mwojcik | 43e02c4f8f | |
Sebastien Bourdeauducq | f129fda7bc | |
Sebastien Bourdeauducq | 5b65a378bf | |
Sebastien Bourdeauducq | 2bb541a6af | |
Sebastien Bourdeauducq | ff4995e9ea | |
Sebastien Bourdeauducq | e8b885d7d0 | |
Sebastien Bourdeauducq | f773b5abeb | |
Sebastien Bourdeauducq | ca6111d0f5 | |
mwojcik | c5fb1c8038 | |
Sebastien Bourdeauducq | bb1585fbbd | |
Sebastien Bourdeauducq | 8d8ea8b377 | |
Sebastien Bourdeauducq | 1319a2f536 | |
Sebastien Bourdeauducq | 367c3d5ed5 | |
Sebastien Bourdeauducq | 9a76e0fdb6 | |
Sebastien Bourdeauducq | e79318171b | |
Sebastien Bourdeauducq | c9efc20aeb | |
Sebastien Bourdeauducq | f595103f17 | |
Sebastien Bourdeauducq | 2355ba148a | |
Harry Ho | 988d411946 | |
Harry Ho | 83baea2c4b | |
Sebastien Bourdeauducq | f23be562e0 | |
Sebastien Bourdeauducq | 7bde5a0406 | |
Sebastien Bourdeauducq | dacc57af74 | |
Sebastien Bourdeauducq | 5ea1d50226 | |
Sebastien Bourdeauducq | 92d2b24e7c | |
Leon Riesebos | 162238b1f7 | |
Leon Riesebos | 7a639e4fb4 | |
Leon Riesebos | f705a9c756 | |
Leon Riesebos | c967b67aa3 | |
Sebastien Bourdeauducq | 591ef2b4a6 | |
Sebastien Bourdeauducq | f581b6a649 | |
Sebastien Bourdeauducq | f35ae55a15 | |
Sebastien Bourdeauducq | ffe1fd2274 | |
Sebastien Bourdeauducq | c8742678c4 | |
Sebastien Bourdeauducq | db1bd9d5ae | |
Leon Riesebos | 4f37c250f4 | |
Harry Ho | a00537688c | |
Harry Ho | 45181c5c56 | |
Harry Ho | 868216eb2d | |
Harry Ho | e43223532c | |
Harry Ho | 2835575ee4 | |
Sebastien Bourdeauducq | 2a87c55e62 | |
Sebastien Bourdeauducq | 8646fd8822 | |
Sebastien Bourdeauducq | f3ddd838da | |
Sebastien Bourdeauducq | 7f0c746f99 | |
Sebastien Bourdeauducq | 6c768586b3 | |
Leon Riesebos | bfced456af | |
Leon Riesebos | 18f39a0868 | |
Leon Riesebos | a3fd10cef0 | |
Leon Riesebos | a162c7a65e | |
Leon Riesebos | fb0c412bb0 | |
Drew Risinger | 005d911fb7 | |
Sebastien Bourdeauducq | b8d4da3004 | |
Sebastien Bourdeauducq | e0b1b8576f | |
Sebastien Bourdeauducq | dc1dd6e61c | |
Sebastien Bourdeauducq | ac7b8b4029 | |
Sebastien Bourdeauducq | 69ba4229d2 | |
Sebastien Bourdeauducq | 63be59a677 | |
Sebastien Bourdeauducq | bdd57d8895 | |
Sebastien Bourdeauducq | 2c146918a9 | |
Sebastien Bourdeauducq | 9c3e77446c | |
Harry Ho | a6acfdca3a | |
Sebastien Bourdeauducq | 4d6d6efb71 | |
Sebastien Bourdeauducq | 79cb6fdcf7 | |
Sebastien Bourdeauducq | 5bd75bcbd2 | |
Drew Risinger | 10e6220703 | |
Sebastien Bourdeauducq | 5f7093fd7a | |
Harry Ho | b5e19a2944 | |
Leon Riesebos | d0e8cf00fa | |
Sebastien Bourdeauducq | 548eb53ccb | |
Sebastien Bourdeauducq | 2c378060e9 | |
Sebastien Bourdeauducq | a1d134ad25 |
|
@ -11,9 +11,10 @@ let
|
|||
pythonEnv = pkgs.python3.withPackages (ps: with ps; [
|
||||
jinja2 jsonschema numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq
|
||||
]);
|
||||
fetchcargo = import (artiq-fast + "/fetchcargo.nix") {
|
||||
fetchcargo = import (artiq-fast + "/fetchcargo-legacy.nix") {
|
||||
inherit (pkgs) stdenv lib cacert git;
|
||||
inherit (artiqpkgs) cargo cargo-vendor;
|
||||
cargo = artiqpkgs.cargo-legacy;
|
||||
cargo-vendor = artiqpkgs.cargo-vendor-legacy;
|
||||
};
|
||||
cargoDeps = fetchcargo rec {
|
||||
name = "artiq-firmware-cargo-deps";
|
||||
|
@ -64,8 +65,8 @@ pkgs.stdenv.mkDerivation {
|
|||
phases = [ "buildPhase" "installPhase" ];
|
||||
nativeBuildInputs = [
|
||||
pkgs.gnumake pkgs.which pythonEnv
|
||||
artiqpkgs.cargo
|
||||
artiqpkgs.rustc
|
||||
artiqpkgs.cargo-legacy
|
||||
artiqpkgs.rustc-legacy
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.llvm-or1k
|
||||
];
|
||||
|
|
|
@ -27,7 +27,7 @@ let
|
|||
|
||||
let
|
||||
sinaraSystemsSrc = pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems-legacy.git";
|
||||
rev = "$REV";
|
||||
sha256 = "$HASH";
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
pkgs = import <nixpkgs> { overlays = [ (import ./artiq-fast/mozilla-overlay.nix) ]; };
|
||||
artiqSrc = <artiqSrc>;
|
||||
generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
|
||||
# keep in sync with artiq-fast/pkgs/artiq-version.nix
|
||||
|
@ -23,7 +23,7 @@ let
|
|||
cat > $out/pkgs/artiq-src.nix << EOF
|
||||
{ fetchgit }:
|
||||
fetchgit {
|
||||
url = "git://github.com/m-labs/artiq.git";
|
||||
url = "https://github.com/m-labs/artiq.git";
|
||||
rev = "$REV";
|
||||
sha256 = "$HASH";
|
||||
}
|
||||
|
@ -59,31 +59,31 @@ in
|
|||
extended-tests = pkgs.stdenv.mkDerivation {
|
||||
name = "extended-tests";
|
||||
|
||||
# requires patched Nix
|
||||
__networked = true;
|
||||
__networked = true; # compatibility with old patched Nix
|
||||
# breaks hydra, https://github.com/NixOS/hydra/issues/1216
|
||||
#__impure = true; # Nix 2.8+
|
||||
|
||||
buildInputs = [
|
||||
(pkgs.python3.withPackages(ps: [ ps.paramiko artiqpkgs.artiq artiqpkgs.artiq-board-kc705-nist_clock ]))
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.openocd
|
||||
pkgs.openssh
|
||||
];
|
||||
] ++ (if (pkgs.lib.versionAtLeast artiqVersion "7.0") then [ pkgs.llvm_11 pkgs.lld_11 ] else [ artiqpkgs.binutils-or1k ]);
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase =
|
||||
''
|
||||
export HOME=`mktemp -d`
|
||||
mkdir $HOME/.ssh
|
||||
cp /opt/hydra_id_rsa $HOME/.ssh/id_rsa
|
||||
cp /opt/hydra_id_rsa.pub $HOME/.ssh/id_rsa.pub
|
||||
echo "rpi-1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMc7waNkP2HjL5Eo94evoxJhC8CbYj4i2n1THe5TPIR3" > $HOME/.ssh/known_hosts
|
||||
chmod 600 $HOME/.ssh/id_rsa
|
||||
cp /opt/hydra_id_ed25519 $HOME/.ssh/id_ed25519
|
||||
cp /opt/hydra_id_ed25519.pub $HOME/.ssh/id_ed25519.pub
|
||||
echo "rpi-1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIACtBFDVBYoAE4fpJCTANZSE0bcVpTR3uvfNvb80C4i5" > $HOME/.ssh/known_hosts
|
||||
chmod 600 $HOME/.ssh/id_ed25519
|
||||
LOCKCTL=$(mktemp -d)
|
||||
mkfifo $LOCKCTL/lockctl
|
||||
|
||||
cat $LOCKCTL/lockctl | ${pkgs.openssh}/bin/ssh \
|
||||
-i $HOME/.ssh/id_rsa \
|
||||
-i $HOME/.ssh/id_ed25519 \
|
||||
-o UserKnownHostsFile=$HOME/.ssh/known_hosts \
|
||||
sb@rpi-1 \
|
||||
rpi-1 \
|
||||
'mkdir -p /tmp/board_lock && flock /tmp/board_lock/kc705-1 -c "echo Ok; cat"' \
|
||||
| (
|
||||
# End remote flock via FIFO
|
||||
|
|
|
@ -2,25 +2,27 @@
|
|||
# nix.sandboxPaths = ["/opt"];
|
||||
|
||||
{ pkgs
|
||||
, rustPlatform
|
||||
, vivado ? import ./vivado.nix { inherit pkgs; }
|
||||
}:
|
||||
|
||||
let
|
||||
artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
|
||||
artiqpkgs = import ./default.nix { inherit pkgs; };
|
||||
fetchcargo = import ./fetchcargo.nix {
|
||||
|
||||
fetchcargo-legacy = import ./fetchcargo-legacy.nix {
|
||||
inherit (pkgs) stdenv lib cacert git;
|
||||
inherit (artiqpkgs) cargo cargo-vendor;
|
||||
cargo = artiqpkgs.cargo-legacy;
|
||||
cargo-vendor = artiqpkgs.cargo-vendor-legacy;
|
||||
};
|
||||
cargoDeps = fetchcargo rec {
|
||||
cargoDeps-legacy = fetchcargo-legacy rec {
|
||||
name = "artiq-firmware-cargo-deps";
|
||||
src = "${artiqSrc}/artiq/firmware";
|
||||
sha256 = (import "${artiqSrc}/artiq/firmware/cargosha256.nix");
|
||||
};
|
||||
|
||||
cargoVendored = pkgs.stdenv.mkDerivation {
|
||||
cargoVendored-legacy = pkgs.stdenv.mkDerivation {
|
||||
name = "artiq-firmware-cargo-vendored";
|
||||
src = cargoDeps;
|
||||
src = cargoDeps-legacy;
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
installPhase =
|
||||
''
|
||||
|
@ -42,6 +44,26 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
cargoDeps = rustPlatform.fetchCargoTarball {
|
||||
name = "artiq-firmware-cargo-deps";
|
||||
src = "${artiqSrc}/artiq/firmware";
|
||||
sha256 = "sha256-YyycMsDzR+JRcMZJd6A/CRi2J9nKmaWY/KXUnAQaZ00=";
|
||||
};
|
||||
|
||||
cargo-xbuild = rustPlatform.buildRustPackage rec {
|
||||
pname = "cargo-xbuild";
|
||||
version = "0.6.5";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "rust-osdev";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "18djvygq9v8rmfchvi2hfj0i6fhn36m716vqndqnj56fiqviwxvf";
|
||||
};
|
||||
cargoSha256 = "13sj9j9kl6js75h9xq0yidxy63vixxm9q3f8jil6ymarml5wkhx8";
|
||||
};
|
||||
|
||||
artiq7 = pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "7.0";
|
||||
|
||||
in
|
||||
{ target
|
||||
, variant
|
||||
|
@ -56,25 +78,44 @@ pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec {
|
|||
name = "artiq-board-${target}-${variant}-${version}";
|
||||
version = import ./pkgs/artiq-version.nix (with pkgs; { inherit stdenv fetchgit git; });
|
||||
inherit src;
|
||||
phases = [ "buildPhase" "installCheckPhase" "installPhase" "checkPhase" ];
|
||||
nativeBuildInputs = [
|
||||
vivado
|
||||
pkgs.gnumake
|
||||
artiqpkgs.cargo
|
||||
artiqpkgs.rustc
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.llvm-or1k
|
||||
];
|
||||
buildInputs = [ (pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ])) ];
|
||||
buildPhase =
|
||||
''
|
||||
export CARGO_HOME=${cargoVendored}
|
||||
export TARGET_AR=or1k-linux-ar
|
||||
${buildCommand}
|
||||
'';
|
||||
phases = [ "buildPhase" "checkPhase" "installPhase" ];
|
||||
nativeBuildInputs = [ vivado pkgs.gnumake ]
|
||||
++ (if artiq7
|
||||
then [
|
||||
rustPlatform.rust.rustc
|
||||
rustPlatform.rust.cargo
|
||||
pkgs.llvmPackages_11.clang-unwrapped
|
||||
pkgs.llvm_11
|
||||
pkgs.lld_11
|
||||
rustPlatform.cargoSetupHook
|
||||
cargo-xbuild
|
||||
] else [
|
||||
artiqpkgs.cargo-legacy
|
||||
artiqpkgs.rustc-legacy
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.llvm-or1k
|
||||
]);
|
||||
buildInputs = [ (pkgs.python3.withPackages(ps: with ps; [ artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ] ++ (pkgs.lib.optional artiq7 jsonschema))) ];
|
||||
buildPhase = if artiq7
|
||||
then
|
||||
''
|
||||
ARTIQ_PATH=`python -c "import artiq; print(artiq.__path__[0])"`
|
||||
ln -s $ARTIQ_PATH/firmware/Cargo.lock .
|
||||
cargoDeps=${cargoDeps}
|
||||
cargoSetupPostUnpackHook
|
||||
cargoSetupPostPatchHook
|
||||
export TARGET_AR=llvm-ar
|
||||
${buildCommand}
|
||||
''
|
||||
else
|
||||
''
|
||||
export CARGO_HOME=${cargoVendored-legacy}
|
||||
export TARGET_AR=or1k-linux-ar
|
||||
${buildCommand}
|
||||
'';
|
||||
# temporarily disabled because there is currently always at least one Kasli bitstream
|
||||
# that fails timing and blocks the conda channel.
|
||||
doCheck = false;
|
||||
doCheck = artiq7;
|
||||
checkPhase = ''
|
||||
# Search for PCREs in the Vivado output to check for errors
|
||||
check_log() {
|
||||
|
|
|
@ -37,7 +37,7 @@ let
|
|||
- cmake
|
||||
- llvm-or1k
|
||||
run:
|
||||
- python<3.8
|
||||
- python<3.9
|
||||
EOF
|
||||
|
||||
cat > bld.bat << EOF
|
||||
|
|
|
@ -7,8 +7,6 @@ let
|
|||
inherit version;
|
||||
src = import ../pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
|
||||
dependencies = [
|
||||
"llvmlite-artiq"
|
||||
"binutils-or1k-linux"
|
||||
"pythonparser"
|
||||
"scipy"
|
||||
"numpy"
|
||||
|
@ -21,7 +19,7 @@ let
|
|||
"pygit2"
|
||||
"python-levenshtein"
|
||||
"sipyco"
|
||||
];
|
||||
] ++ (if (pkgs.lib.strings.versionAtLeast version "7.0") then ["llvmlite" "llvm-tools" "lld"] else ["llvmlite-artiq" "binutils-or1k-linux"]);
|
||||
extraYaml =
|
||||
''
|
||||
about:
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
mkdir -p $out/fake-conda;
|
||||
|
||||
# work around yet more idiotic conda behavior - build breaks if write permissions aren't set on source files.
|
||||
cp --no-preserve=mode,ownership -R ${bscan_spi_bitstreams} workaround-conda
|
||||
cp --no-preserve=mode,ownership -L -R ${bscan_spi_bitstreams} workaround-conda
|
||||
pushd workaround-conda
|
||||
tar cf $out/src.tar .
|
||||
popd
|
||||
|
|
|
@ -15,7 +15,7 @@ assert (name != null) -> pname == null && version == null;
|
|||
let
|
||||
condaBuilderEnv = import ./builder-env.nix { inherit pkgs; };
|
||||
realName = if (name != null) then name else "${pname}-${version}";
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
in pkgs.stdenvNoCC.mkDerivation {
|
||||
name = realName;
|
||||
inherit src;
|
||||
buildCommand =
|
||||
|
|
|
@ -3,14 +3,21 @@
|
|||
with pkgs;
|
||||
|
||||
let
|
||||
condaDeps = [ stdenv.cc xorg.libSM xorg.libICE xorg.libX11 xorg.libXau xorg.libXi xorg.libXrender libselinux libGL ];
|
||||
condaDeps = [ zlib xorg.libSM xorg.libICE xorg.libX11 xorg.libXau xorg.libXi xorg.libXrender libselinux libGL ];
|
||||
# Use the full Anaconda distribution, which already contains conda-build and its many dependencies,
|
||||
# so we don't have to manually deal with them.
|
||||
condaInstaller = fetchurl {
|
||||
url = "https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh";
|
||||
sha256 = "0fmpdd5876ylds98mydmv5klnwlzasa461k0l1f4vhbw96vm3j25";
|
||||
url = "https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh";
|
||||
sha256 = "0lrxwd3pwz8k3jxwgkd9x47wgkqqy9s8m7hgx1x2gw4gcwysnl97";
|
||||
};
|
||||
condaSrcChmod = runCommand "conda-src-chmod" { } "mkdir $out; cp ${condaInstaller} $out/conda-installer.sh; chmod +x $out/conda-installer.sh";
|
||||
condaSrcChmod = runCommand "conda-src-chmod" { }
|
||||
''
|
||||
mkdir $out
|
||||
cp ${condaInstaller} $out/conda-installer.sh
|
||||
chmod +x $out/conda-installer.sh
|
||||
# keep the same file length to avoid breaking embedded payload offsets
|
||||
sed -i 0,/unset\ LD_LIBRARY_PATH/s//\#nset\ LD_LIBRARY_PATH/ $out/conda-installer.sh
|
||||
'';
|
||||
condaInstallerEnv = buildFHSUserEnv {
|
||||
name = "conda-installer-env";
|
||||
targetPkgs = pkgs: ([ condaSrcChmod ] ++ condaDeps);
|
||||
|
@ -26,7 +33,7 @@ let
|
|||
condaInstalled = runCommand "conda-installed" { }
|
||||
''
|
||||
${condaInstallerEnv}/bin/conda-installer-env -c "${condaSrcChmod}/conda-installer.sh -p $out -b"
|
||||
substituteInPlace $out/lib/python3.7/site-packages/conda/gateways/disk/__init__.py \
|
||||
substituteInPlace $out/lib/python3.8/site-packages/conda/gateways/disk/__init__.py \
|
||||
--replace "os.chmod(path, 0o2775)" "pass"
|
||||
|
||||
# The conda garbage breaks if the package filename is prefixed with the Nix store hash.
|
||||
|
@ -36,10 +43,15 @@ let
|
|||
ln -s ${libiconv} ${libiconv-filename}
|
||||
${condaInstallerEnv}/bin/conda-installer-env -c "$out/bin/conda install ${libiconv-filename}"
|
||||
'';
|
||||
|
||||
binutils-fhs = (pkgs.binutils.overrideAttrs(oa: {postFixup = oa.postFixup + "echo /lib64/ld-linux-x86-64.so.2 > $out/nix-support/dynamic-linker";}));
|
||||
gcc-fhs = (pkgs.gcc.override {bintools = binutils-fhs;} );
|
||||
in
|
||||
buildFHSUserEnv {
|
||||
name = "conda-builder-env";
|
||||
targetPkgs = pkgs: ([ condaInstalled ] ++ condaDeps ++ [
|
||||
binutils-fhs
|
||||
gcc-fhs
|
||||
# for llvm-or1k
|
||||
cmake
|
||||
]
|
||||
|
|
|
@ -25,7 +25,7 @@ let
|
|||
# that they are not there if they have been installed from files.
|
||||
requirements:
|
||||
run:
|
||||
- python<3.8
|
||||
- python<3.9
|
||||
- ncurses [linux]
|
||||
EOF
|
||||
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
{ pkgs, src }:
|
||||
|
||||
let
|
||||
condaBuilderEnv = import ./builder-env.nix { inherit pkgs; };
|
||||
fake-src = pkgs.runCommand "conda-fake-source-llvmlite" { }
|
||||
''
|
||||
mkdir -p $out/fake-conda;
|
||||
|
||||
mkdir conda-sucks
|
||||
pushd conda-sucks
|
||||
tar xvf ${src} --strip-components=1
|
||||
tar cf $out/src.tar .
|
||||
patch -p1 < ${../pkgs/llvmlite-callsite.diff}
|
||||
patch -p1 < ${../pkgs/llvmlite-abiname.diff}
|
||||
popd
|
||||
rm -rf conda-sucks
|
||||
|
||||
cat << EOF > $out/fake-conda/meta.yaml
|
||||
package:
|
||||
name: llvmlite
|
||||
version: 0.99 # high version number to entice the conda filth to choose it over others
|
||||
|
||||
source:
|
||||
url: ../src.tar
|
||||
|
||||
# Again, we don't specify build dependencies since the conda garbage mistakenly thinks
|
||||
# that they are not there if they have been installed from files.
|
||||
requirements:
|
||||
run:
|
||||
- libllvm11
|
||||
- python<3.9
|
||||
- zlib
|
||||
EOF
|
||||
|
||||
cat << EOF > $out/fake-conda/build.sh
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
export LD_LIBRARY_PATH=/lib
|
||||
python setup.py install \
|
||||
--prefix=\$PREFIX \
|
||||
--single-version-externally-managed \
|
||||
--record=record.txt \
|
||||
--no-compile
|
||||
|
||||
EOF
|
||||
chmod 755 $out/fake-conda/build.sh
|
||||
'';
|
||||
conda-zlib = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/conda-forge/zlib/1.2.11/download/linux-64/zlib-1.2.11-h36c2ea0_1013.tar.bz2";
|
||||
sha256 = "sha256-zsSNs1p97wARv9qiuR5eBdKgrXiLiHGiE+uMrP63QYo=";
|
||||
};
|
||||
conda-llvm = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/conda-forge/llvm/11.1.0/download/linux-64/llvm-11.1.0-h32600fe_2.tar.bz2";
|
||||
sha256 = "sha256-E+jnVeGHad3LH+dKqFKH0/lBuQqZKtybXF44uArmNz8=";
|
||||
};
|
||||
conda-llvm-tools = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/conda-forge/llvm-tools/11.1.0/download/linux-64/llvm-tools-11.1.0-hf817b99_2.tar.bz2";
|
||||
sha256 = "sha256-Y87krT+d9vdVIPliJVc/szIVBRA3NNcUDdY9Gc9KpXg=";
|
||||
};
|
||||
conda-llvmdev = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/conda-forge/llvmdev/11.1.0/download/linux-64/llvmdev-11.1.0-hf817b99_2.tar.bz2";
|
||||
sha256 = "sha256-vN87BWggPfpFp51Qm60R3D5krQ4AQwiEJaqPfVb6x40=";
|
||||
};
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "conda-llvmlite";
|
||||
src = fake-src;
|
||||
buildCommand =
|
||||
''
|
||||
HOME=`pwd`
|
||||
mkdir $out
|
||||
cat << EOF > conda-commands.sh
|
||||
set -e
|
||||
|
||||
conda create --prefix ./conda_tmp ${conda-zlib} ${conda-llvm} ${conda-llvm-tools} ${conda-llvmdev}
|
||||
conda init
|
||||
source .bashrc
|
||||
conda activate ./conda_tmp
|
||||
|
||||
conda build --no-anaconda-upload --no-test --output-folder $out $src/fake-conda
|
||||
EOF
|
||||
${condaBuilderEnv}/bin/conda-builder-env conda-commands.sh
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
echo file conda $out/*/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{ pkgs ? import <nixpkgs> { overlays = [ (import ./mozilla-overlay.nix) ]; }}:
|
||||
with pkgs;
|
||||
let
|
||||
artiq6 = pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "6.0";
|
||||
pythonDeps = import ./pkgs/python-deps.nix { inherit (pkgs) lib fetchgit fetchFromGitHub python3Packages; misoc-new = artiq6; };
|
||||
artiq7 = pkgs.lib.strings.versionAtLeast mainPackages.artiq.version "7.0";
|
||||
pythonDeps = import ./pkgs/python-deps.nix { inherit (pkgs) lib fetchgit fetchFromGitHub python3Packages; misoc-new = artiq7; };
|
||||
rustPlatform = import ./rust-platform.nix { inherit pkgs; };
|
||||
|
||||
boards = [
|
||||
{ target = "kasli"; variant = "tester"; }
|
||||
|
@ -10,7 +12,7 @@ let
|
|||
];
|
||||
boardPackages = pkgs.lib.lists.foldr (board: start:
|
||||
let
|
||||
boardBinaries = import ./artiq-board.nix { inherit pkgs; } {
|
||||
boardBinaries = import ./artiq-board.nix { inherit pkgs rustPlatform; } {
|
||||
target = board.target;
|
||||
variant = board.variant;
|
||||
};
|
||||
|
@ -20,22 +22,24 @@ let
|
|||
}) {} boards;
|
||||
|
||||
mainPackages = rec {
|
||||
inherit (pythonDeps) sipyco asyncserial pythonparser pyqtgraph-qt5 artiq-netboot misoc migen microscope jesd204b migen-axi lit outputcheck qasync;
|
||||
inherit (pythonDeps) sipyco asyncserial pythonparser artiq-netboot misoc migen microscope jesd204b migen-axi lit outputcheck qasync;
|
||||
binutils-or1k = callPackage ./pkgs/binutils.nix { platform = "or1k"; target = "or1k-linux"; };
|
||||
binutils-arm = callPackage ./pkgs/binutils.nix { platform = "arm"; target = "armv7-unknown-linux-gnueabihf"; };
|
||||
llvm-or1k = callPackage ./pkgs/llvm-or1k.nix {};
|
||||
rustc = callPackage ./pkgs/rust/rustc-with-crates.nix
|
||||
rustc-legacy = callPackage ./pkgs/rust-legacy/rustc-with-crates.nix
|
||||
((lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
|
||||
stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4'
|
||||
}) //
|
||||
{ inherit llvm-or1k; });
|
||||
cargo = callPackage ./pkgs/rust/cargo.nix { inherit rustc; };
|
||||
cargo-vendor = callPackage ./pkgs/rust/cargo-vendor.nix {};
|
||||
rustc = if artiq7 then rustPlatform.rust.rustc else rustc-legacy;
|
||||
cargo-legacy = callPackage ./pkgs/rust-legacy/cargo.nix { inherit rustc; rustPlatform = rustPackages_1_45.rustPlatform; };
|
||||
cargo-vendor-legacy = callPackage ./pkgs/rust-legacy/cargo-vendor.nix {};
|
||||
llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; };
|
||||
llvmlite-llvm11 = callPackage ./pkgs/llvmlite-llvm11.nix { };
|
||||
libartiq-support = callPackage ./pkgs/libartiq-support.nix { inherit rustc; };
|
||||
artiq = callPackage ./pkgs/artiq.nix { inherit pythonDeps binutils-or1k binutils-arm llvm-or1k llvmlite-artiq libartiq-support lit outputcheck; };
|
||||
artiq = callPackage ./pkgs/artiq.nix { inherit pythonDeps binutils-or1k binutils-arm llvm-or1k llvmlite-artiq llvmlite-llvm11 libartiq-support lit outputcheck; };
|
||||
artiq-env = (pkgs.python3.withPackages(ps: [ artiq ])).overrideAttrs (oldAttrs: { name = "${pkgs.python3.name}-artiq-env-${artiq.version}"; });
|
||||
openocd = callPackage ./pkgs/openocd.nix {};
|
||||
openocd = callPackage ./pkgs/openocd.nix { };
|
||||
};
|
||||
|
||||
condaNoarch = {
|
||||
|
@ -45,7 +49,6 @@ let
|
|||
src = import ./conda/fake-source.nix { inherit pkgs; } {
|
||||
name = "pythonparser";
|
||||
inherit (pythonDeps.pythonparser) version src;
|
||||
extraSrcCommands = "patch -p1 < ${./pkgs/pythonparserver.patch}";
|
||||
dependencies = ["regex"];
|
||||
};
|
||||
};
|
||||
|
@ -76,7 +79,7 @@ let
|
|||
};
|
||||
conda-bscan-spi-bitstreams = import ./conda/bscan-spi-bitstreams.nix {
|
||||
inherit pkgs;
|
||||
inherit (mainPackages.openocd) bscan_spi_bitstreams;
|
||||
bscan_spi_bitstreams = "${mainPackages.openocd}/share/bscan-spi-bitstreams";
|
||||
};
|
||||
conda-artiq = import ./conda/artiq.nix { inherit pkgs; };
|
||||
conda-asyncserial = import ./conda/build.nix { inherit pkgs; } {
|
||||
|
@ -90,7 +93,13 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
condaLinux = rec {
|
||||
condaLinux = if artiq7 then ({
|
||||
# ARTIQ-7 uses upstream conda-forge packages except llvmlite
|
||||
conda-llvmlite = import ./conda/llvmlite-patched.nix {
|
||||
inherit pkgs;
|
||||
inherit (mainPackages.llvmlite-llvm11) src;
|
||||
};
|
||||
}) else (rec {
|
||||
conda-binutils-or1k = import ./conda/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (mainPackages.binutils-or1k) version src;
|
||||
|
@ -110,9 +119,9 @@ let
|
|||
inherit pkgs conda-llvm-or1k;
|
||||
inherit (mainPackages.llvmlite-artiq) version src;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
condaWindowsLegacy = {
|
||||
condaWindows5 = {
|
||||
conda-windows-binutils-or1k = import ./conda-windows/redistribute.nix {
|
||||
inherit pkgs;
|
||||
name = "binutils-or1k";
|
||||
|
@ -136,7 +145,7 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
condaWindowsExperimental = rec {
|
||||
condaWindows6 = rec {
|
||||
conda-windows-binutils-or1k = import ./conda-windows/binutils.nix {
|
||||
inherit pkgs;
|
||||
inherit (mainPackages.binutils-or1k) version src;
|
||||
|
@ -158,6 +167,6 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
condaWindows = if artiq6 then condaWindowsExperimental else condaWindowsLegacy;
|
||||
condaWindows = if artiq6 then (if artiq7 then {} else condaWindows6) else condaWindows5;
|
||||
in
|
||||
boardPackages // mainPackages // condaNoarch // condaLinux // condaWindows
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
overlay = pkgs.fetchFromGitHub {
|
||||
owner = "mozilla";
|
||||
repo = "nixpkgs-mozilla";
|
||||
rev = "0510159186dd2ef46e5464484fbdf119393afa58";
|
||||
sha256 = "sha256-HJX4Pc5ZUAg4apxB/XHuJ+6ukzvRQqeZMjscOBst2bA=";
|
||||
};
|
||||
in
|
||||
import overlay
|
|
@ -1,4 +1,6 @@
|
|||
{ stdenv, lib, pythonDeps, fetchgit, git, python3Packages, qt5, binutils-or1k, binutils-arm, llvm-or1k, llvmlite-artiq, libartiq-support, lit, outputcheck }:
|
||||
{ stdenv, lib, pythonDeps, fetchgit, git, python3Packages, qt5, libartiq-support, lit, outputcheck, fontconfig,
|
||||
binutils-or1k, binutils-arm, llvm-or1k, llvmlite-artiq,
|
||||
llvm_11, lld_11, llvmlite-llvm11 }:
|
||||
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "artiq";
|
||||
|
@ -8,10 +10,12 @@ python3Packages.buildPythonPackage rec {
|
|||
preBuild = "export VERSIONEER_OVERRIDE=${version}";
|
||||
|
||||
nativeBuildInputs = [ qt5.wrapQtAppsHook ];
|
||||
propagatedBuildInputs = [ binutils-or1k llvm-or1k llvmlite-artiq ]
|
||||
++ (lib.lists.optionals (lib.strings.versionAtLeast version "6.0") [ binutils-arm ])
|
||||
++ (with pythonDeps; [ sipyco pyqtgraph-qt5 pythonparser ])
|
||||
++ (with python3Packages; [ pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 ])
|
||||
propagatedBuildInputs = [ ]
|
||||
++ (lib.lists.optionals (!lib.strings.versionAtLeast version "7.0") [ binutils-or1k llvm-or1k llvmlite-artiq ])
|
||||
++ (lib.lists.optionals (lib.strings.versionAtLeast version "7.0") [ llvm_11 lld_11 llvmlite-llvm11 ])
|
||||
++ (lib.lists.optionals (lib.strings.versionAtLeast version "6.0" && !lib.strings.versionAtLeast version "7.0") [ binutils-arm ])
|
||||
++ (with pythonDeps; [ sipyco pythonparser ])
|
||||
++ (with python3Packages; [ pygit2 numpy dateutil scipy prettytable pyserial python-Levenshtein h5py pyqt5 pyqtgraph ])
|
||||
++ [(if (lib.strings.versionAtLeast version "6.0") then pythonDeps.qasync else python3Packages.quamash)];
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
@ -23,16 +27,19 @@ python3Packages.buildPythonPackage rec {
|
|||
|
||||
# Modifies PATH to pass the wrapped python environment (i.e. python3.withPackages(...) to subprocesses.
|
||||
# Allows subprocesses using python to find all packages you have installed
|
||||
makeWrapperArgs = [ ''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' '' ];
|
||||
makeWrapperArgs = [
|
||||
''--run 'if [ ! -z "$NIX_PYTHONPREFIX" ]; then export PATH=$NIX_PYTHONPREFIX/bin:$PATH;fi' ''
|
||||
"--set FONTCONFIG_FILE ${fontconfig.out}/etc/fonts/fonts.conf"
|
||||
];
|
||||
|
||||
checkInputs = [ binutils-or1k outputcheck ];
|
||||
checkInputs = [ lit outputcheck ] ++ (if (lib.strings.versionAtLeast version "7.0") then [ lld_11 llvm_11 ] else [ binutils-or1k ]);
|
||||
checkPhase =
|
||||
''
|
||||
python -m unittest discover -v artiq.test
|
||||
|
||||
TESTDIR=`mktemp -d`
|
||||
cp --no-preserve=mode,ownership -R ${src}/artiq/test/lit $TESTDIR
|
||||
LIBARTIQ_SUPPORT=${libartiq-support}/libartiq_support.so ${lit}/bin/lit -v $TESTDIR/lit
|
||||
cp --no-preserve=mode,ownership -R $src/artiq/test/lit $TESTDIR
|
||||
LIBARTIQ_SUPPORT=${libartiq-support}/libartiq_support.so lit -v $TESTDIR/lit
|
||||
'';
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ stdenv.mkDerivation rec {
|
|||
buildPhase =
|
||||
''
|
||||
mkdir $out
|
||||
rustc ${src}/artiq/test/libartiq_support/lib.rs --out-dir $out -Cpanic=unwind -g
|
||||
rustc $src/artiq/test/libartiq_support/lib.rs --out-dir $out -Cpanic=unwind -g
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
diff --git a/ffi/targets.cpp b/ffi/targets.cpp
|
||||
index 98de259fc..1ce472c20 100644
|
||||
--- a/ffi/targets.cpp
|
||||
+++ b/ffi/targets.cpp
|
||||
@@ -182,7 +182,8 @@ LLVMPY_CreateTargetMachine(LLVMTargetRef T,
|
||||
const char *RelocModel,
|
||||
const char *CodeModel,
|
||||
int PrintMC,
|
||||
- int JIT)
|
||||
+ int JIT,
|
||||
+ const char *ABIName)
|
||||
{
|
||||
using namespace llvm;
|
||||
CodeGenOpt::Level cgol;
|
||||
@@ -233,6 +234,7 @@ LLVMPY_CreateTargetMachine(LLVMTargetRef T,
|
||||
|
||||
TargetOptions opt;
|
||||
opt.PrintMachineCode = PrintMC;
|
||||
+ opt.MCOptions.ABIName = ABIName;
|
||||
|
||||
bool jit = JIT;
|
||||
|
||||
diff --git a/llvmlite/binding/targets.py b/llvmlite/binding/targets.py
|
||||
index eb53f09f2..a7e6ffdc3 100644
|
||||
--- a/llvmlite/binding/targets.py
|
||||
+++ b/llvmlite/binding/targets.py
|
||||
@@ -218,7 +218,7 @@ def __str__(self):
|
||||
|
||||
def create_target_machine(self, cpu='', features='',
|
||||
opt=2, reloc='default', codemodel='jitdefault',
|
||||
- printmc=False, jit=False):
|
||||
+ printmc=False, jit=False, abiname=''):
|
||||
"""
|
||||
Create a new TargetMachine for this target and the given options.
|
||||
|
||||
@@ -230,6 +230,9 @@ def create_target_machine(self, cpu='', features='',
|
||||
|
||||
The `jit` option should be set when the target-machine is to be used
|
||||
in a JIT engine.
|
||||
+
|
||||
+ The `abiname` option specifies the ABI. RISC-V targets with hard-float
|
||||
+ needs to pass the ABI name to LLVM.
|
||||
"""
|
||||
assert 0 <= opt <= 3
|
||||
assert reloc in RELOC
|
||||
@@ -249,6 +252,7 @@ def create_target_machine(self, cpu='', features='',
|
||||
_encode_string(codemodel),
|
||||
int(printmc),
|
||||
int(jit),
|
||||
+ _encode_string(abiname),
|
||||
)
|
||||
if tm:
|
||||
return TargetMachine(tm)
|
||||
@@ -403,6 +407,8 @@ def has_svml():
|
||||
c_int,
|
||||
# JIT
|
||||
c_int,
|
||||
+ # ABIName
|
||||
+ c_char_p,
|
||||
]
|
||||
ffi.lib.LLVMPY_CreateTargetMachine.restype = ffi.LLVMTargetMachineRef
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
diff --git a/llvmlite/ir/builder.py b/llvmlite/ir/builder.py
|
||||
index f18a8d8bd..b4958770e 100644
|
||||
--- a/llvmlite/ir/builder.py
|
||||
+++ b/llvmlite/ir/builder.py
|
||||
@@ -872,14 +872,14 @@ def resume(self, landingpad):
|
||||
# Call APIs
|
||||
|
||||
def call(self, fn, args, name='', cconv=None, tail=False, fastmath=(),
|
||||
- attrs=()):
|
||||
+ attrs=(), arg_attrs=None):
|
||||
"""
|
||||
Call function *fn* with *args*:
|
||||
name = fn(args...)
|
||||
"""
|
||||
inst = instructions.CallInstr(self.block, fn, args, name=name,
|
||||
cconv=cconv, tail=tail, fastmath=fastmath,
|
||||
- attrs=attrs)
|
||||
+ attrs=attrs, arg_attrs=arg_attrs)
|
||||
self._insert(inst)
|
||||
return inst
|
||||
|
||||
@@ -908,9 +908,11 @@ def store_reg(self, value, reg_type, reg_name, name=''):
|
||||
return self.asm(ftype, "", "{%s}" % reg_name, [value], True, name)
|
||||
|
||||
def invoke(self, fn, args, normal_to, unwind_to,
|
||||
- name='', cconv=None, tail=False):
|
||||
+ name='', cconv=None, fastmath=(), attrs=(), arg_attrs=None):
|
||||
inst = instructions.InvokeInstr(self.block, fn, args, normal_to,
|
||||
- unwind_to, name=name, cconv=cconv)
|
||||
+ unwind_to, name=name, cconv=cconv,
|
||||
+ fastmath=fastmath, attrs=attrs,
|
||||
+ arg_attrs=arg_attrs)
|
||||
self._set_terminator(inst)
|
||||
return inst
|
||||
|
||||
diff --git a/llvmlite/ir/instructions.py b/llvmlite/ir/instructions.py
|
||||
index 7e82ee032..f337c1586 100644
|
||||
--- a/llvmlite/ir/instructions.py
|
||||
+++ b/llvmlite/ir/instructions.py
|
||||
@@ -5,7 +5,7 @@
|
||||
from llvmlite.ir import types
|
||||
from llvmlite.ir.values import (Block, Function, Value, NamedValue, Constant,
|
||||
MetaDataArgument, MetaDataString, AttributeSet,
|
||||
- Undefined)
|
||||
+ Undefined, ArgumentAttributes)
|
||||
from llvmlite.ir._utils import _HasMetadata
|
||||
|
||||
|
||||
@@ -63,13 +63,20 @@ class FastMathFlags(AttributeSet):
|
||||
|
||||
class CallInstr(Instruction):
|
||||
def __init__(self, parent, func, args, name='', cconv=None, tail=False,
|
||||
- fastmath=(), attrs=()):
|
||||
+ fastmath=(), attrs=(), arg_attrs=None):
|
||||
self.cconv = (func.calling_convention
|
||||
if cconv is None and isinstance(func, Function)
|
||||
else cconv)
|
||||
self.tail = tail
|
||||
self.fastmath = FastMathFlags(fastmath)
|
||||
self.attributes = CallInstrAttributes(attrs)
|
||||
+ self.arg_attributes = {}
|
||||
+ if arg_attrs:
|
||||
+ for idx, attrs in arg_attrs.items():
|
||||
+ if not (0 <= idx < len(args)):
|
||||
+ raise ValueError("Invalid argument index {}"
|
||||
+ .format(idx))
|
||||
+ self.arg_attributes[idx] = ArgumentAttributes(attrs)
|
||||
|
||||
# Fix and validate arguments
|
||||
args = list(args)
|
||||
@@ -111,8 +118,13 @@ def called_function(self):
|
||||
return self.callee
|
||||
|
||||
def _descr(self, buf, add_metadata):
|
||||
- args = ', '.join(['{0} {1}'.format(a.type, a.get_reference())
|
||||
- for a in self.args])
|
||||
+ def descr_arg(i, a):
|
||||
+ if i in self.arg_attributes:
|
||||
+ attrs = ' '.join(self.arg_attributes[i]._to_list()) + ' '
|
||||
+ else:
|
||||
+ attrs = ''
|
||||
+ return '{0} {1}{2}'.format(a.type, attrs, a.get_reference())
|
||||
+ args = ', '.join([descr_arg(i, a) for i, a in enumerate(self.args)])
|
||||
|
||||
fnty = self.callee.function_type
|
||||
# Only print function type if variable-argument
|
||||
@@ -142,10 +154,12 @@ def descr(self, buf):
|
||||
|
||||
class InvokeInstr(CallInstr):
|
||||
def __init__(self, parent, func, args, normal_to, unwind_to, name='',
|
||||
- cconv=None):
|
||||
+ cconv=None, fastmath=(), attrs=(), arg_attrs=None):
|
||||
assert isinstance(normal_to, Block)
|
||||
assert isinstance(unwind_to, Block)
|
||||
- super(InvokeInstr, self).__init__(parent, func, args, name, cconv)
|
||||
+ super(InvokeInstr, self).__init__(parent, func, args, name, cconv,
|
||||
+ tail=False, fastmath=fastmath,
|
||||
+ attrs=attrs, arg_attrs=arg_attrs)
|
||||
self.opname = "invoke"
|
||||
self.normal_to = normal_to
|
||||
self.unwind_to = unwind_to
|
||||
diff --git a/llvmlite/tests/test_ir.py b/llvmlite/tests/test_ir.py
|
||||
index e97e528ac..ab5864719 100644
|
||||
--- a/llvmlite/tests/test_ir.py
|
||||
+++ b/llvmlite/tests/test_ir.py
|
||||
@@ -1181,6 +1181,39 @@ def test_call_metadata(self):
|
||||
call void @"llvm.dbg.declare"(metadata i32* %"a", metadata !0, metadata !0)
|
||||
""") # noqa E501
|
||||
|
||||
+ def test_call_attributes(self):
|
||||
+ block = self.block(name='my_block')
|
||||
+ builder = ir.IRBuilder(block)
|
||||
+ fun_ty = ir.FunctionType(
|
||||
+ ir.VoidType(), (int32.as_pointer(), int32, int32.as_pointer()))
|
||||
+ fun = ir.Function(builder.function.module, fun_ty, 'fun')
|
||||
+ fun.args[0].add_attribute('sret')
|
||||
+ retval = builder.alloca(int32, name='retval')
|
||||
+ other = builder.alloca(int32, name='other')
|
||||
+ builder.call(
|
||||
+ fun,
|
||||
+ (retval, ir.Constant(int32, 42), other),
|
||||
+ arg_attrs={
|
||||
+ 0: ('sret', 'noalias'),
|
||||
+ 2: 'noalias'
|
||||
+ }
|
||||
+ )
|
||||
+ self.check_block(block, """\
|
||||
+ my_block:
|
||||
+ %"retval" = alloca i32
|
||||
+ %"other" = alloca i32
|
||||
+ call void @"fun"(i32* noalias sret %"retval", i32 42, i32* noalias %"other")
|
||||
+ """) # noqa E501
|
||||
+
|
||||
+ def test_invalid_call_attributes(self):
|
||||
+ block = self.block()
|
||||
+ builder = ir.IRBuilder(block)
|
||||
+ fun_ty = ir.FunctionType(ir.VoidType(), ())
|
||||
+ fun = ir.Function(builder.function.module, fun_ty, 'fun')
|
||||
+ with self.assertRaises(ValueError):
|
||||
+ # The function has no arguments, so this should fail.
|
||||
+ builder.call(fun, (), arg_attrs={0: 'sret'})
|
||||
+
|
||||
def test_invoke(self):
|
||||
block = self.block(name='my_block')
|
||||
builder = ir.IRBuilder(block)
|
||||
@@ -1196,6 +1229,39 @@ def test_invoke(self):
|
||||
to label %"normal" unwind label %"unwind"
|
||||
""")
|
||||
|
||||
+ def test_invoke_attributes(self):
|
||||
+ block = self.block(name='my_block')
|
||||
+ builder = ir.IRBuilder(block)
|
||||
+ fun_ty = ir.FunctionType(
|
||||
+ ir.VoidType(), (int32.as_pointer(), int32, int32.as_pointer()))
|
||||
+ fun = ir.Function(builder.function.module, fun_ty, 'fun')
|
||||
+ fun.calling_convention = "fastcc"
|
||||
+ fun.args[0].add_attribute('sret')
|
||||
+ retval = builder.alloca(int32, name='retval')
|
||||
+ other = builder.alloca(int32, name='other')
|
||||
+ bb_normal = builder.function.append_basic_block(name='normal')
|
||||
+ bb_unwind = builder.function.append_basic_block(name='unwind')
|
||||
+ builder.invoke(
|
||||
+ fun,
|
||||
+ (retval, ir.Constant(int32, 42), other),
|
||||
+ bb_normal,
|
||||
+ bb_unwind,
|
||||
+ cconv='fastcc',
|
||||
+ fastmath='fast',
|
||||
+ attrs='noinline',
|
||||
+ arg_attrs={
|
||||
+ 0: ('sret', 'noalias'),
|
||||
+ 2: 'noalias'
|
||||
+ }
|
||||
+ )
|
||||
+ self.check_block(block, """\
|
||||
+ my_block:
|
||||
+ %"retval" = alloca i32
|
||||
+ %"other" = alloca i32
|
||||
+ invoke fast fastcc void @"fun"(i32* noalias sret %"retval", i32 42, i32* noalias %"other") noinline
|
||||
+ to label %"normal" unwind label %"unwind"
|
||||
+ """) # noqa E501
|
||||
+
|
||||
def test_landingpad(self):
|
||||
block = self.block(name='my_block')
|
||||
builder = ir.IRBuilder(block)
|
|
@ -0,0 +1,26 @@
|
|||
{ python3Packages, llvm_11 }:
|
||||
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "llvmlite";
|
||||
version = "0.37.0-artiq";
|
||||
src = python3Packages.fetchPypi {
|
||||
inherit pname;
|
||||
version = "0.37.0";
|
||||
sha256 = "sha256-Y5K4cM0BjsDGRda7uRjWqg7sqMYmdLqu4whi1raGWxU=";
|
||||
};
|
||||
# https://github.com/numba/llvmlite/pull/702
|
||||
# https://github.com/numba/llvmlite/pull/775
|
||||
patches = [ ./llvmlite-callsite.diff ./llvmlite-abiname.diff ];
|
||||
nativeBuildInputs = [ llvm_11 ];
|
||||
# Disable static linking
|
||||
# https://github.com/numba/llvmlite/issues/93
|
||||
postPatch = ''
|
||||
substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""
|
||||
substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
|
||||
'';
|
||||
# Set directory containing llvm-config binary
|
||||
preConfigure = ''
|
||||
export LLVM_CONFIG=${llvm_11.dev}/bin/llvm-config
|
||||
'';
|
||||
doCheck = false; # FIXME
|
||||
}
|
|
@ -0,0 +1,830 @@
|
|||
diff --git a/doc/openocd.texi b/doc/openocd.texi
|
||||
index 138922d08..ad9f10d2e 100644
|
||||
--- a/doc/openocd.texi
|
||||
+++ b/doc/openocd.texi
|
||||
@@ -5565,6 +5565,10 @@ will not work. These include all @command{*_image} and
|
||||
functionality is available through the @command{flash write_bank},
|
||||
@command{flash read_bank}, and @command{flash verify_bank} commands.
|
||||
|
||||
+According to device size, 1- to 4-byte addresses are sent. However, some
|
||||
+flash chips additionally have to be switched to 4-byte addresses by an extra
|
||||
+command, see below.
|
||||
+
|
||||
@itemize
|
||||
@item @var{ir} ... is loaded into the JTAG IR to map the flash as the JTAG DR.
|
||||
For the bitstreams generated from @file{xilinx_bscan_spi.py} this is the
|
||||
@@ -5577,6 +5581,29 @@ set _XILINX_USER1 0x02
|
||||
flash bank $_FLASHNAME spi 0x0 0 0 0 \
|
||||
$_TARGETNAME $_XILINX_USER1
|
||||
@end example
|
||||
+
|
||||
+@deffn Command {jtagspi set} bank_id name total_size page_size read_cmd unused pprg_cmd mass_erase_cmd sector_size sector_erase_cmd
|
||||
+Sets flash parameters: @var{name} human readable string, @var{total_size}
|
||||
+size in bytes, @var{page_size} is write page size. @var{read_cmd} and @var{pprg_cmd}
|
||||
+are commands for read and page program, respectively. @var{mass_erase_cmd},
|
||||
+@var{sector_size} and @var{sector_erase_cmd} are optional.
|
||||
+@example
|
||||
+jtagspi set 0 w25q128 0x1000000 0x100 0x03 0 0x02 0xC7 0x10000 0xD8
|
||||
+@end example
|
||||
+@end deffn
|
||||
+
|
||||
+@deffn Command {jtagspi cmd} bank_id resp_num cmd_byte ...
|
||||
+Sends command @var{cmd_byte} and at most 20 following bytes and reads
|
||||
+@var{resp_num} bytes afterwards. E.g. for 'Enter 4-byte address mode'
|
||||
+@example
|
||||
+jtagspi cmd 0 0 0xB7
|
||||
+@end example
|
||||
+@end deffn
|
||||
+
|
||||
+@deffn Command {jtagspi always_4byte} bank_id [ on | off ]
|
||||
+Some devices use 4-byte addresses for all commands except the legacy 0x03 read
|
||||
+regardless of device size. This command controls the corresponding hack.
|
||||
+@end deffn
|
||||
@end deffn
|
||||
|
||||
@deffn {Flash Driver} {xcf}
|
||||
diff --git a/src/flash/nor/jtagspi.c b/src/flash/nor/jtagspi.c
|
||||
index dc49fda61..e9a643d12 100644
|
||||
--- a/src/flash/nor/jtagspi.c
|
||||
+++ b/src/flash/nor/jtagspi.c
|
||||
@@ -29,9 +29,12 @@
|
||||
|
||||
struct jtagspi_flash_bank {
|
||||
struct jtag_tap *tap;
|
||||
- const struct flash_device *dev;
|
||||
+ struct flash_device dev;
|
||||
+ char devname[32];
|
||||
bool probed;
|
||||
+ bool always_4byte; /* use always 4-byte address except for basic read 0x03 */
|
||||
uint32_t ir;
|
||||
+ unsigned int addr_len; /* address length in bytes */
|
||||
};
|
||||
|
||||
FLASH_BANK_COMMAND_HANDLER(jtagspi_flash_bank_command)
|
||||
@@ -42,10 +45,11 @@ FLASH_BANK_COMMAND_HANDLER(jtagspi_flash_bank_command)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
info = malloc(sizeof(struct jtagspi_flash_bank));
|
||||
- if (!info) {
|
||||
+ if (info == NULL) {
|
||||
LOG_ERROR("no memory for flash bank info");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
+ bank->sectors = NULL;
|
||||
bank->driver_priv = info;
|
||||
|
||||
info->tap = NULL;
|
||||
@@ -69,70 +73,59 @@ static void jtagspi_set_ir(struct flash_bank *bank)
|
||||
jtag_add_ir_scan(info->tap, &field, TAP_IDLE);
|
||||
}
|
||||
|
||||
-static void flip_u8(uint8_t *in, uint8_t *out, int len)
|
||||
+static void flip_u8(const uint8_t *in, uint8_t *out, unsigned int len)
|
||||
{
|
||||
- for (int i = 0; i < len; i++)
|
||||
+ for (unsigned int i = 0; i < len; i++)
|
||||
out[i] = flip_u32(in[i], 8);
|
||||
}
|
||||
|
||||
static int jtagspi_cmd(struct flash_bank *bank, uint8_t cmd,
|
||||
- uint32_t *addr, uint8_t *data, int len)
|
||||
+ uint8_t *write_buffer, unsigned int write_len, uint8_t *data_buffer, int data_len)
|
||||
{
|
||||
- struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
+ assert(write_buffer || write_len == 0);
|
||||
+ assert(data_buffer || data_len == 0);
|
||||
+
|
||||
struct scan_field fields[6];
|
||||
- uint8_t marker = 1;
|
||||
- uint8_t xfer_bits_buf[4];
|
||||
- uint8_t addr_buf[3];
|
||||
- uint8_t *data_buf;
|
||||
- uint32_t xfer_bits;
|
||||
- int is_read, lenb, n;
|
||||
|
||||
- /* LOG_DEBUG("cmd=0x%02x len=%i", cmd, len); */
|
||||
+ LOG_DEBUG("cmd=0x%02x write_len=%d data_len=%d", cmd, write_len, data_len);
|
||||
|
||||
- is_read = (len < 0);
|
||||
+ /* negative data_len == read operation */
|
||||
+ const bool is_read = (data_len < 0);
|
||||
if (is_read)
|
||||
- len = -len;
|
||||
-
|
||||
- n = 0;
|
||||
+ data_len = -data_len;
|
||||
|
||||
+ int n = 0;
|
||||
+ const uint8_t marker = 1;
|
||||
fields[n].num_bits = 1;
|
||||
fields[n].out_value = ▮
|
||||
fields[n].in_value = NULL;
|
||||
n++;
|
||||
|
||||
- xfer_bits = 8 + len - 1;
|
||||
- /* cmd + read/write - 1 due to the counter implementation */
|
||||
- if (addr)
|
||||
- xfer_bits += 24;
|
||||
- h_u32_to_be(xfer_bits_buf, xfer_bits);
|
||||
- flip_u8(xfer_bits_buf, xfer_bits_buf, 4);
|
||||
- fields[n].num_bits = 32;
|
||||
- fields[n].out_value = xfer_bits_buf;
|
||||
+ /* transfer length = cmd + address + read/write,
|
||||
+ * -1 due to the counter implementation */
|
||||
+ uint8_t xfer_bits[4];
|
||||
+ h_u32_to_be(xfer_bits, ((sizeof(cmd) + write_len + data_len) * CHAR_BIT) - 1);
|
||||
+ flip_u8(xfer_bits, xfer_bits, sizeof(xfer_bits));
|
||||
+ fields[n].num_bits = sizeof(xfer_bits) * CHAR_BIT;
|
||||
+ fields[n].out_value = xfer_bits;
|
||||
fields[n].in_value = NULL;
|
||||
n++;
|
||||
|
||||
- cmd = flip_u32(cmd, 8);
|
||||
- fields[n].num_bits = 8;
|
||||
+ flip_u8(&cmd, &cmd, sizeof(cmd));
|
||||
+ fields[n].num_bits = sizeof(cmd) * CHAR_BIT;
|
||||
fields[n].out_value = &cmd;
|
||||
fields[n].in_value = NULL;
|
||||
n++;
|
||||
|
||||
- if (addr) {
|
||||
- h_u24_to_be(addr_buf, *addr);
|
||||
- flip_u8(addr_buf, addr_buf, 3);
|
||||
- fields[n].num_bits = 24;
|
||||
- fields[n].out_value = addr_buf;
|
||||
+ if (write_len) {
|
||||
+ flip_u8(write_buffer, write_buffer, write_len);
|
||||
+ fields[n].num_bits = write_len * CHAR_BIT;
|
||||
+ fields[n].out_value = write_buffer;
|
||||
fields[n].in_value = NULL;
|
||||
n++;
|
||||
}
|
||||
|
||||
- lenb = DIV_ROUND_UP(len, 8);
|
||||
- data_buf = malloc(lenb);
|
||||
- if (lenb > 0) {
|
||||
- if (!data_buf) {
|
||||
- LOG_ERROR("no memory for spi buffer");
|
||||
- return ERROR_FAIL;
|
||||
- }
|
||||
+ if (data_len > 0) {
|
||||
if (is_read) {
|
||||
fields[n].num_bits = jtag_tap_count_enabled();
|
||||
fields[n].out_value = NULL;
|
||||
@@ -140,78 +133,313 @@ static int jtagspi_cmd(struct flash_bank *bank, uint8_t cmd,
|
||||
n++;
|
||||
|
||||
fields[n].out_value = NULL;
|
||||
- fields[n].in_value = data_buf;
|
||||
+ fields[n].in_value = data_buffer;
|
||||
} else {
|
||||
- flip_u8(data, data_buf, lenb);
|
||||
- fields[n].out_value = data_buf;
|
||||
+ flip_u8(data_buffer, data_buffer, data_len);
|
||||
+ fields[n].out_value = data_buffer;
|
||||
fields[n].in_value = NULL;
|
||||
}
|
||||
- fields[n].num_bits = len;
|
||||
+ fields[n].num_bits = data_len * CHAR_BIT;
|
||||
n++;
|
||||
}
|
||||
|
||||
jtagspi_set_ir(bank);
|
||||
/* passing from an IR scan to SHIFT-DR clears BYPASS registers */
|
||||
+ struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
jtag_add_dr_scan(info->tap, n, fields, TAP_IDLE);
|
||||
int retval = jtag_execute_queue();
|
||||
|
||||
if (is_read)
|
||||
- flip_u8(data_buf, data, lenb);
|
||||
- free(data_buf);
|
||||
+ flip_u8(data_buffer, data_buffer, data_len);
|
||||
return retval;
|
||||
}
|
||||
|
||||
+COMMAND_HANDLER(jtagspi_handle_set)
|
||||
+{
|
||||
+ struct flash_bank *bank = NULL;
|
||||
+ struct jtagspi_flash_bank *info = NULL;
|
||||
+ struct flash_sector *sectors = NULL;
|
||||
+ uint32_t temp;
|
||||
+ unsigned int index = 1;
|
||||
+ int retval;
|
||||
+
|
||||
+ LOG_DEBUG("%s", __func__);
|
||||
+
|
||||
+ /* there are 6 mandatory arguments:
|
||||
+ * devname, size_in_bytes, pagesize, read_cmd, unused, pprog_cmd */
|
||||
+ if (index + 6 > CMD_ARGC) {
|
||||
+ command_print(CMD, "jtagspi: not enough arguments");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||
+ if (ERROR_OK != retval)
|
||||
+ return retval;
|
||||
+ info = bank->driver_priv;
|
||||
+
|
||||
+ /* invalidate all old info */
|
||||
+ if (info->probed) {
|
||||
+ bank->size = 0;
|
||||
+ bank->num_sectors = 0;
|
||||
+ if (bank->sectors)
|
||||
+ free(bank->sectors);
|
||||
+ bank->sectors = NULL;
|
||||
+ info->always_4byte = false;
|
||||
+ info->probed = false;
|
||||
+ }
|
||||
+ memset(&info->dev, 0, sizeof(info->dev));
|
||||
+
|
||||
+ strncpy(info->devname, CMD_ARGV[index++], sizeof(info->devname) - 1);
|
||||
+ info->devname[sizeof(info->devname) - 1] = '\0';
|
||||
+
|
||||
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[index++], temp);
|
||||
+ info->dev.size_in_bytes = temp;
|
||||
+ if ((temp & (temp - 1)) || (temp < (1UL << 8))) {
|
||||
+ command_print(CMD, "jtagspi: device size must be 2^n with n >= 8");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[index++], temp);
|
||||
+ info->dev.pagesize = temp;
|
||||
+ if (info->dev.pagesize == 0)
|
||||
+ info->dev.pagesize = SPIFLASH_DEF_PAGESIZE;
|
||||
+ if ((temp & (temp - 1)) || (temp > info->dev.size_in_bytes)) {
|
||||
+ command_print(CMD, "jtagspi: page size must be 2^n and <= device size");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[index++], info->dev.read_cmd);
|
||||
+ if ((info->dev.read_cmd != 0x03) &&
|
||||
+ (info->dev.read_cmd != 0x13)) {
|
||||
+ command_print(CMD, "jtagspi: only 0x03/0x13 READ allowed");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[index++], info->dev.qread_cmd);
|
||||
+
|
||||
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[index++], info->dev.pprog_cmd);
|
||||
+ if ((info->dev.pprog_cmd != 0x02) &&
|
||||
+ (info->dev.pprog_cmd != 0x12)) {
|
||||
+ command_print(CMD, "jtagspi: only 0x02/0x12 PPRG allowed");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ /* remaining params are optional */
|
||||
+ if (index < CMD_ARGC)
|
||||
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[index++], info->dev.chip_erase_cmd);
|
||||
+ else
|
||||
+ info->dev.chip_erase_cmd = 0x00;
|
||||
+
|
||||
+ if (index < CMD_ARGC) {
|
||||
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[index++], temp);
|
||||
+ info->dev.sectorsize = temp;
|
||||
+ if ((info->dev.sectorsize > info->dev.size_in_bytes) ||
|
||||
+ (info->dev.sectorsize < info->dev.pagesize) || (temp & (temp - 1))) {
|
||||
+ command_print(CMD, "jtagspi: sector size must be 2^n and <= device size");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ if (index < CMD_ARGC)
|
||||
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[index++], info->dev.erase_cmd);
|
||||
+ else {
|
||||
+ command_print(CMD, "jtagspi: erase command missing");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* no sector size / sector erase cmd given, treat whole bank as a single sector */
|
||||
+ info->dev.erase_cmd = 0x00;
|
||||
+ info->dev.sectorsize = info->dev.size_in_bytes;
|
||||
+ }
|
||||
+
|
||||
+ if (index < CMD_ARGC) {
|
||||
+ command_print(CMD, "jtagspi: extra arguments");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ /* set correct size value */
|
||||
+ bank->size = info->dev.size_in_bytes;
|
||||
+
|
||||
+ /* calculate address length in bytes */
|
||||
+ if (bank->size <= (1UL << 8))
|
||||
+ info->addr_len = 1;
|
||||
+ else if (bank->size <= (1UL << 16))
|
||||
+ info->addr_len = 2;
|
||||
+ else if (bank->size <= (1UL << 24))
|
||||
+ info->addr_len = 3;
|
||||
+ else {
|
||||
+ info->addr_len = 4;
|
||||
+ LOG_WARNING("4-byte addresses needed, might need extra command to enable");
|
||||
+ }
|
||||
+
|
||||
+ /* create and fill sectors array */
|
||||
+ bank->num_sectors =
|
||||
+ info->dev.size_in_bytes / info->dev.sectorsize;
|
||||
+ sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
|
||||
+ if (sectors == NULL) {
|
||||
+ LOG_ERROR("Not enough memory");
|
||||
+ return ERROR_FAIL;
|
||||
+ }
|
||||
+
|
||||
+ for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {
|
||||
+ sectors[sector].offset = sector * (info->dev.sectorsize);
|
||||
+ sectors[sector].size = info->dev.sectorsize;
|
||||
+ sectors[sector].is_erased = -1;
|
||||
+ sectors[sector].is_protected = 0;
|
||||
+ }
|
||||
+
|
||||
+ bank->sectors = sectors;
|
||||
+ info->dev.name = info->devname;
|
||||
+ if (info->dev.size_in_bytes / 4096)
|
||||
+ LOG_INFO("flash \'%s\' id = unknown\nflash size = %" PRIu32 " kbytes",
|
||||
+ info->dev.name, info->dev.size_in_bytes / 1024);
|
||||
+ else
|
||||
+ LOG_INFO("flash \'%s\' id = unknown\nflash size = %" PRIu32 " bytes",
|
||||
+ info->dev.name, info->dev.size_in_bytes);
|
||||
+ info->probed = true;
|
||||
+
|
||||
+ return ERROR_OK;
|
||||
+}
|
||||
+
|
||||
+COMMAND_HANDLER(jtagspi_handle_cmd)
|
||||
+{
|
||||
+ struct flash_bank *bank;
|
||||
+ unsigned int index = 1;
|
||||
+ const int max = 21;
|
||||
+ uint8_t num_write, num_read, write_buffer[max], read_buffer[1 << CHAR_BIT];
|
||||
+ uint8_t data, *ptr;
|
||||
+ char temp[4], output[(2 + max + (1 << CHAR_BIT)) * 3 + 8];
|
||||
+ int retval;
|
||||
+
|
||||
+ LOG_DEBUG("%s", __func__);
|
||||
+
|
||||
+ if (CMD_ARGC < 3) {
|
||||
+ command_print(CMD, "jtagspi: not enough arguments");
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ num_write = CMD_ARGC - 2;
|
||||
+ if (num_write > max) {
|
||||
+ LOG_ERROR("at most %d bytes may be send", max);
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+ }
|
||||
+
|
||||
+ retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||
+ if (ERROR_OK != retval)
|
||||
+ return retval;
|
||||
+
|
||||
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[index++], num_read);
|
||||
+
|
||||
+ snprintf(output, sizeof(output), "spi: ");
|
||||
+ for (ptr = &write_buffer[0] ; index < CMD_ARGC; index++) {
|
||||
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[index], data);
|
||||
+ *ptr++ = data;
|
||||
+ snprintf(temp, sizeof(temp), "%02" PRIx8 " ", data);
|
||||
+ strncat(output, temp, sizeof(output) - strlen(output) - 1);
|
||||
+ }
|
||||
+ strncat(output, "-> ", sizeof(output) - strlen(output) - 1);
|
||||
+
|
||||
+ /* process command */
|
||||
+ ptr = &read_buffer[0];
|
||||
+ jtagspi_cmd(bank, write_buffer[0], &write_buffer[1], num_write - 1, ptr, -num_read);
|
||||
+ if (retval != ERROR_OK)
|
||||
+ return retval;
|
||||
+
|
||||
+ for ( ; num_read > 0; num_read--) {
|
||||
+ snprintf(temp, sizeof(temp), "%02" PRIx8 " ", *ptr++);
|
||||
+ strncat(output, temp, sizeof(output) - strlen(output) - 1);
|
||||
+ }
|
||||
+ command_print(CMD, "%s", output);
|
||||
+
|
||||
+ return ERROR_OK;
|
||||
+}
|
||||
+
|
||||
+COMMAND_HANDLER(jtagspi_handle_always_4byte)
|
||||
+{
|
||||
+ struct flash_bank *bank;
|
||||
+ struct jtagspi_flash_bank *jtagspi_info;
|
||||
+ int retval;
|
||||
+
|
||||
+ LOG_DEBUG("%s", __func__);
|
||||
+
|
||||
+ if ((CMD_ARGC != 1) && (CMD_ARGC != 2))
|
||||
+ return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
+
|
||||
+ retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||
+ if (ERROR_OK != retval)
|
||||
+ return retval;
|
||||
+
|
||||
+ jtagspi_info = bank->driver_priv;
|
||||
+
|
||||
+ if (CMD_ARGC == 1)
|
||||
+ command_print(CMD, jtagspi_info->always_4byte ? "on" : "off");
|
||||
+ else
|
||||
+ COMMAND_PARSE_BOOL(CMD_ARGV[1], jtagspi_info->always_4byte, "on", "off");
|
||||
+
|
||||
+ return ERROR_OK;
|
||||
+}
|
||||
+
|
||||
static int jtagspi_probe(struct flash_bank *bank)
|
||||
{
|
||||
struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
struct flash_sector *sectors;
|
||||
+ const struct flash_device *p;
|
||||
uint8_t in_buf[3];
|
||||
uint32_t id, sectorsize;
|
||||
|
||||
- if (info->probed)
|
||||
+ if (bank->sectors) {
|
||||
free(bank->sectors);
|
||||
+ bank->sectors = NULL;
|
||||
+ }
|
||||
info->probed = false;
|
||||
|
||||
- if (!bank->target->tap) {
|
||||
+ if (bank->target->tap == NULL) {
|
||||
LOG_ERROR("Target has no JTAG tap");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
info->tap = bank->target->tap;
|
||||
|
||||
- jtagspi_cmd(bank, SPIFLASH_READ_ID, NULL, in_buf, -24);
|
||||
+ jtagspi_cmd(bank, SPIFLASH_READ_ID, NULL, 0, in_buf, -3);
|
||||
/* the table in spi.c has the manufacturer byte (first) as the lsb */
|
||||
id = le_to_h_u24(in_buf);
|
||||
|
||||
- info->dev = NULL;
|
||||
- for (const struct flash_device *p = flash_devices; p->name ; p++)
|
||||
+ memset(&info->dev, 0, sizeof(info->dev));
|
||||
+ for (p = flash_devices; p->name ; p++)
|
||||
if (p->device_id == id) {
|
||||
- info->dev = p;
|
||||
+ memcpy(&info->dev, p, sizeof(info->dev));
|
||||
break;
|
||||
}
|
||||
|
||||
- if (!(info->dev)) {
|
||||
- LOG_ERROR("Unknown flash device (ID 0x%08" PRIx32 ")", id);
|
||||
+ if (!(p->name)) {
|
||||
+ LOG_ERROR("Unknown flash device (ID 0x%06" PRIx32 ")", id & 0xFFFFFF);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
- LOG_INFO("Found flash device \'%s\' (ID 0x%08" PRIx32 ")",
|
||||
- info->dev->name, info->dev->device_id);
|
||||
+ LOG_INFO("Found flash device \'%s\' (ID 0x%06" PRIx32 ")",
|
||||
+ info->dev.name, info->dev.device_id & 0xFFFFFF);
|
||||
|
||||
/* Set correct size value */
|
||||
- bank->size = info->dev->size_in_bytes;
|
||||
- if (bank->size <= (1UL << 16))
|
||||
- LOG_WARNING("device needs 2-byte addresses - not implemented");
|
||||
- if (bank->size > (1UL << 24))
|
||||
- LOG_WARNING("device needs paging or 4-byte addresses - not implemented");
|
||||
+ bank->size = info->dev.size_in_bytes;
|
||||
+
|
||||
+ /* calculate address length in bytes */
|
||||
+ if (bank->size <= (1UL << 8))
|
||||
+ info->addr_len = 1;
|
||||
+ else if (bank->size <= (1UL << 16))
|
||||
+ info->addr_len = 2;
|
||||
+ else if (bank->size <= (1UL << 24))
|
||||
+ info->addr_len = 3;
|
||||
+ else {
|
||||
+ info->addr_len = 4;
|
||||
+ LOG_WARNING("4-byte addresses needed, might need extra command to enable");
|
||||
+ }
|
||||
|
||||
/* if no sectors, treat whole bank as single sector */
|
||||
- sectorsize = info->dev->sectorsize ?
|
||||
- info->dev->sectorsize : info->dev->size_in_bytes;
|
||||
+ sectorsize = info->dev.sectorsize ?
|
||||
+ info->dev.sectorsize : info->dev.size_in_bytes;
|
||||
|
||||
/* create and fill sectors array */
|
||||
- bank->num_sectors = info->dev->size_in_bytes / sectorsize;
|
||||
+ bank->num_sectors = info->dev.size_in_bytes / sectorsize;
|
||||
sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
|
||||
- if (!sectors) {
|
||||
+ if (sectors == NULL) {
|
||||
LOG_ERROR("not enough memory");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -228,27 +456,35 @@ static int jtagspi_probe(struct flash_bank *bank)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
+static int jtagspi_auto_probe(struct flash_bank *bank)
|
||||
+{
|
||||
+ struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
+
|
||||
+ if (info->probed)
|
||||
+ return ERROR_OK;
|
||||
+ return jtagspi_probe(bank);
|
||||
+}
|
||||
+
|
||||
static int jtagspi_read_status(struct flash_bank *bank, uint32_t *status)
|
||||
{
|
||||
uint8_t buf;
|
||||
- int err = jtagspi_cmd(bank, SPIFLASH_READ_STATUS, NULL, &buf, -8);
|
||||
+ int err = jtagspi_cmd(bank, SPIFLASH_READ_STATUS, NULL, 0, &buf, -1);
|
||||
if (err == ERROR_OK) {
|
||||
*status = buf;
|
||||
- /* LOG_DEBUG("status=0x%08" PRIx32, *status); */
|
||||
+ LOG_DEBUG("status=0x%02" PRIx8, *status);
|
||||
}
|
||||
-
|
||||
return err;
|
||||
}
|
||||
|
||||
static int jtagspi_wait(struct flash_bank *bank, int timeout_ms)
|
||||
{
|
||||
- uint32_t status;
|
||||
int64_t t0 = timeval_ms();
|
||||
int64_t dt;
|
||||
|
||||
do {
|
||||
dt = timeval_ms() - t0;
|
||||
|
||||
+ uint32_t status = (uint32_t)-1;
|
||||
int retval = jtagspi_read_status(bank, &status);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
@@ -266,16 +502,15 @@ static int jtagspi_wait(struct flash_bank *bank, int timeout_ms)
|
||||
|
||||
static int jtagspi_write_enable(struct flash_bank *bank)
|
||||
{
|
||||
- uint32_t status;
|
||||
-
|
||||
- jtagspi_cmd(bank, SPIFLASH_WRITE_ENABLE, NULL, NULL, 0);
|
||||
+ jtagspi_cmd(bank, SPIFLASH_WRITE_ENABLE, NULL, 0, NULL, 0);
|
||||
|
||||
+ uint32_t status = (uint32_t)-1;
|
||||
int retval = jtagspi_read_status(bank, &status);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
if ((status & SPIFLASH_WE_BIT) == 0) {
|
||||
- LOG_ERROR("Cannot enable write to flash. Status=0x%08" PRIx32, status);
|
||||
+ LOG_ERROR("Cannot enable write to flash. Status=0x%02" PRIx8, status);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
return ERROR_OK;
|
||||
@@ -287,28 +522,51 @@ static int jtagspi_bulk_erase(struct flash_bank *bank)
|
||||
int retval;
|
||||
int64_t t0 = timeval_ms();
|
||||
|
||||
- if (info->dev->chip_erase_cmd == 0x00)
|
||||
+ if (info->dev.chip_erase_cmd == 0x00)
|
||||
return ERROR_FLASH_OPER_UNSUPPORTED;
|
||||
|
||||
retval = jtagspi_write_enable(bank);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
- jtagspi_cmd(bank, info->dev->chip_erase_cmd, NULL, NULL, 0);
|
||||
- retval = jtagspi_wait(bank, bank->num_sectors*JTAGSPI_MAX_TIMEOUT);
|
||||
+
|
||||
+ jtagspi_cmd(bank, info->dev.chip_erase_cmd, NULL, 0, NULL, 0);
|
||||
+ if (retval != ERROR_OK)
|
||||
+ return retval;
|
||||
+
|
||||
+ retval = jtagspi_wait(bank, bank->num_sectors * JTAGSPI_MAX_TIMEOUT);
|
||||
LOG_INFO("took %" PRId64 " ms", timeval_ms() - t0);
|
||||
return retval;
|
||||
}
|
||||
|
||||
+static uint8_t *fill_addr(uint32_t addr, unsigned int addr_len, uint8_t *buffer)
|
||||
+{
|
||||
+ for (buffer += addr_len; addr_len > 0; --addr_len) {
|
||||
+ *--buffer = addr;
|
||||
+ addr >>= 8;
|
||||
+ }
|
||||
+
|
||||
+ return buffer;
|
||||
+}
|
||||
+
|
||||
static int jtagspi_sector_erase(struct flash_bank *bank, unsigned int sector)
|
||||
{
|
||||
struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
int retval;
|
||||
+ uint8_t addr[sizeof(uint32_t)];
|
||||
int64_t t0 = timeval_ms();
|
||||
|
||||
retval = jtagspi_write_enable(bank);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
- jtagspi_cmd(bank, info->dev->erase_cmd, &bank->sectors[sector].offset, NULL, 0);
|
||||
+
|
||||
+ /* ATXP032/064/128 use always 4-byte addresses except for 0x03 read */
|
||||
+ unsigned int addr_len = info->always_4byte ? 4 : info->addr_len;
|
||||
+
|
||||
+ retval = jtagspi_cmd(bank, info->dev.erase_cmd, fill_addr(bank->sectors[sector].offset, addr_len, addr),
|
||||
+ addr_len, NULL, 0);
|
||||
+ if (retval != ERROR_OK)
|
||||
+ return retval;
|
||||
+
|
||||
retval = jtagspi_wait(bank, JTAGSPI_MAX_TIMEOUT);
|
||||
LOG_INFO("sector %u took %" PRId64 " ms", sector, timeval_ms() - t0);
|
||||
return retval;
|
||||
@@ -339,8 +597,9 @@ static int jtagspi_erase(struct flash_bank *bank, unsigned int first,
|
||||
}
|
||||
}
|
||||
|
||||
- if (first == 0 && last == (bank->num_sectors - 1)
|
||||
- && info->dev->chip_erase_cmd != info->dev->erase_cmd) {
|
||||
+ if (first == 0 && last == (bank->num_sectors - 1) &&
|
||||
+ info->dev.chip_erase_cmd != 0x00 &&
|
||||
+ info->dev.chip_erase_cmd != info->dev.erase_cmd) {
|
||||
LOG_DEBUG("Trying bulk erase.");
|
||||
retval = jtagspi_bulk_erase(bank);
|
||||
if (retval == ERROR_OK)
|
||||
@@ -349,7 +608,7 @@ static int jtagspi_erase(struct flash_bank *bank, unsigned int first,
|
||||
LOG_WARNING("Bulk flash erase failed. Falling back to sector erase.");
|
||||
}
|
||||
|
||||
- if (info->dev->erase_cmd == 0x00)
|
||||
+ if (info->dev.erase_cmd == 0x00)
|
||||
return ERROR_FLASH_OPER_UNSUPPORTED;
|
||||
|
||||
for (unsigned int sector = first; sector <= last; sector++) {
|
||||
@@ -374,49 +633,93 @@ static int jtagspi_protect(struct flash_bank *bank, int set, unsigned int first,
|
||||
static int jtagspi_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
|
||||
{
|
||||
struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
+ uint32_t pagesize, currsize;
|
||||
+ uint8_t addr[sizeof(uint32_t)];
|
||||
+ int retval;
|
||||
|
||||
if (!(info->probed)) {
|
||||
- LOG_ERROR("Flash bank not yet probed.");
|
||||
+ LOG_ERROR("Flash bank not probed.");
|
||||
return ERROR_FLASH_BANK_NOT_PROBED;
|
||||
}
|
||||
|
||||
- jtagspi_cmd(bank, SPIFLASH_READ, &offset, buffer, -count*8);
|
||||
+ /* if no sectorsize, use reasonable default */
|
||||
+ pagesize = info->dev.sectorsize ? info->dev.sectorsize : info->dev.pagesize;
|
||||
+ if (pagesize == 0)
|
||||
+ pagesize = (info->dev.size_in_bytes <= SPIFLASH_DEF_PAGESIZE) ?
|
||||
+ info->dev.size_in_bytes : SPIFLASH_DEF_PAGESIZE;
|
||||
+
|
||||
+ /* ATXP032/064/128 use always 4-byte addresses except for 0x03 read */
|
||||
+ unsigned int addr_len = ((info->dev.read_cmd != 0x03) && info->always_4byte) ? 4 : info->addr_len;
|
||||
+
|
||||
+ while (count > 0) {
|
||||
+ /* length up to end of current page */
|
||||
+ currsize = ((offset + pagesize) & ~(pagesize - 1)) - offset;
|
||||
+ /* but no more than remaining size */
|
||||
+ currsize = (count < currsize) ? count : currsize;
|
||||
+
|
||||
+ retval = jtagspi_cmd(bank, info->dev.read_cmd, fill_addr(offset, addr_len, addr),
|
||||
+ addr_len, buffer, -currsize);
|
||||
+ if (retval != ERROR_OK) {
|
||||
+ LOG_ERROR("page read error");
|
||||
+ return retval;
|
||||
+ }
|
||||
+ LOG_DEBUG("read page at 0x%08" PRIx32, offset);
|
||||
+ offset += currsize;
|
||||
+ buffer += currsize;
|
||||
+ count -= currsize;
|
||||
+ }
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int jtagspi_page_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
|
||||
{
|
||||
+ struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
+ uint8_t addr[sizeof(uint32_t)];
|
||||
int retval;
|
||||
|
||||
retval = jtagspi_write_enable(bank);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
- jtagspi_cmd(bank, SPIFLASH_PAGE_PROGRAM, &offset, (uint8_t *) buffer, count*8);
|
||||
+
|
||||
+ /* ATXP032/064/128 use always 4-byte addresses except for 0x03 read */
|
||||
+ unsigned int addr_len = ((info->dev.read_cmd != 0x03) && info->always_4byte) ? 4 : info->addr_len;
|
||||
+
|
||||
+ retval = jtagspi_cmd(bank, info->dev.pprog_cmd, fill_addr(offset, addr_len, addr),
|
||||
+ addr_len, (uint8_t *) buffer, count);
|
||||
+ if (retval != ERROR_OK)
|
||||
+ return retval;
|
||||
return jtagspi_wait(bank, JTAGSPI_MAX_TIMEOUT);
|
||||
}
|
||||
|
||||
static int jtagspi_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
|
||||
{
|
||||
struct jtagspi_flash_bank *info = bank->driver_priv;
|
||||
+ uint32_t pagesize, currsize;
|
||||
int retval;
|
||||
- uint32_t n, pagesize;
|
||||
|
||||
if (!(info->probed)) {
|
||||
- LOG_ERROR("Flash bank not yet probed.");
|
||||
+ LOG_ERROR("Flash bank not probed.");
|
||||
return ERROR_FLASH_BANK_NOT_PROBED;
|
||||
}
|
||||
|
||||
/* if no write pagesize, use reasonable default */
|
||||
- pagesize = info->dev->pagesize ? info->dev->pagesize : SPIFLASH_DEF_PAGESIZE;
|
||||
+ pagesize = info->dev.pagesize ? info->dev.pagesize : SPIFLASH_DEF_PAGESIZE;
|
||||
+
|
||||
+ while (count > 0) {
|
||||
+ /* length up to end of current page */
|
||||
+ currsize = ((offset + pagesize) & ~(pagesize - 1)) - offset;
|
||||
+ /* but no more than remaining size */
|
||||
+ currsize = (count < currsize) ? count : currsize;
|
||||
|
||||
- for (n = 0; n < count; n += pagesize) {
|
||||
- retval = jtagspi_page_write(bank, buffer + n, offset + n,
|
||||
- MIN(count - n, pagesize));
|
||||
+ retval = jtagspi_page_write(bank, buffer, offset, currsize);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_ERROR("page write error");
|
||||
return retval;
|
||||
}
|
||||
- LOG_DEBUG("wrote page at 0x%08" PRIx32, offset + n);
|
||||
+ LOG_DEBUG("wrote page at 0x%08" PRIx32, offset);
|
||||
+ offset += currsize;
|
||||
+ buffer += currsize;
|
||||
+ count -= currsize;
|
||||
}
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -430,22 +733,72 @@ static int jtagspi_info(struct flash_bank *bank, struct command_invocation *cmd)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
- command_print_sameline(cmd, "\nSPIFI flash information:\n"
|
||||
- " Device \'%s\' (ID 0x%08" PRIx32 ")\n",
|
||||
- info->dev->name, info->dev->device_id);
|
||||
+ command_print_sameline(cmd, "flash \'%s\', device id = 0x%06" PRIx32
|
||||
+ ", flash size = %" PRIu32 " %sbytes\n(page size = %" PRIu32
|
||||
+ ", read = 0x%02" PRIx8 ", qread = 0x%02" PRIx8
|
||||
+ ", pprog = 0x%02" PRIx8 ", mass_erase = 0x%02" PRIx8
|
||||
+ ", sector size = %" PRIu32 " %sbytes, sector_erase = 0x%02" PRIx8 ")",
|
||||
+ info->dev.name, info->dev.device_id & 0xFFFFFF,
|
||||
+ bank->size / 4096 ? bank->size / 1024 : bank->size,
|
||||
+ bank->size / 4096 ? "k" : "", info->dev.pagesize,
|
||||
+ info->dev.read_cmd, info->dev.qread_cmd,
|
||||
+ info->dev.pprog_cmd, info->dev.chip_erase_cmd,
|
||||
+ info->dev.sectorsize / 4096 ?
|
||||
+ info->dev.sectorsize / 1024 : info->dev.sectorsize,
|
||||
+ info->dev.sectorsize / 4096 ? "k" : "",
|
||||
+ info->dev.erase_cmd);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
+static const struct command_registration jtagspi_exec_command_handlers[] = {
|
||||
+ {
|
||||
+ .name = "set",
|
||||
+ .handler = jtagspi_handle_set,
|
||||
+ .mode = COMMAND_EXEC,
|
||||
+ .usage = "bank_id name chip_size page_size read_cmd unused pprg_cmd "
|
||||
+ "[ mass_erase_cmd ] [ sector_size sector_erase_cmd ]",
|
||||
+ .help = "Set device parameters if not autodetected.",
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "cmd",
|
||||
+ .handler = jtagspi_handle_cmd,
|
||||
+ .mode = COMMAND_EXEC,
|
||||
+ .usage = "bank_id num_resp cmd_byte ...",
|
||||
+ .help = "Send low-level command cmd_byte and following bytes, read num_bytes.",
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "always_4byte",
|
||||
+ .handler = jtagspi_handle_always_4byte,
|
||||
+ .mode = COMMAND_EXEC,
|
||||
+ .usage = "bank_id [ on | off ]",
|
||||
+ .help = "Use always 4-byte address except for basic 0x03.",
|
||||
+ },
|
||||
+
|
||||
+ COMMAND_REGISTRATION_DONE
|
||||
+};
|
||||
+
|
||||
+static const struct command_registration jtagspi_command_handlers[] = {
|
||||
+ {
|
||||
+ .name = "jtagspi",
|
||||
+ .mode = COMMAND_ANY,
|
||||
+ .help = "jtagspi command group",
|
||||
+ .usage = "",
|
||||
+ .chain = jtagspi_exec_command_handlers,
|
||||
+ },
|
||||
+ COMMAND_REGISTRATION_DONE
|
||||
+};
|
||||
+
|
||||
const struct flash_driver jtagspi_flash = {
|
||||
.name = "jtagspi",
|
||||
+ .commands = jtagspi_command_handlers,
|
||||
.flash_bank_command = jtagspi_flash_bank_command,
|
||||
.erase = jtagspi_erase,
|
||||
.protect = jtagspi_protect,
|
||||
.write = jtagspi_write,
|
||||
.read = jtagspi_read,
|
||||
.probe = jtagspi_probe,
|
||||
- .auto_probe = jtagspi_probe,
|
||||
+ .auto_probe = jtagspi_auto_probe,
|
||||
.erase_check = default_flash_blank_check,
|
||||
.info = jtagspi_info,
|
||||
.free_driver_priv = default_flash_free_driver_priv,
|
|
@ -1,74 +1,35 @@
|
|||
{ stdenv, lib, fetchFromGitHub, autoreconfHook, libftdi, libusb1, pkgconfig, hidapi }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "openocd-mlabs";
|
||||
version = "0.10.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "openocd";
|
||||
fetchSubmodules = true;
|
||||
rev = "c383a57adcff332b2c5cf8d55a84626285b42c2c";
|
||||
sha256 = "0xlj9cs72acx3zqagvr7f1c0v6lnqhl8fgrlhgmhmvk5n9knk492";
|
||||
};
|
||||
bscan_spi_bitstreams = fetchFromGitHub {
|
||||
{ stdenv, buildEnv, lib, fetchFromGitHub, autoreconfHook269, openocd }:
|
||||
let
|
||||
bscan_spi_bitstreams-pkg = stdenv.mkDerivation {
|
||||
name = "bscan_spi_bitstreams";
|
||||
src = fetchFromGitHub {
|
||||
owner = "quartiq";
|
||||
repo = "bscan_spi_bitstreams";
|
||||
rev = "01d8f819f15baf9a8cc5d96945a51e4d267ff564";
|
||||
sha256 = "1zqv47kzgvbn4c8cr019a6wcja7gn5h1z4kvw5bhpc72fyhagal9";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ autoreconfHook libftdi libusb1 hidapi ];
|
||||
|
||||
configureFlags = [
|
||||
"--enable-jtag_vpi"
|
||||
"--enable-usb_blaster_libftdi"
|
||||
"--enable-amtjtagaccel"
|
||||
"--enable-gw16012"
|
||||
"--enable-presto_libftdi"
|
||||
"--enable-openjtag_ftdi"
|
||||
"--enable-oocd_trace"
|
||||
"--enable-buspirate"
|
||||
"--enable-sysfsgpio"
|
||||
"--enable-remote-bitbang"
|
||||
"--disable-werror"
|
||||
];
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
"-Wno-implicit-fallthrough"
|
||||
"-Wno-format-truncation"
|
||||
"-Wno-format-overflow"
|
||||
"-Wno-error=tautological-compare"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$out/etc/udev/rules.d"
|
||||
rules="$out/share/openocd/contrib/60-openocd.rules"
|
||||
if [ ! -f "$rules" ]; then
|
||||
echo "$rules is missing, must update the Nix file."
|
||||
exit 1
|
||||
fi
|
||||
ln -s "$rules" "$out/etc/udev/rules.d/"
|
||||
|
||||
mkdir -p "$out/share/bscan-spi-bitstreams"
|
||||
cp ${bscan_spi_bitstreams}/*.bit "$out/share/bscan-spi-bitstreams"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing";
|
||||
longDescription = ''
|
||||
OpenOCD provides on-chip programming and debugging support with a layered
|
||||
architecture of JTAG interface and TAP support, debug target support
|
||||
(e.g. ARM, MIPS), and flash chip drivers (e.g. CFI, NAND, etc.). Several
|
||||
network interfaces are available for interactiving with OpenOCD: HTTP,
|
||||
telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
|
||||
"remote target" for source-level debugging of embedded systems using the
|
||||
GNU GDB program.
|
||||
};
|
||||
phases = ["installPhase"];
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/share/bscan-spi-bitstreams
|
||||
cp $src/*.bit $out/share/bscan-spi-bitstreams
|
||||
'';
|
||||
homepage = http://openocd.sourceforge.net/;
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ sb0 ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
openocd-fixed = openocd.overrideAttrs(oa: {
|
||||
version = "unstable-2021-09-15";
|
||||
src = fetchFromGitHub {
|
||||
owner = "openocd-org";
|
||||
repo = "openocd";
|
||||
rev = "a0bd3c9924870c3b8f428648410181040dabc33c";
|
||||
sha256 = "sha256-YgUsl4/FohfsOncM4uiz/3c6g2ZN4oZ0y5vV/2Skwqg=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
# https://review.openocd.org/c/openocd/+/4876
|
||||
patches = oa.patches or [] ++ [ ./openocd-jtagspi.diff ];
|
||||
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [ autoreconfHook269 ];
|
||||
});
|
||||
in
|
||||
buildEnv {
|
||||
name = "openocd-bscanspi";
|
||||
paths = [ openocd-fixed bscan_spi_bitstreams-pkg ];
|
||||
}
|
||||
|
|
|
@ -28,31 +28,16 @@ rec {
|
|||
|
||||
pythonparser = python3Packages.buildPythonPackage rec {
|
||||
pname = "pythonparser";
|
||||
version = "1.3";
|
||||
version = "1.4";
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "pythonparser";
|
||||
rev = "5b391fe86f43bb9f4f96c5bc0532e2a112db2936";
|
||||
sha256 = "1gw1fk4y2l6bwq0fg2a9dfc1rvq8cv492dyil96amjdhsxvnx35b";
|
||||
rev = "5413ee5c9f8760e95c6acd5d6e88dabb831ad201";
|
||||
sha256 = "1b9p3pjnfaiaf2k0a3iq39aj2vymfxx139hqdqkd3q4awrwy1957";
|
||||
};
|
||||
patches = [ ./pythonparserver.patch ];
|
||||
propagatedBuildInputs = with python3Packages; [ regex ];
|
||||
};
|
||||
|
||||
pyqtgraph-qt5 = python3Packages.buildPythonPackage rec {
|
||||
pname = "pyqtgraph_qt5";
|
||||
version = "0.11.0";
|
||||
doCheck = false;
|
||||
pythonImportsCheck = [ "pyqtgraph" ];
|
||||
src = fetchFromGitHub {
|
||||
owner = "pyqtgraph";
|
||||
repo = "pyqtgraph";
|
||||
rev = "pyqtgraph-${version}";
|
||||
sha256 = "03fvpkqdn80ni51msvyivmghw41qk4vplwdqndkvzzzlppimdjbn";
|
||||
};
|
||||
propagatedBuildInputs = with python3Packages; [ scipy numpy pyqt5 pyopengl ];
|
||||
};
|
||||
|
||||
qasync = python3Packages.buildPythonPackage rec {
|
||||
pname = "qasync";
|
||||
version = "0.10.0";
|
||||
|
@ -86,21 +71,21 @@ rec {
|
|||
|
||||
misoc = python3Packages.buildPythonPackage {
|
||||
pname = "misoc";
|
||||
version = if misoc-new then "unstable-2021-02-15" else "unstable-2020-05-29";
|
||||
version = if misoc-new then "unstable-2021-10-10" else "unstable-2021-02-15";
|
||||
|
||||
src = if misoc-new
|
||||
then (fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "misoc";
|
||||
rev = "d84551418042cea0891ea743442e20684b51e77a";
|
||||
sha256 = "1id5qjr9dl4r3vi6jdn7dfpnr2wb08nrm3nfscn18clbbdxybyjn";
|
||||
rev = "f5203e406520874e15ab5d070058ef642fc57fd9";
|
||||
sha256 = "sha256-/2XTejqj0Bo81HaTrlTSWwInnWwsuqnq+CURXbpIrkA=";
|
||||
fetchSubmodules = true;
|
||||
})
|
||||
else (fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "misoc";
|
||||
rev = "7e5fe8d38835175202dad2c51d37b20b76fd9e16";
|
||||
sha256 = "0i8bppz7x2s45lx9n49c0r87pqps09z35yzc17amvx21qsplahxn";
|
||||
rev = "d84551418042cea0891ea743442e20684b51e77a";
|
||||
sha256 = "1id5qjr9dl4r3vi6jdn7dfpnr2wb08nrm3nfscn18clbbdxybyjn";
|
||||
fetchSubmodules = true;
|
||||
});
|
||||
|
||||
|
@ -119,13 +104,13 @@ rec {
|
|||
|
||||
migen = python3Packages.buildPythonPackage rec {
|
||||
pname = "migen";
|
||||
version = "unstable-2021-02-08";
|
||||
version = "unstable-2021-12-16";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "migen";
|
||||
rev = "7014bdccc11270764186e6a4441fb58238c612aa";
|
||||
sha256 = "12mhmcdf0jqv33ald9x9zb1qi26sw4ywdfgg5saqvmx0pmbmvynk";
|
||||
rev = "ac703010eaa06ac9b6e32f97c6fa98b15de22b31";
|
||||
sha256 = "sha256-qpVj/yJf4hDDc99XXpVPH4EbLC8aCmEtACn5qNc3DGI=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [ colorama ];
|
||||
|
@ -161,13 +146,13 @@ rec {
|
|||
|
||||
jesd204b = python3Packages.buildPythonPackage rec {
|
||||
pname = "jesd204b";
|
||||
version = "unstable-2020-12-18";
|
||||
version = "unstable-2021-05-05";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "m-labs";
|
||||
repo = "jesd204b";
|
||||
rev = "23bd08f5ee95eb42502f9fbe1c2a45e8c083eab9";
|
||||
sha256 = "0x2mh5fv4q0b1f8pjc2kcyjqbfgiyp1hlvbfgk8dbsraj50i566h";
|
||||
rev = "bf1cd9014c8b7a9db67609f653634daaf3bcd39b";
|
||||
sha256 = "035csm6as4p75cjz7kd6gnras14856i2jzi9g1gd800g284hw9n3";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [ migen misoc ];
|
||||
|
@ -228,13 +213,13 @@ rec {
|
|||
|
||||
migen-axi = python3Packages.buildPythonPackage {
|
||||
pname = "migen-axi";
|
||||
version = "unstable-2021-01-22";
|
||||
version = "unstable-2021-09-15";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "peteut";
|
||||
repo = "migen-axi";
|
||||
rev = "9439ee900358598cecc682db327aa30e506172b5";
|
||||
sha256 = "1z5s8ifq7fbpqi6sx2i87rmz63kbgh9ck94fs2qf21ixhxi46nm3";
|
||||
rev = "9763505ee96acd7572280a2d1233721342dc7c3f";
|
||||
sha256 = "15c7g05n183rka66fl1glzp6h7xjlpy1p6k8biry24dangsmxmvg";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ python3Packages.pbr ];
|
||||
|
@ -242,17 +227,21 @@ rec {
|
|||
|
||||
postPatch = ''
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "jinja2==2.10.3" "jinja2"
|
||||
--replace "jinja2==2.11.3" "jinja2"
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "future==0.18.2" "future"
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "ramda==0.5.5" "ramda"
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "colorama==0.4.3" "colorama"
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "toolz==0.10.0" "toolz"
|
||||
substituteInPlace requirements.txt \
|
||||
--replace "pyserial==3.4" "pyserial"
|
||||
'';
|
||||
|
||||
|
||||
checkInputs = [ python3Packages.pytest python3Packages.pytest-flake8 ];
|
||||
checkInputs = [ python3Packages.pytest python3Packages.pytest-timeout python3Packages.pytest-flake8 ];
|
||||
checkPhase = "pytest";
|
||||
|
||||
preBuild = ''
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
diff --git a/pythonparser/lexer.py b/pythonparser/lexer.py
|
||||
index a62eaf1..c70e85a 100644
|
||||
--- a/pythonparser/lexer.py
|
||||
+++ b/pythonparser/lexer.py
|
||||
@@ -79,6 +79,8 @@ class Lexer:
|
||||
(3, 4): _reserved_3_1,
|
||||
(3, 5): _reserved_3_5,
|
||||
(3, 6): _reserved_3_5,
|
||||
+ (3, 7): _reserved_3_5,
|
||||
+ (3, 8): _reserved_3_5,
|
||||
}
|
||||
"""
|
||||
A map from a tuple (*major*, *minor*) corresponding to Python version to
|
||||
@@ -102,6 +104,8 @@ class Lexer:
|
||||
(3, 4): _string_prefixes_3_3,
|
||||
(3, 5): _string_prefixes_3_3,
|
||||
(3, 6): _string_prefixes_3_6,
|
||||
+ (3, 7): _string_prefixes_3_6,
|
||||
+ (3, 8): _string_prefixes_3_6,
|
||||
}
|
||||
"""
|
||||
A map from a tuple (*major*, *minor*) corresponding to Python version to
|
||||
diff --git a/pythonparser/parser.py b/pythonparser/parser.py
|
||||
index 10c741d..62b93e1 100644
|
||||
--- a/pythonparser/parser.py
|
||||
+++ b/pythonparser/parser.py
|
||||
@@ -419,7 +419,7 @@ class Parser(object):
|
||||
self.expr_stmt_1 = self.expr_stmt_1__26
|
||||
self.yield_expr = self.yield_expr__26
|
||||
return
|
||||
- elif version in ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6)):
|
||||
+ elif version in ((3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8)):
|
||||
if version == (3, 0):
|
||||
self.with_stmt = self.with_stmt__26 # lol
|
||||
else:
|
|
@ -0,0 +1,20 @@
|
|||
{ pkgs }:
|
||||
let
|
||||
rustManifest = pkgs.fetchurl {
|
||||
url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
|
||||
sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c=";
|
||||
};
|
||||
targets = [];
|
||||
rustChannelOfTargets = _channel: _date: targets:
|
||||
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
||||
inherit (pkgs) stdenv lib fetchurl patchelf;
|
||||
}).rust.override {
|
||||
inherit targets;
|
||||
extensions = ["rust-src"];
|
||||
};
|
||||
rust = rustChannelOfTargets "nightly" null targets;
|
||||
in
|
||||
pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
})
|
|
@ -4,13 +4,14 @@ let
|
|||
artiqpkgs = import ./default.nix { inherit pkgs; };
|
||||
vivado = import ./vivado.nix { inherit pkgs; };
|
||||
in
|
||||
assert pkgs.lib.asserts.assertMsg (!pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "7.0") "For ARTIQ 7+, use 'nix develop' on the flake instead.";
|
||||
pkgs.mkShell {
|
||||
buildInputs = [
|
||||
vivado
|
||||
pkgs.gnumake
|
||||
(pkgs.python3.withPackages(ps: (with ps; [ jinja2 jsonschema numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ])))
|
||||
artiqpkgs.cargo
|
||||
artiqpkgs.rustc
|
||||
artiqpkgs.cargo-legacy
|
||||
artiqpkgs.rustc-legacy
|
||||
artiqpkgs.binutils-or1k
|
||||
artiqpkgs.binutils-arm
|
||||
artiqpkgs.llvm-or1k
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Install Vivado in /opt and add to /etc/nixos/configuration.nix:
|
||||
# nix.sandboxPaths = ["/opt"];
|
||||
|
||||
{ pkgs, vivadoPath ? "/opt/Xilinx/Vivado/2020.1" }:
|
||||
{ pkgs, vivadoPath ? "/opt/Xilinx/Vivado/2021.2" }:
|
||||
|
||||
pkgs.buildFHSUserEnv {
|
||||
name = "vivado";
|
||||
|
@ -17,7 +17,7 @@ pkgs.buildFHSUserEnv {
|
|||
xorg.libXext
|
||||
xorg.libXtst
|
||||
xorg.libXi
|
||||
]
|
||||
] ++ ( if pkgs ? libxcrypt-legacy then [ pkgs.libxcrypt-legacy ] else [])
|
||||
);
|
||||
profile = "source ${vivadoPath}/settings64.sh";
|
||||
runScript = "vivado";
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{ pkgs }:
|
||||
|
||||
let
|
||||
# Pin nixpkgs to avoid frequent resource-intensive Windows reinstallations on Hydra.
|
||||
wfvm-pkgs = pkgs.fetchFromGitHub {
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs";
|
||||
rev = "f8248ab6d9e69ea9c07950d73d48807ec595e923";
|
||||
sha256 = "009i9j6mbq6i481088jllblgdnci105b2q4mscprdawg3knlyahk";
|
||||
};
|
||||
wfvm = pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/wfvm.git";
|
||||
rev = "4b497938ffd9fcddf84a3dbe2f01524395292adb";
|
||||
sha256 = "0m3kdbbcskqc1lf8b5f7ccbll9b7vkl4r00kbyx3yjb2rs6cqvil";
|
||||
};
|
||||
in import "${wfvm}/wfvm" { pkgs = (import wfvm-pkgs {}); }
|
|
@ -10,7 +10,7 @@ let
|
|||
};
|
||||
wfvm = pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/wfvm.git";
|
||||
rev = "4b497938ffd9fcddf84a3dbe2f01524395292adb";
|
||||
sha256 = "0m3kdbbcskqc1lf8b5f7ccbll9b7vkl4r00kbyx3yjb2rs6cqvil";
|
||||
rev = "c7d9060eeef46bebaf376c95ca37c7a65a2ea896";
|
||||
sha256 = "022fb7zpn48hg9qihmqmzqdphks7b7cbnw6f5s1qy1in5c7f8rx9";
|
||||
};
|
||||
in import "${wfvm}/wfvm" { pkgs = (import wfvm-pkgs {}); }
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/noarch/prettytable-2.1.0-pyhd8ed1ab_0.tar.bz2";
|
||||
sha256 = "1w71padwzy6ay5g8zl575ali994cssgcgzf5917rap3fmw2mgg4d";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/six-1.16.0-pyhd3eb1b0_0.tar.bz2";
|
||||
sha256 = "120wav3bxbyv0jsvbl94rxsigqqchsqg4qqxccg9ij7ydirmqaql";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/pyqtgraph-0.11.0-py_0.tar.bz2";
|
||||
sha256 = "1jnid69dpvhd8nscmkm761qpqz8ip0gka5av90xs3i0pqkqmffqg";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/cached-property-1.5.2-py_0.tar.bz2";
|
||||
sha256 = "01mcbrsrdwvinyvp0fs2hbkczydb33gbz59ldhb1484w5mm9y9bi";
|
||||
})
|
||||
]
|
|
@ -0,0 +1,52 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/cached-property-1.5.2-py_0.tar.bz2";
|
||||
sha256 = "01mcbrsrdwvinyvp0fs2hbkczydb33gbz59ldhb1484w5mm9y9bi";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/zipp-3.6.0-pyhd3eb1b0_0.tar.bz2";
|
||||
sha256 = "1wj0hmhn09b4szs5zyslpd1mggy90pbjil6q3lyqkw3z492za80q";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/noarch/prettytable-2.4.0-pyhd8ed1ab_0.tar.bz2";
|
||||
sha256 = "1iv2x8m8xf2y8v68kz2lil2zaji7gsz099zs8wsrap03j5vpraf0";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/wheel-0.37.0-pyhd3eb1b0_1.tar.bz2";
|
||||
sha256 = "10bxbfy7dlmbr8b21ddb1k2wkrzhs7j2zgmss38pv4g5xidv9v74";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/pyqtgraph-0.11.0-py_0.tar.bz2";
|
||||
sha256 = "1jnid69dpvhd8nscmkm761qpqz8ip0gka5av90xs3i0pqkqmffqg";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/six-1.16.0-pyhd3eb1b0_0.tar.bz2";
|
||||
sha256 = "120wav3bxbyv0jsvbl94rxsigqqchsqg4qqxccg9ij7ydirmqaql";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/python-dateutil-2.8.2-pyhd3eb1b0_0.tar.bz2";
|
||||
sha256 = "1brzm9v9yvs3xhdh89jzw5xjq4a3r9vizhkhdfcax86d2q52ji97";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/pycparser-2.21-pyhd3eb1b0_0.tar.bz2";
|
||||
sha256 = "1dyi89xx73kq0caz4jx493czn16w0dl1gjhw0c5kw28bxz6i8wm8";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/wcwidth-0.2.5-pyhd3eb1b0_0.tar.bz2";
|
||||
sha256 = "1x3sncbrp7bml6qjss24qyy0rsjbdhnzjwpf6apcd14kzspnr21a";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/tzdata-2021e-hda174b7_0.tar.bz2";
|
||||
sha256 = "1sxgc0pamsskszm29cxpwzlffydxjr3aqpgly7j1f3ansvchxvb4";
|
||||
})
|
||||
]
|
|
@ -1,27 +0,0 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/noarch/prettytable-0.7.2-py_3.tar.bz2";
|
||||
sha256 = "0b7s4xm6bbkcg37sf1i3mxrbac0vxhryq22m3qx4x9kh6k2c5g5q";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/six-1.15.0-py_0.tar.bz2";
|
||||
sha256 = "08rsfp9bd2mz8r120s8w5vgncy0gn732xa0lfgbmx833548cfqmb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/python-dateutil-2.8.1-py_0.tar.bz2";
|
||||
sha256 = "0cbcd0jq6683ibj8ncsmmrbhbjvwww8i22lb68bx4xfzsmb9z8cb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/cached-property-1.5.1-py_1.tar.bz2";
|
||||
sha256 = "1yl6h3wb6hxgw79i7rpgpq260l5vqfcj5dv5kyxn8z99xdkp52q5";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/noarch/pycparser-2.20-py_0.tar.bz2";
|
||||
sha256 = "1qwcb07q8cjz0qpj6pfxb0qb68kddmx9bv9wr5pghwz78q8073z9";
|
||||
})
|
||||
]
|
|
@ -0,0 +1,67 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-base-1.20.2-py38hc2deb75_0.tar.bz2";
|
||||
sha256 = "1940fryxlil04d5y0df1s1sydhny8l97slvfm7v40mxibdmf2sdn";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/hdf5-1.10.6-h7ebc959_0.tar.bz2";
|
||||
sha256 = "09bik65gspyrqj3j5p67wf2ywhgyfz3pkw39gwdzha7yyjkkzx0q";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/certifi-2021.5.30-py38haa95532_0.tar.bz2";
|
||||
sha256 = "0hzj23xjw88wllz1l4qdnzp335608vm8pl7w1ka9pkg6ip69lnpm";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/sqlite-3.36.0-h2bbff1b_0.tar.bz2";
|
||||
sha256 = "15w0lhcl97wafqvc6ccc96311wc5rrmh16i4ki1pw6kzkfmr1k6r";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/libgit2-1.1.1-h8648793_0.tar.bz2";
|
||||
sha256 = "0rwmd48g7sywmxgcyjad3hznpm15d3w5604syrkcs2ryih0cgwkd";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/h5py-3.2.1-py38h3de5c98_0.tar.bz2";
|
||||
sha256 = "17czl7gvv6d9v6ng9l6c0i1iy181cr1qq7cyn2s90kamnfh3dx8b";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-1.20.2-py38ha4e8547_0.tar.bz2";
|
||||
sha256 = "0w4hkirwgh4bp7djzxp2yh086jfdbz1y3njsrpqm441rjjq39hpz";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/python_abi-3.8-2_cp38.tar.bz2";
|
||||
sha256 = "1j62rls5r6646b7gagc7d6jj6sqiyqd9vq442dqg3pwyldlz3zqg";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-levenshtein-0.12.2-py38h2bbff1b_0.tar.bz2";
|
||||
sha256 = "0xvl3v7q1wr0a8li3f8d7hara58lcvrr6hmcd6cqkvcnhggkhp9s";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/pygit2-1.6.1-py38h294d835_0.tar.bz2";
|
||||
sha256 = "0frgv2b1ckgp8w574abliz369lbziyqsipkwxcjy4l9rbn2pa0rj";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2021.5.25-haa95532_1.tar.bz2";
|
||||
sha256 = "0g77ic1hs9gj9nknjgrn7byk63z82ima7gqynjcds1kbk8cy4hcd";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pip-21.1.3-py38haa95532_0.tar.bz2";
|
||||
sha256 = "1wzb3f3n1lndmxbr3agmx4rr1k11jf60fcrqmgr1d7a3ygqvqy4q";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-3.8.10-hdbf39b2_7.tar.bz2";
|
||||
sha256 = "05p2g1552crfmcf4a9wfjg4d1qngsvi1srpca2hqr6s9slip2w19";
|
||||
})
|
||||
]
|
|
@ -0,0 +1,182 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/ca-certificates-2021.10.26-haa95532_2.tar.bz2";
|
||||
sha256 = "14zdv6whd7cw298mkwpgkfydpz6zwhjq6gvxpw5s77m9b8jyi08w";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/jpeg-9d-h2bbff1b_0.tar.bz2";
|
||||
sha256 = "0jdwx9bl89byaqi73h0wr9hkjdi0ia47izgj602xfzc8ylhg0fxl";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/python_abi-3.9-2_cp39.tar.bz2";
|
||||
sha256 = "04d9pbqzck0330jv7mi8x4r1883sv421lwai2p9yamr2yl6xpan0";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/certifi-2021.10.8-py39haa95532_0.tar.bz2";
|
||||
sha256 = "032gmb2lyd0kwb7cr1j90fqyb44aar9jnki9jzjp6p65lbckc27l";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-3.9.7-h6244533_1.tar.bz2";
|
||||
sha256 = "1pgnrci071wbjdsarjrjssqvbk6nr2hbsvwdvzvf255f33264jj3";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pip-21.2.4-py39haa95532_0.tar.bz2";
|
||||
sha256 = "06a916f8fyjydy5rrrhvwjxn5jwr1w2b6dvhgpsa09bq4p1c2qid";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/regex-2021.8.3-py39h2bbff1b_0.tar.bz2";
|
||||
sha256 = "1p8kf8d2d3cb6z91fl2sjrn3mpaxb7pq1rc20705k1lqbjf9biga";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl-2021.4.0-haa95532_640.tar.bz2";
|
||||
sha256 = "115zmm4n769xl442qmv5h2ik5fyc1hb8cm1hc5a1vyb7bqwj2xrx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/setuptools-58.0.4-py39haa95532_0.tar.bz2";
|
||||
sha256 = "0avlsc1k3ms92panb24z5vas5gkfm9zxy0mh71pv7yqc466k2qc0";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/importlib-metadata-4.8.2-py39haa95532_0.tar.bz2";
|
||||
sha256 = "1fjr69ibknprp25742vzpbck6byrw84w2g3zxa5vqsyz7pyv27xb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/numba/win-64/llvmlite-0.38.0rc1-py39_0.tar.bz2";
|
||||
sha256 = "0xmd338r5vl9f456cvmmf4s1bz1jxc3yv58050xqgifpkrx3z3vr";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/hdf5-1.10.6-h7ebc959_0.tar.bz2";
|
||||
sha256 = "09bik65gspyrqj3j5p67wf2ywhgyfz3pkw39gwdzha7yyjkkzx0q";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/intel-openmp-2021.4.0-haa95532_3556.tar.bz2";
|
||||
sha256 = "19mmjvcm7f8nzyk7djjsd9lf6qx01f35wrvmragv1fhzsis3ddgf";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_random-1.2.2-py39hf11a4ad_0.tar.bz2";
|
||||
sha256 = "03h3857xvp5klhc24jn7lh0h7227qrk7q7ch768w27bx27g27js3";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-base-1.21.2-py39h0829f74_0.tar.bz2";
|
||||
sha256 = "1x97k4kdvdwh0aahrpzfaypsf7zvxkqwn0xw7cph2p9fzk7j88zw";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/pygit2-1.7.2-py39hb82d6ee_0.tar.bz2";
|
||||
sha256 = "1l56b7x1mrha9fs4j2zw4f2c199ab0yw1yggdivjyn40xll9x2sd";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/openssl-1.1.1l-h2bbff1b_0.tar.bz2";
|
||||
sha256 = "1w37wciivy4dqa1gvkwq23myv7sk7vr4davarvxc9hjl2is3r4dm";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/sip-4.19.13-py39hd77b12b_0.tar.bz2";
|
||||
sha256 = "1p2wgpzy1ccya314m53qjqnw2wns7wj4lxv3lkmddx940f12i76r";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/libssh2-1.10.0-h680486a_2.tar.bz2";
|
||||
sha256 = "1nnzz9hxgj63gs48flj6pxq6nqz9gkx54gwibyq502za1rbhbyw6";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-levenshtein-0.12.2-py39h2bbff1b_0.tar.bz2";
|
||||
sha256 = "1y5g9l07whv614qyafkzbph30zi9kypxfswdxh0gknsih8941j0k";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pyreadline-2.1-py39haa95532_1.tar.bz2";
|
||||
sha256 = "0581i2vp5b1dx7z9v4q41dd9ppj9bh9xgy0cnd7zd01zblafdbj5";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/h5py-3.6.0-py39h3de5c98_0.tar.bz2";
|
||||
sha256 = "0g6jw2c6qn4vzmn6k3yal8qxrdzcdzpx6grwq1mjxpamb11akni7";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/numba/win-64/icc_rt-2020.2-intel_254.tar.bz2";
|
||||
sha256 = "195km05did3n7zaljg7vwz11n8ibf935gk0m7dy07ngfk97s8w9f";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/lld-12.0.0-he71bc95_0.tar.bz2";
|
||||
sha256 = "0f6aw6d72w339jyqyjavnnsv35k2dc4pl79ymylczwf2my37rqpk";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl-service-2.4.0-py39h2bbff1b_0.tar.bz2";
|
||||
sha256 = "05sbxqipw9cp2c4p5imadk4hc9ds1d25hys5vamjp6pnl6435ipk";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pyqt-5.9.2-py39hd77b12b_6.tar.bz2";
|
||||
sha256 = "1v3qbmidh2h4vkzf5w8lisjc58z2714bbvaf0dg5m2k5vga4zh84";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/llvm-tools-12.0.0-h05d9aec_3.tar.bz2";
|
||||
sha256 = "0ly686hb730mvhw47xyz92dqchq46wkdaw1v2a6i0fzzdgf3ww9p";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libxml2-2.9.12-h0ad7f3c_0.tar.bz2";
|
||||
sha256 = "0gm1ajhiwdk23cc62nkayqqwqcccxwzj01dmypycx5d6cbh46l9y";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/wincertstore-0.2-py39haa95532_2.tar.bz2";
|
||||
sha256 = "0fvcgpmn13i9rxql4dvw8ybzj2vvck0fqsqk1qrgdl3zkh841f1z";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/libgit2-1.3.0-h8648793_1.tar.bz2";
|
||||
sha256 = "0gw71dk8a2b80822p44rarq5nqiww8g9braxvbxnwanam5wl5611";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/cffi-1.15.0-py39h2bbff1b_0.tar.bz2";
|
||||
sha256 = "1akbnswb1zigf1cx8im6s96rjmfryl4i20sg3xgaqy5papz926hf";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_fft-1.3.1-py39h277e83a_0.tar.bz2";
|
||||
sha256 = "0i2v4vzwklvwp1n003yyr2hgpb1gjsh05ibsc92w0c5angf0s4wp";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-1.21.2-py39hfca59bb_0.tar.bz2";
|
||||
sha256 = "1f10ka0vyx319z3f51zfxfcbwipa3vscw175c6i2qsb9ynlihqi7";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/scipy-1.7.1-py39hbe87c03_2.tar.bz2";
|
||||
sha256 = "131xc7qr5lrfnxdy8p09y6gghx0h7wbaif2kq4r1jmmmm8pksjm6";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libllvm12-12.0.0-h425c57c_3.tar.bz2";
|
||||
sha256 = "1k5396hvb4hbylcpnx4m7v7kggw9kn8j1w0v91lwzc3gv64q83l9";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/sqlite-3.36.0-h2bbff1b_0.tar.bz2";
|
||||
sha256 = "15w0lhcl97wafqvc6ccc96311wc5rrmh16i4ki1pw6kzkfmr1k6r";
|
||||
})
|
||||
]
|
|
@ -1,132 +0,0 @@
|
|||
{ pkgs } : [
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/regex-2020.5.14-py37he774522_0.tar.bz2";
|
||||
sha256 = "125l0ywc17h5hlpidjbr7dxyz9c24xmfjllj19dmvbx8hdlmvp99";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/python_abi-3.7-1_cp37m.tar.bz2";
|
||||
sha256 = "04dllvrvczky7p7d82iqj7czmy5mm8w7h2gg0zpjzx0s09gkq09l";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/icu-58.2-ha925a31_3.tar.bz2";
|
||||
sha256 = "0vcl0j3v9ab022s2g3a9iv1pn7sflh670yyf5m08hdyf049m3jz7";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pip-20.1.1-py37_1.tar.bz2";
|
||||
sha256 = "0wx0sdjq2kkdid4m0iss1bxjhpdk1lnrqsl3w7bqc0papz3gbx0a";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_fft-1.1.0-py37h45dec08_0.tar.bz2";
|
||||
sha256 = "1v73rd107x1r77gv77cn2bv50hr15c0rwspzf7pdp93i5ydk7fm0";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/tk-8.6.10-he774522_0.tar.bz2";
|
||||
sha256 = "15bfncacdxmcbn4xixmfz2m7a09k7hcpwxvwn1lki84bx0fmzsis";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/pygit2-1.2.1-py37h4ab8f01_0.tar.bz2";
|
||||
sha256 = "1rj6bmf56g3imcrhfd67nqfzd5jjpnmbck714p6aqljxjw5x1zja";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/certifi-2020.6.20-py37_0.tar.bz2";
|
||||
sha256 = "0601dwm5grhwnq7kvhz9sr49pw72ji8xbc28jc6z3pzihin243fy";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libssh2-1.9.0-h7a1dbc1_1.tar.bz2";
|
||||
sha256 = "0sz405ab3n7991hxy8l9affs1slivsimgadxsdr6wvpgx3j4aqgx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
|
||||
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/intel-openmp-2020.1-216.tar.bz2";
|
||||
sha256 = "097kkdpd27gc5v5fwsanbrpvmkqricbkd2igglz0yym0x2rldgb8";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/zlib-1.2.11-h62dcd97_4.tar.bz2";
|
||||
sha256 = "1jxd7sg0c278hqv09q6hridpdnyhkd34gbs92wkravj3gwsr1adk";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/pyqtgraph-0.10.0-py37h28b3542_3.tar.bz2";
|
||||
sha256 = "1vfxym7lpiv624ll82yp07v2906chdzvczjj9xbvfvk2sk0w1nk7";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-levenshtein-0.12.0-py37he774522_1001.tar.bz2";
|
||||
sha256 = "0wgk6wi4hcc1msv6467y8rhd3zpxrlb6dc0a4fg5wrvzww9wh4dx";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://conda.anaconda.org/conda-forge/win-64/libgit2-1.0.0-h79a9ecc_0.tar.bz2";
|
||||
sha256 = "1pi4hd4kah49wzy00iml5wpbscc0lx6ljk6lwnx92gas5z8856jd";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/setuptools-47.3.1-py37_0.tar.bz2";
|
||||
sha256 = "1lljknly57bh73h30hn6vv826dx4vls736psa9jvf0d6l2kqrzrq";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/libcurl-7.69.1-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "182zrmgl2142gfgnbgjsk0gbj85vw75xzxvhn9lzm485ghxsasvg";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl_random-1.1.1-py37h47e9c7a_0.tar.bz2";
|
||||
sha256 = "1f85bd7rrzdprgmk83v1klana32j016128fkxk8kpk7idfd36zqv";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/python-3.7.7-h81c818b_4.tar.bz2";
|
||||
sha256 = "092bv939n68yjkcm7q626nd6s5kqqvdrgjfqn1nadnqig612w2p9";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/curl-7.69.1-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "0hw5dh7gzx8fap4c3vkc2xc2q9by3f5ndbigr6pm6w5v29qaydn4";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/openssl-1.1.1g-he774522_0.tar.bz2";
|
||||
sha256 = "1gwfj33qb8inikdhmgcm30iz1ag8x71lzicsxbdr7ni4153df5gb";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/scipy-1.5.0-py37h9439919_0.tar.bz2";
|
||||
sha256 = "01pj0a82y9qd9z5fn5gv4argcc5g5s8kqj0lwjy9hj50qf6qwj76";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-1.18.5-py37h6530119_0.tar.bz2";
|
||||
sha256 = "1knb5na7ij7ik76blsgwhdsy3i9r2l0154z5g5dkb2ds3sk878np";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/sqlite-3.32.3-h2a8f88b_0.tar.bz2";
|
||||
sha256 = "1ddzwj0f6jikj6hsasg3vlwamsqhf5lc8k1la7gqbd77s11b8isc";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/numpy-base-1.18.5-py37hc3f5095_0.tar.bz2";
|
||||
sha256 = "1dyxk2v7rm87najv3f8i04q44wxicfx9qrap9dy2vpqlrz3bj82j";
|
||||
})
|
||||
|
||||
(pkgs.fetchurl {
|
||||
url = "https://repo.anaconda.com/pkgs/main/win-64/mkl-2020.1-216.tar.bz2";
|
||||
sha256 = "1klj0sjlj5x1anjbkf017f16ssc65dkpg1rrn06njirbhwsc9w5m";
|
||||
})
|
||||
]
|
|
@ -23,12 +23,12 @@ in
|
|||
isolateNetwork = false;
|
||||
script = ''
|
||||
cat > getcondapackages.bat << EOF
|
||||
date 06-22-20
|
||||
date 12-14-21
|
||||
call conda config --prepend channels https://conda.m-labs.hk/artiq-beta
|
||||
call conda config --append channels conda-forge
|
||||
call conda config --prepend channels numba
|
||||
call conda create -n artiq -y
|
||||
call conda install --dry-run --json -n artiq artiq > packages.json
|
||||
date 04-20-20
|
||||
EOF
|
||||
\${wfvm.utils.win-put}/bin/win-put getcondapackages.bat
|
||||
\${wfvm.utils.win-exec}/bin/win-exec '.\Anaconda3\Scripts\activate && getcondapackages'
|
||||
|
|
|
@ -10,26 +10,31 @@ let
|
|||
inherit port;
|
||||
}) tcpPorts;
|
||||
|
||||
wfvm = import ../wfvm.nix { inherit pkgs; };
|
||||
artiq6 = pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "6.0";
|
||||
artiq7 = pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "7.0";
|
||||
wfvm = import (if artiq6 then ../wfvm.nix else ../wfvm-legacy.nix) { inherit pkgs; };
|
||||
conda-deps = {
|
||||
name = "conda-deps";
|
||||
script = let
|
||||
artiq6 = pkgs.lib.strings.versionAtLeast artiqpkgs.artiq.version "6.0";
|
||||
qt-asyncio-package = if artiq6 then artiqpkgs.conda-qasync else artiqpkgs.conda-quamash;
|
||||
conda-deps-noarch = import (if artiq6 then ./conda_noarch_packages.nix else ./conda_noarch_packages-legacy.nix) { inherit pkgs; };
|
||||
conda-deps-win-64 = import (if artiq6 then ./conda_win-64_packages.nix else ./conda_win-64_packages-legacy.nix) { inherit pkgs; };
|
||||
conda-deps-noarch = import (if artiq7 then ./conda_noarch_packages-7.nix else if artiq6 then ./conda_noarch_packages-6.nix else ./conda_noarch_packages-5.nix) { inherit pkgs; };
|
||||
conda-deps-win-64 = import (if artiq7 then ./conda_win-64_packages-7.nix else if artiq6 then ./conda_win-64_packages-6.nix else ./conda_win-64_packages-5.nix) { inherit pkgs; };
|
||||
conda-packages-put = pkgs.lib.strings.concatStringsSep "\n"
|
||||
( (map (package: ''win-put ${package} 'fake-channel/noarch' '') conda-deps-noarch)
|
||||
++ (map (package: ''win-put ${package} 'fake-channel/win-64' '') conda-deps-win-64) );
|
||||
conda-packages-legacy-put = if artiq7 then "" else
|
||||
''
|
||||
win-put ${artiqpkgs.conda-windows-binutils-or1k}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
win-put ${artiqpkgs.conda-windows-llvm-or1k}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
win-put ${artiqpkgs.conda-windows-llvmlite-artiq}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
'';
|
||||
in
|
||||
''
|
||||
win-exec 'mkdir fake-channel && mkdir fake-channel\noarch && mkdir fake-channel\win-64'
|
||||
|
||||
${conda-packages-put}
|
||||
|
||||
win-put ${artiqpkgs.conda-windows-binutils-or1k}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
win-put ${artiqpkgs.conda-windows-llvm-or1k}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
win-put ${artiqpkgs.conda-windows-llvmlite-artiq}/win-64/*.tar.bz2 'fake-channel/win-64'
|
||||
${conda-packages-legacy-put}
|
||||
|
||||
win-put ${artiqpkgs.conda-pythonparser}/noarch/*.tar.bz2 'fake-channel/noarch'
|
||||
win-put ${artiqpkgs.conda-sipyco}/noarch/*.tar.bz2 'fake-channel/noarch'
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
{ pkgs ? import <nixpkgs> {}
|
||||
, a6p ? <a6p>
|
||||
{ pkgs ? import <nixpkgs> { overlays = [ (import ./artiq-fast/mozilla-overlay.nix) ]; }
|
||||
, use-generated ? <use-generated>
|
||||
}:
|
||||
|
||||
let
|
||||
sinaraSystemsRev = builtins.readFile <artiq-board-generated/sinara-rev.txt>;
|
||||
sinaraSystemsHash = builtins.readFile <artiq-board-generated/sinara-hash.txt>;
|
||||
sinaraSystemsSrc =
|
||||
if a6p
|
||||
if use-generated
|
||||
then pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems-legacy.git";
|
||||
rev = sinaraSystemsRev;
|
||||
sha256 = sinaraSystemsHash;
|
||||
}
|
||||
else <sinaraSystemsSrc>;
|
||||
artiq-fast =
|
||||
if a6p
|
||||
if use-generated
|
||||
then <artiq-board-generated/fast>
|
||||
else <artiq-fast>;
|
||||
artiqVersion = import (artiq-fast + "/pkgs/artiq-version.nix") {
|
||||
|
@ -47,7 +47,7 @@ let
|
|||
''
|
||||
mkdir $out
|
||||
|
||||
${if a6p
|
||||
${if use-generated
|
||||
then ''
|
||||
cp -a ${<artiq-board-generated>} $out/board-generated
|
||||
ln -s board-generated/fast $out/fast
|
||||
|
@ -59,7 +59,7 @@ let
|
|||
cp ${./artiq-full}/extras.nix $out
|
||||
cp ${./artiq-full}/*.patch $out
|
||||
|
||||
${if a6p
|
||||
${if use-generated
|
||||
then ''
|
||||
REV=${sinaraSystemsRev}
|
||||
HASH=${sinaraSystemsHash}
|
||||
|
@ -74,10 +74,10 @@ let
|
|||
HASH=`nix-hash --type sha256 --base32 $SINARA_SRC_CLEAN`
|
||||
''}
|
||||
cat > $out/default.nix << EOF
|
||||
{ pkgs ? import <nixpkgs> {}}:
|
||||
{ pkgs ? import <nixpkgs> { overlays = [ (import ./fast/mozilla-overlay.nix) ]; }}:
|
||||
|
||||
let
|
||||
artiq-fast = import ${if a6p then "./board-generated" else "."}/fast { inherit pkgs; };
|
||||
artiq-fast = import ${if use-generated then "./board-generated" else "."}/fast { inherit pkgs; };
|
||||
ddbDeps = [
|
||||
artiq-fast.artiq
|
||||
(pkgs.python3.withPackages (ps: [ ps.jsonschema ]))
|
||||
|
@ -90,11 +90,11 @@ let
|
|||
builtins.map (variant: "\"${variant}\"") standaloneVariants
|
||||
)}];
|
||||
|
||||
vivado = import ${if a6p then "./board-generated" else "."}/fast/vivado.nix {
|
||||
vivado = import ${if use-generated then "./board-generated" else "."}/fast/vivado.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
artiq-board =
|
||||
${if a6p
|
||||
${if use-generated
|
||||
then ''
|
||||
import ./artiq-board-vivado.nix {
|
||||
inherit pkgs vivado;
|
||||
|
@ -107,11 +107,12 @@ let
|
|||
else ''
|
||||
import ./fast/artiq-board.nix {
|
||||
inherit pkgs vivado;
|
||||
rustPlatform = import ./fast/rust-platform.nix { inherit pkgs; };
|
||||
}
|
||||
''};
|
||||
conda-artiq-board = import ./conda-artiq-board.nix { inherit pkgs; };
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
||||
url = "https://git.m-labs.hk/M-Labs/sinara-systems-legacy.git";
|
||||
rev = "$REV";
|
||||
sha256 = "$HASH";
|
||||
};
|
||||
|
@ -146,70 +147,9 @@ let
|
|||
};
|
||||
})
|
||||
) {} ${serializedTargets};
|
||||
drtio-systems = {
|
||||
${pkgs.lib.optionalString a6p ''
|
||||
berkeley3 = {
|
||||
master = "berkeley3master";
|
||||
satellites = {
|
||||
"1" = "berkeley3satellite";
|
||||
};
|
||||
};
|
||||
bonn1 = {
|
||||
master = "bonn1master";
|
||||
satellites = {
|
||||
"1" = "bonn1satellite";
|
||||
};
|
||||
};
|
||||
hw2 = {
|
||||
master = "hw2master";
|
||||
satellites = {
|
||||
"1" = "hw2satellite";
|
||||
};
|
||||
};
|
||||
ptb3 = {
|
||||
master = "ptb3master";
|
||||
satellites = {
|
||||
"1" = "ptb3satellite";
|
||||
};
|
||||
};
|
||||
purdue = {
|
||||
master = "purduemaster";
|
||||
satellites = {
|
||||
"1" = "purduesatellite";
|
||||
};
|
||||
};
|
||||
stfc = {
|
||||
master = "stfcmaster";
|
||||
satellites = {
|
||||
"1" = "stfcsatellite";
|
||||
};
|
||||
};
|
||||
wipm7 = {
|
||||
master = "wipm7master";
|
||||
satellites = {
|
||||
"1" = "wipm7satellite";
|
||||
};
|
||||
};
|
||||
''}
|
||||
};
|
||||
drtio-ddbs = pkgs.lib.attrsets.mapAttrs'
|
||||
(system: crates: pkgs.lib.attrsets.nameValuePair ("device-db-" + system)
|
||||
(pkgs.stdenv.mkDerivation {
|
||||
name = "device-db-\''${system}";
|
||||
buildInputs = ddbDeps;
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase = "
|
||||
mkdir \$out
|
||||
artiq_ddb_template \
|
||||
\''${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + (src + "/\''${desc}.json")) crates.satellites) } \
|
||||
\''${src}/\''${crates.master}.json -o \$out/device_db.py
|
||||
mkdir \$out/nix-support
|
||||
echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
|
||||
";
|
||||
})) drtio-systems;
|
||||
extras = import ./extras.nix { inherit pkgs; inherit (artiq-fast) sipyco asyncserial artiq; };
|
||||
in
|
||||
artiq-fast // artiq-targets // drtio-ddbs // extras // rec {
|
||||
artiq-fast // artiq-targets // extras // rec {
|
||||
conda-artiq-board-kasli-tester = conda-artiq-board {
|
||||
target = "kasli";
|
||||
variant = "tester";
|
||||
|
|
|
@ -37,16 +37,6 @@ let
|
|||
);
|
||||
in
|
||||
kasli // {
|
||||
artiq-board-sayma-rtm = {
|
||||
target = "sayma";
|
||||
variant = "rtm";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_rtm";
|
||||
};
|
||||
artiq-board-sayma-satellite = {
|
||||
target = "sayma";
|
||||
variant = "satellite";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_amc";
|
||||
};
|
||||
artiq-board-metlino-master = {
|
||||
target = "metlino";
|
||||
variant = "master";
|
||||
|
@ -56,10 +46,21 @@ kasli // {
|
|||
target = "kc705";
|
||||
variant = "nist_qc2";
|
||||
};
|
||||
} // (pkgs.lib.optionalAttrs (pkgs.lib.strings.versionAtLeast artiqVersion "6.0") {
|
||||
artiq-board-sayma-satellite-st = {
|
||||
target = "sayma";
|
||||
variant = "satellite";
|
||||
buildCommand = "python -m artiq.gateware.targets.sayma_amc --jdcg-type syncdds";
|
||||
} // (pkgs.lib.optionalAttrs (pkgs.lib.strings.versionAtLeast artiqVersion "7.0") {
|
||||
artiq-board-kc705-nist_clock_master = {
|
||||
target = "kc705";
|
||||
variant = "nist_clock_master";
|
||||
};
|
||||
artiq-board-kc705-nist_qc2_master = {
|
||||
target = "kc705";
|
||||
variant = "nist_qc2_master";
|
||||
};
|
||||
artiq-board-kc705-nist_clock_satellite = {
|
||||
target = "kc705";
|
||||
variant = "nist_clock_satellite";
|
||||
};
|
||||
artiq-board-kc705-nist_qc2_satellite = {
|
||||
target = "kc705";
|
||||
variant = "nist_qc2_satellite";
|
||||
};
|
||||
})
|
||||
|
|
|
@ -15,12 +15,12 @@ in
|
|||
artiq-full.novatech409b
|
||||
artiq-full.thorlabs_tcube
|
||||
artiq-full.artiq-board-kc705-nist_clock
|
||||
artiq-full.artiq-board-kasli-oregon
|
||||
ps.paramiko
|
||||
ps.pandas
|
||||
ps.numpy
|
||||
ps.scipy
|
||||
ps.numba
|
||||
# our newer llvmlite conflicts with the one in nixpkgs (21.05), reenable after nixpkgs updates llvmlite
|
||||
#ps.numba
|
||||
ps.bokeh
|
||||
matplotlib-qt
|
||||
# cirq is broken and doesn't build (as of 20.09.3281.06b11191834)
|
||||
|
@ -31,7 +31,7 @@ in
|
|||
|
||||
artiq-full.openocd
|
||||
pkgs.gtkwave
|
||||
#pkgs.spyder # broken on 20.03
|
||||
pkgs.spyder
|
||||
pkgs.R
|
||||
];
|
||||
} "touch $out";
|
||||
|
|
|
@ -3,8 +3,8 @@ let
|
|||
condaBuild = import ./fast/conda/build.nix { inherit pkgs; };
|
||||
condaFakeSource = import ./fast/conda/fake-source.nix { inherit pkgs; };
|
||||
dualPackage = (
|
||||
{ name, version, src, pythonOptions ? {}, condaOptions ? {}, withManual ? true}:
|
||||
{
|
||||
{ name, version, src, pythonOptions ? {}, condaOptions ? {}, enabled ? true, withManual ? true}:
|
||||
pkgs.lib.optionalAttrs enabled ({
|
||||
"${name}" = pkgs.python3Packages.buildPythonPackage ({
|
||||
inherit version;
|
||||
name = "${name}-${version}";
|
||||
|
@ -38,7 +38,7 @@ let
|
|||
echo doc manual ${dest}/html index.html >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
};
|
||||
})
|
||||
}))
|
||||
);
|
||||
# https://github.com/m-labs/artiq/issues/23
|
||||
hidapi = pkgs.hidapi.overrideAttrs (oa: {
|
||||
|
@ -231,18 +231,45 @@ in
|
|||
withManual = false;
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gitlab.com/duke-artiq/flake8-artiq.git";
|
||||
rev = "3d011bdadc41bb5d4b7e536fbfdb3744d9d9a6de";
|
||||
sha256 = "1i6vk2j97fr1fnm6lzi5n33l6ldvcyfjgfxgr59pcpbz6xhbbgp2";
|
||||
rev = "1216092974140a561850905734fc22fdacdc2cde";
|
||||
sha256 = "0rkab2qdwyzms6nxc44jzb5grvkkbpjwwmfv2zj96cm6cm8d9pdr";
|
||||
};
|
||||
pythonOptions = {
|
||||
propagatedBuildInputs = [ pkgs.python3Packages.flake8 ];
|
||||
checkInputs = [ pkgs.python3Packages.pytest pkgs.python3Packages.mypy pkgs.python3Packages.flake8 ];
|
||||
checkPhase =
|
||||
''
|
||||
pytest
|
||||
mypy
|
||||
flake8
|
||||
'';
|
||||
checkInputs = [ pkgs.python3Packages.pytestCheckHook ];
|
||||
};
|
||||
condaOptions = { dependencies = [ "flake8" ]; };
|
||||
}) // (dualPackage rec {
|
||||
name = "dax";
|
||||
version = "6.7";
|
||||
enabled = builtins.head (builtins.splitVersion version) == builtins.head (builtins.splitVersion artiq.version);
|
||||
withManual = false;
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gitlab.com/duke-artiq/dax.git";
|
||||
rev = "v${version}";
|
||||
sha256 = "0rgvqqiypqvxjzrsixn3h7dn93isqw5vc2wrmpkxhzvw9lh5ihm7";
|
||||
};
|
||||
pythonOptions = {
|
||||
VERSIONEER_OVERRIDE = version;
|
||||
inherit (pkgs.python3Packages.pygit2) SSL_CERT_FILE;
|
||||
propagatedBuildInputs = [ artiq sipyco ]
|
||||
++ (with pkgs.python3Packages; [ numpy scipy pyvcd natsort pygit2 matplotlib graphviz h5py networkx sortedcontainers ]);
|
||||
checkInputs = [ pkgs.python3Packages.pytestCheckHook ];
|
||||
};
|
||||
condaOptions = { dependencies = [ "python>=3.7" "artiq" "sipyco" "numpy" "scipy" "pyvcd" "natsort" "pygit2" "matplotlib" "python-graphviz" "h5py" "networkx" "sortedcontainers" ]; };
|
||||
}) // (dualPackage {
|
||||
name = "dax-applets";
|
||||
version = "0.0.0";
|
||||
withManual = false;
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gitlab.com/duke-artiq/dax-applets.git";
|
||||
rev = "0f0196b6941b0c44a33c85d8c02047ca65466463";
|
||||
sha256 = "0mx6yjvprhdnkdigwns8mg6v5daqxpgbv7mf63fa76i1iv2wvak4";
|
||||
};
|
||||
pythonOptions = {
|
||||
propagatedBuildInputs = [ artiq ]
|
||||
++ (with pkgs.python3Packages; [ numpy pyqt5 pyqtgraph ]);
|
||||
doCheck = false;
|
||||
};
|
||||
condaOptions = { dependencies = [ "python>=3.5" "artiq" "numpy" "pyqt" "pyqtgraph" ]; };
|
||||
})
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> { overlays = [ (import ./artiq-fast/mozilla-overlay.nix) ]; };
|
||||
artiq-zynq = import <artiq-zynq>;
|
||||
artiq-fast = import <artiq-fast> { inherit pkgs; };
|
||||
in
|
||||
(
|
||||
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiq-zynq
|
||||
) // {
|
||||
gateware-sim = pkgs.lib.hydraJob (pkgs.stdenv.mkDerivation {
|
||||
name = "gateware-sim";
|
||||
buildInputs = [ artiq-fast.migen artiq-fast.migen-axi artiq-fast.artiq ];
|
||||
|
||||
phases = [ "buildPhase" ];
|
||||
|
||||
buildPhase =
|
||||
''
|
||||
python -m unittest discover ${<artiq-zynq>}/src/gateware -v
|
||||
touch $out
|
||||
'';
|
||||
});
|
||||
zc706-hitl-tests = pkgs.lib.hydraJob (pkgs.stdenv.mkDerivation {
|
||||
name = "zc706-hitl-tests";
|
||||
|
||||
__networked = true; # compatibility with old patched Nix
|
||||
# breaks hydra, https://github.com/NixOS/hydra/issues/1216
|
||||
#__impure = true; # Nix 2.8+
|
||||
|
||||
buildInputs = [
|
||||
pkgs.netcat pkgs.openssh pkgs.rsync artiq-fast.artiq artiq-fast.artiq-netboot
|
||||
];
|
||||
phases = [ "buildPhase" ];
|
||||
|
||||
buildPhase =
|
||||
''
|
||||
export NIX_SSHOPTS="-F /dev/null -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -i /opt/hydra_id_ed25519"
|
||||
LOCKCTL=$(mktemp -d)
|
||||
mkfifo $LOCKCTL/lockctl
|
||||
|
||||
cat $LOCKCTL/lockctl | ${pkgs.openssh}/bin/ssh \
|
||||
$NIX_SSHOPTS \
|
||||
rpi-4 \
|
||||
'mkdir -p /tmp/board_lock && flock /tmp/board_lock/zc706-1 -c "echo Ok; cat"' \
|
||||
| (
|
||||
# End remote flock via FIFO
|
||||
atexit_unlock() {
|
||||
echo > $LOCKCTL/lockctl
|
||||
}
|
||||
trap atexit_unlock EXIT
|
||||
|
||||
# Read "Ok" line when remote successfully locked
|
||||
read LOCK_OK
|
||||
|
||||
echo Power cycling board...
|
||||
(echo b; sleep 5; echo B; sleep 5) | nc -N -w6 192.168.1.31 3131
|
||||
echo Power cycle done.
|
||||
|
||||
export USER=hydra
|
||||
export OPENOCD_ZYNQ=${artiq-zynq.zynq-rs}/openocd
|
||||
export SZL=${(import artiq-zynq.zynq-rs).zc706-szl}/szl.elf
|
||||
pushd ${<artiq-zynq>}
|
||||
bash ${<artiq-zynq>}/remote_run.sh -h rpi-4 -o "$NIX_SSHOPTS" -d ${artiq-zynq.zc706-nist_qc2-jtag}
|
||||
popd
|
||||
|
||||
echo Waiting for the firmware to boot...
|
||||
sleep 15
|
||||
|
||||
echo Running test kernel...
|
||||
artiq_run --device-db ${<artiq-zynq>}/examples/device_db.py ${<artiq-zynq>}/examples/mandelbrot.py
|
||||
|
||||
echo Running ARTIQ unit tests...
|
||||
export ARTIQ_ROOT=${<artiq-zynq>}/examples
|
||||
export ARTIQ_LOW_LATENCY=1
|
||||
python -m unittest discover artiq.test.coredevice -v
|
||||
|
||||
touch $out
|
||||
|
||||
echo Completed
|
||||
|
||||
(echo b; sleep 5) | nc -N -w6 192.168.1.31 3131
|
||||
echo Board powered off
|
||||
)
|
||||
'';
|
||||
});
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
artiqpkgs = import ../artiq-fast/pkgs/python-deps.nix { inherit (pkgs) stdenv fetchgit fetchFromGitHub python3Packages; misoc-new = true; };
|
||||
artiqpkgs = import ../artiq-fast/pkgs/python-deps.nix { inherit (pkgs) lib fetchgit fetchFromGitHub python3Packages; misoc-new = true; };
|
||||
ise = import ./ise.nix { inherit pkgs; };
|
||||
vivado = import ../artiq-fast/vivado.nix { inherit pkgs; };
|
||||
buildUrukulCpld = {version, src}: pkgs.stdenv.mkDerivation {
|
||||
|
|
241
hydra/artiq.json
241
hydra/artiq.json
|
@ -1,110 +1,101 @@
|
|||
{
|
||||
"fast-beta": {
|
||||
"main-nac3": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Core ARTIQ packages to build fast for CI purposes (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-fast.nix",
|
||||
"description": "Main ARTIQ packages (with NAC3)",
|
||||
"flake": "git+https://github.com/m-labs/artiq.git?ref=nac3",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git master 1", "emailresponsible": false }
|
||||
}
|
||||
"keepnr": 50
|
||||
},
|
||||
"board-generated-beta": {
|
||||
"nac3": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Generated code for ARTIQ boards (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-board-generated",
|
||||
"checkinterval": 14400,
|
||||
"schedulingshares": 1,
|
||||
"description": "Third generation ARTIQ compiler",
|
||||
"flake": "git+https://git.m-labs.hk/M-Labs/nac3.git",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-beta:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"full-beta": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Full set of ARTIQ packages (beta version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-full.nix",
|
||||
"checkinterval": 86400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"a6p": { "type": "boolean", "value": "true" },
|
||||
"artiq-board-generated": { "type": "sysbuild", "value": "artiq:board-generated-beta:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
"keepnr": 50
|
||||
},
|
||||
|
||||
"fast": {
|
||||
"main-beta": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Core ARTIQ packages to build fast for CI purposes",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-fast.nix",
|
||||
"description": "Main ARTIQ packages (beta version)",
|
||||
"flake": "git+https://github.com/m-labs/artiq.git",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git release-6 1", "emailresponsible": false }
|
||||
}
|
||||
"keepnr": 50
|
||||
},
|
||||
"board-generated": {
|
||||
"extra-beta": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Generated code for ARTIQ boards",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-board-generated",
|
||||
"checkinterval": 14400,
|
||||
"schedulingshares": 1,
|
||||
"description": "Additional ARTIQ packages (beta version)",
|
||||
"flake": "git+https://git.m-labs.hk/m-labs/artiq-extrapkg.git",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
"keepnr": 50
|
||||
},
|
||||
"full": {
|
||||
"zynq-beta": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Full set of ARTIQ packages",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-full.nix",
|
||||
"checkinterval": 86400,
|
||||
"schedulingshares": 1,
|
||||
"description": "ARTIQ on Zynq-7000 (beta version)",
|
||||
"flake": "git+https://git.m-labs.hk/m-labs/artiq-zynq.git",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"a6p": { "type": "boolean", "value": "true" },
|
||||
"artiq-board-generated": { "type": "sysbuild", "value": "artiq:board-generated:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
"keepnr": 50
|
||||
},
|
||||
|
||||
"main": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Main ARTIQ packages (stable version)",
|
||||
"flake": "git+https://github.com/m-labs/artiq.git?ref=release-7",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 50
|
||||
},
|
||||
"extra": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Additional ARTIQ packages (stable version)",
|
||||
"flake": "git+https://git.m-labs.hk/m-labs/artiq-extrapkg.git?ref=release-7",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 50
|
||||
},
|
||||
"zynq": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "ARTIQ on Zynq-7000 (stable version)",
|
||||
"flake": "git+https://git.m-labs.hk/m-labs/artiq-zynq.git?ref=release-7",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 50
|
||||
},
|
||||
|
||||
"fast-legacy": {
|
||||
|
@ -117,11 +108,29 @@
|
|||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"keepnr": 50,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.03", "emailresponsible": false },
|
||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-21.05", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"artiqSrc": { "type": "git", "value": "git://github.com/m-labs/artiq.git release-5 1", "emailresponsible": false }
|
||||
"artiqSrc": { "type": "git", "value": "https://github.com/m-labs/artiq.git release-6 1", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"board-generated-legacy": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "Generated code for ARTIQ boards (legacy version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-board-generated",
|
||||
"checkinterval": 14400,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 50,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-21.05", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems-legacy.git master 1", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-legacy:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"full-legacy": {
|
||||
|
@ -134,13 +143,30 @@
|
|||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"keepnr": 50,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.03", "emailresponsible": false },
|
||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-21.05", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false },
|
||||
"a6p": { "type": "boolean", "value": "false" },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-legacy:generated-nix", "emailresponsible": false }
|
||||
"use-generated": { "type": "boolean", "value": "true" },
|
||||
"artiq-board-generated": { "type": "sysbuild", "value": "artiq:board-generated-legacy:generated-nix", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"zynq-legacy": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "ARTIQ on Zynq-7000 (legacy version)",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "artiq-zynq.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 50,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-21.05", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast-legacy:generated-nix", "emailresponsible": false },
|
||||
"artiq-zynq": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/artiq-zynq.git release-6", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -154,34 +180,39 @@
|
|||
"schedulingshares": 1,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"keepnr": 50,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-21.05", "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 },
|
||||
"mirnySrc": { "type": "git", "value": "git://github.com/quartiq/mirny", "emailresponsible": false },
|
||||
"fastinoSrc": { "type": "git", "value": "git://github.com/quartiq/fastino", "emailresponsible": false },
|
||||
"phaserSrc": { "type": "git", "value": "git://github.com/quartiq/phaser", "emailresponsible": false }
|
||||
"urukulSrc": { "type": "git", "value": "https://github.com/quartiq/urukul.git", "emailresponsible": false },
|
||||
"mirnySrc": { "type": "git", "value": "https://github.com/quartiq/mirny.git", "emailresponsible": false },
|
||||
"fastinoSrc": { "type": "git", "value": "https://github.com/quartiq/fastino.git", "emailresponsible": false },
|
||||
"phaserSrc": { "type": "git", "value": "https://github.com/quartiq/phaser.git", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
|
||||
"zynq": {
|
||||
"sipyco": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "ARTIQ on Zynq",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "zynq.nix",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 1,
|
||||
"description": "Simple Python Communications",
|
||||
"flake": "github:m-labs/sipyco",
|
||||
"checkinterval": 600,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"artiq-fast": { "type": "sysbuild", "value": "artiq:fast:generated-nix", "emailresponsible": false },
|
||||
"zynq-rs": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/zynq-rs.git", "emailresponsible": false },
|
||||
"artiq-zynq": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/artiq-zynq.git", "emailresponsible": false }
|
||||
}
|
||||
"keepnr": 50
|
||||
},
|
||||
"zynq-rs": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Bare-metal Rust on Zynq-7000",
|
||||
"flake": "git+https://git.m-labs.hk/m-labs/zynq-rs.git",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 50
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,45 @@
|
|||
{
|
||||
"mcu": {
|
||||
"mcu-contrib": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "MCU firmware",
|
||||
"description": "Third-party MCU firmware",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "mcu.nix",
|
||||
"checkinterval": 300,
|
||||
"nixexprpath": "mcu-contrib.nix",
|
||||
"checkinterval": 7200,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.09", "emailresponsible": false },
|
||||
"mozillaOverlay": { "type": "git", "value": "git://github.com/mozilla/nixpkgs-mozilla.git", "emailresponsible": false },
|
||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-23.11", "emailresponsible": false },
|
||||
"mozillaOverlay": { "type": "git", "value": "https://github.com/mozilla/nixpkgs-mozilla.git", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"stabilizerSrc": { "type": "git", "value": "git://github.com/quartiq/stabilizer.git", "emailresponsible": false },
|
||||
"thermostatSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/thermostat.git", "emailresponsible": false },
|
||||
"humpbackDdsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/humpback-dds.git", "emailresponsible": false },
|
||||
"saymaMmcSrc": { "type": "git", "value": "git://github.com/sinara-hw/openMMC sayma-devel", "emailresponsible": false }
|
||||
"stabilizerSrc": { "type": "git", "value": "https://github.com/quartiq/stabilizer.git", "emailresponsible": false },
|
||||
"saymaMmcSrc": { "type": "git", "value": "https://github.com/sinara-hw/openMMC.git sayma-devel", "emailresponsible": false }
|
||||
}
|
||||
},
|
||||
"thermostat": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Firmware for the Sinara 8451 Thermostat",
|
||||
"flake": "git+https://git.m-labs.hk/M-Labs/thermostat.git",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10
|
||||
},
|
||||
"humpback-dds": {
|
||||
"enabled": 1,
|
||||
"type": 1,
|
||||
"hidden": false,
|
||||
"description": "Firmware for Humpback-DDS",
|
||||
"flake": "git+https://git.m-labs.hk/M-Labs/humpback-dds.git",
|
||||
"checkinterval": 300,
|
||||
"schedulingshares": 10,
|
||||
"enableemail": false,
|
||||
"emailoverride": "",
|
||||
"keepnr": 10
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"web": {
|
||||
"enabled": 1,
|
||||
"hidden": false,
|
||||
"description": "M-Labs website",
|
||||
"description": "Websites",
|
||||
"nixexprinput": "nixScripts",
|
||||
"nixexprpath": "web.nix",
|
||||
"checkinterval": 300,
|
||||
|
@ -11,9 +11,10 @@
|
|||
"emailoverride": "",
|
||||
"keepnr": 10,
|
||||
"inputs": {
|
||||
"nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs nixos-20.03", "emailresponsible": false },
|
||||
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-23.11", "emailresponsible": false },
|
||||
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
|
||||
"webSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/web2019.git", "emailresponsible": false }
|
||||
"webSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/web2019.git", "emailresponsible": false },
|
||||
"nmigenSrc": { "type": "git", "value": "https://gitlab.com/nmigen/nmigen.git", "emailresponsible": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
let
|
||||
jobs = import ./mcu/default.nix {
|
||||
jobs = import ./mcu-contrib/default.nix {
|
||||
mozillaOverlay = import <mozillaOverlay>;
|
||||
};
|
||||
in
|
|
@ -0,0 +1,104 @@
|
|||
{ # Use master branch of the overlay by default
|
||||
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
|
||||
}:
|
||||
|
||||
let
|
||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
||||
targets = [
|
||||
"thumbv7em-none-eabihf"
|
||||
];
|
||||
rustManifest = pkgs.fetchurl {
|
||||
url = "https://static.rust-lang.org/dist/2022-11-03/channel-rust-stable.toml";
|
||||
sha256 = "sha256-DzNEaW724O8/B8844tt5AVHmSjSQ3cmzlU4BP90oRlY=";
|
||||
};
|
||||
rustChannelOfTargets = _channel: _date: targets:
|
||||
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
||||
inherit (pkgs) stdenv lib fetchurl patchelf;
|
||||
}).rust.override {
|
||||
inherit targets;
|
||||
extensions = ["rust-src"];
|
||||
};
|
||||
rust = rustChannelOfTargets "nightly" null targets;
|
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
});
|
||||
|
||||
buildStm32Firmware = { name, src, cargoDepsName ? name, patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", doCheck ? true, binaryName ? name, extraCargoBuildArgs ? "", outputHashes ? {} }:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
inherit name cargoDepsName;
|
||||
version = "0.0.0";
|
||||
|
||||
inherit src;
|
||||
|
||||
cargoLock = {lockFile = "${src}/Cargo.lock"; inherit outputHashes; };
|
||||
|
||||
inherit patchPhase;
|
||||
nativeBuildInputs = [ pkgs.llvm ] ++ extraNativeBuildInputs;
|
||||
buildPhase = ''
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
cargo build --release --bin ${binaryName} ${extraCargoBuildArgs}
|
||||
'';
|
||||
|
||||
inherit checkPhase doCheck;
|
||||
# binaryName defaults to the `name` arg (i.e. the Rust package name);
|
||||
# it is used as the Cargo binary filename
|
||||
installPhase = ''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp target/thumbv7em-none-eabihf/release/${binaryName} $out/${name}.elf
|
||||
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
|
||||
llvm-objcopy -O binary target/thumbv7em-none-eabihf/release/${binaryName} $out/${name}.bin
|
||||
echo file binary-dist $out/${name}.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
auditable = false;
|
||||
};
|
||||
in
|
||||
pkgs.lib.attrsets.mapAttrs'
|
||||
(name: value: pkgs.lib.attrsets.nameValuePair ("stabilizer-" + name)
|
||||
(buildStm32Firmware ({
|
||||
name = "stabilizer-" + name;
|
||||
# If binaryName is not specified, use the attribute name as binaryName by default.
|
||||
binaryName = name;
|
||||
cargoDepsName = "stabilizer";
|
||||
src = <stabilizerSrc>;
|
||||
patchPhase = ''
|
||||
patch -p1 < ${./pounder-725.diff}
|
||||
substituteInPlace src/net/mod.rs \
|
||||
--replace "[10, 34, 16, 10];" \
|
||||
"[192, 168, 1, 10];" # or other default MQTT broker address
|
||||
'';
|
||||
doCheck = false;
|
||||
} // value))) {
|
||||
dual-iir = {};
|
||||
dual-iir-pounder_v1_0 = {
|
||||
binaryName = "dual-iir";
|
||||
extraCargoBuildArgs = "--features pounder_v1_0";
|
||||
};
|
||||
lockin = {};
|
||||
} //
|
||||
{
|
||||
# openMMC build system breaks if host compiler is not available, so do not use stdenvNoCC here
|
||||
sayma-mmc = pkgs.stdenv.mkDerivation {
|
||||
name = "sayma-mmc";
|
||||
src = <saymaMmcSrc>;
|
||||
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
|
||||
nativeBuildInputs = [ pkgs.cmake pkgs.gcc-arm-embedded ];
|
||||
buildPhase =
|
||||
''
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DBOARD=sayma -DBOARD_RTM=sayma -DVERSION= -DTARGET_CONTROLLER=LPC1776 -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
mkdir $out
|
||||
cp out/* $out
|
||||
mkdir -p $out $out/nix-support
|
||||
echo file binary-dist $out/openMMC.axf >> $out/nix-support/hydra-build-products
|
||||
echo file binary-dist $out/openMMC.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -0,0 +1,819 @@
|
|||
diff --git a/ad9959/src/lib.rs b/ad9959/src/lib.rs
|
||||
index b15f2a5bd..4e83bcb2f 100644
|
||||
--- a/ad9959/src/lib.rs
|
||||
+++ b/ad9959/src/lib.rs
|
||||
@@ -2,8 +2,24 @@
|
||||
|
||||
use bit_field::BitField;
|
||||
use bitflags::bitflags;
|
||||
+use core::ops::Range;
|
||||
use embedded_hal::{blocking::delay::DelayUs, digital::v2::OutputPin};
|
||||
|
||||
+/// The minimum reference clock input frequency with REFCLK multiplier disabled.
|
||||
+const MIN_REFCLK_FREQUENCY: f32 = 1e6;
|
||||
+/// The minimum reference clock input frequency with REFCLK multiplier enabled.
|
||||
+const MIN_MULTIPLIED_REFCLK_FREQUENCY: f32 = 10e6;
|
||||
+/// The system clock frequency range with high gain configured for the internal VCO.
|
||||
+const HIGH_GAIN_VCO_RANGE: Range<f32> = Range {
|
||||
+ start: 255e6,
|
||||
+ end: 500e6,
|
||||
+};
|
||||
+/// The system clock frequency range with low gain configured for the internal VCO.
|
||||
+const LOW_GAIN_VCO_RANGE: Range<f32> = Range {
|
||||
+ start: 100e6,
|
||||
+ end: 160e6,
|
||||
+};
|
||||
+
|
||||
/// A device driver for the AD9959 direct digital synthesis (DDS) chip.
|
||||
///
|
||||
/// This chip provides four independently controllable digital-to-analog output sinusoids with
|
||||
@@ -216,23 +232,17 @@ impl<I: Interface> Ad9959<I> {
|
||||
reference_clock_frequency: f32,
|
||||
multiplier: u8,
|
||||
) -> Result<f32, Error> {
|
||||
+ let frequency =
|
||||
+ validate_clocking(reference_clock_frequency, multiplier)?;
|
||||
self.reference_clock_frequency = reference_clock_frequency;
|
||||
|
||||
- if multiplier != 1 && !(4..=20).contains(&multiplier) {
|
||||
- return Err(Error::Bounds);
|
||||
- }
|
||||
-
|
||||
- let frequency = multiplier as f32 * self.reference_clock_frequency;
|
||||
- if frequency > 500_000_000.0f32 {
|
||||
- return Err(Error::Frequency);
|
||||
- }
|
||||
-
|
||||
// TODO: Update / disable any enabled channels?
|
||||
let mut fr1: [u8; 3] = [0, 0, 0];
|
||||
self.read(Register::FR1, &mut fr1)?;
|
||||
fr1[0].set_bits(2..=6, multiplier);
|
||||
|
||||
- let vco_range = frequency > 255e6;
|
||||
+ let vco_range = HIGH_GAIN_VCO_RANGE.contains(&frequency)
|
||||
+ || frequency == HIGH_GAIN_VCO_RANGE.end;
|
||||
fr1[0].set_bit(7, vco_range);
|
||||
|
||||
self.write(Register::FR1, &fr1)?;
|
||||
@@ -363,9 +373,7 @@ impl<I: Interface> Ad9959<I> {
|
||||
channel: Channel,
|
||||
phase_turns: f32,
|
||||
) -> Result<f32, Error> {
|
||||
- let phase_offset: u16 =
|
||||
- (phase_turns * (1 << 14) as f32) as u16 & 0x3FFFu16;
|
||||
-
|
||||
+ let phase_offset = phase_to_pow(phase_turns)?;
|
||||
self.modify_channel(
|
||||
channel,
|
||||
Register::CPOW0,
|
||||
@@ -511,6 +519,108 @@ impl<I: Interface> Ad9959<I> {
|
||||
}
|
||||
}
|
||||
|
||||
+/// Validate the internal system clock configuration of the chip.
|
||||
+///
|
||||
+/// Arguments:
|
||||
+/// * `reference_clock_frequency` - The reference clock frequency provided to the AD9959 core.
|
||||
+/// * `multiplier` - The frequency multiplier of the system clock. Must be 1 or 4-20.
|
||||
+///
|
||||
+/// Returns:
|
||||
+/// The system clock frequency to be configured.
|
||||
+pub fn validate_clocking(
|
||||
+ reference_clock_frequency: f32,
|
||||
+ multiplier: u8,
|
||||
+) -> Result<f32, Error> {
|
||||
+ // The REFCLK frequency must be at least 1 MHz with REFCLK multiplier disabled.
|
||||
+ if reference_clock_frequency < MIN_REFCLK_FREQUENCY {
|
||||
+ return Err(Error::Bounds);
|
||||
+ }
|
||||
+ // If the REFCLK multiplier is enabled, the multiplier (FR1[22:18]) must be between 4 to 20.
|
||||
+ // Alternatively, the clock multiplier can be disabled. The multiplication factor is 1.
|
||||
+ if multiplier != 1 && !(4..=20).contains(&multiplier) {
|
||||
+ return Err(Error::Bounds);
|
||||
+ }
|
||||
+ // If the REFCLK multiplier is enabled, the REFCLK frequency must be at least 10 MHz.
|
||||
+ if multiplier != 1
|
||||
+ && reference_clock_frequency < MIN_MULTIPLIED_REFCLK_FREQUENCY
|
||||
+ {
|
||||
+ return Err(Error::Bounds);
|
||||
+ }
|
||||
+ let frequency = multiplier as f32 * reference_clock_frequency;
|
||||
+ // SYSCLK frequency between 255 MHz and 500 MHz (inclusive) is valid with high range VCO
|
||||
+ if HIGH_GAIN_VCO_RANGE.contains(&frequency)
|
||||
+ || frequency == HIGH_GAIN_VCO_RANGE.end
|
||||
+ {
|
||||
+ return Ok(frequency);
|
||||
+ }
|
||||
+
|
||||
+ // SYSCLK frequency between 100 MHz and 160 MHz (inclusive) is valid with low range VCO
|
||||
+ if LOW_GAIN_VCO_RANGE.contains(&frequency)
|
||||
+ || frequency == LOW_GAIN_VCO_RANGE.end
|
||||
+ {
|
||||
+ return Ok(frequency);
|
||||
+ }
|
||||
+
|
||||
+ // When the REFCLK multiplier is disabled, SYSCLK frequency can go below 100 MHz
|
||||
+ if multiplier == 1 && (0.0..=LOW_GAIN_VCO_RANGE.start).contains(&frequency)
|
||||
+ {
|
||||
+ return Ok(frequency);
|
||||
+ }
|
||||
+
|
||||
+ Err(Error::Frequency)
|
||||
+}
|
||||
+
|
||||
+/// Convert and validate frequency into frequency tuning word.
|
||||
+///
|
||||
+/// Arguments:
|
||||
+/// * `dds_frequency` - The DDS frequency to be converted and validated.
|
||||
+/// * `system_clock_frequency` - The system clock frequency of the AD9959 core.
|
||||
+///
|
||||
+/// Returns:
|
||||
+/// The corresponding frequency tuning word.
|
||||
+pub fn frequency_to_ftw(
|
||||
+ dds_frequency: f32,
|
||||
+ system_clock_frequency: f32,
|
||||
+) -> Result<u32, Error> {
|
||||
+ // Output frequency should not exceed the Nyquist's frequency.
|
||||
+ if !(0.0..=(system_clock_frequency / 2.0)).contains(&dds_frequency) {
|
||||
+ return Err(Error::Bounds);
|
||||
+ }
|
||||
+ // The function for channel frequency is `f_out = FTW * f_s / 2^32`, where FTW is the
|
||||
+ // frequency tuning word and f_s is the system clock rate.
|
||||
+ Ok(((dds_frequency / system_clock_frequency) * (1u64 << 32) as f32) as u32)
|
||||
+}
|
||||
+
|
||||
+/// Convert phase into phase offset word.
|
||||
+///
|
||||
+/// Arguments:
|
||||
+/// * `phase_turns` - The normalized number of phase turns of a DDS channel.
|
||||
+///
|
||||
+/// Returns:
|
||||
+/// The corresponding phase offset word.
|
||||
+pub fn phase_to_pow(phase_turns: f32) -> Result<u16, Error> {
|
||||
+ Ok((phase_turns * (1 << 14) as f32) as u16 & 0x3FFFu16)
|
||||
+}
|
||||
+
|
||||
+/// Convert amplitude into amplitude control register values.
|
||||
+///
|
||||
+/// Arguments:
|
||||
+/// * `amplitude` - The normalized amplitude of a DDS channel.
|
||||
+///
|
||||
+/// Returns:
|
||||
+/// The corresponding value in the amplitude control register.
|
||||
+pub fn amplitude_to_acr(amplitude: f32) -> Result<u32, Error> {
|
||||
+ if !(0.0..=1.0).contains(&litude) {
|
||||
+ return Err(Error::Bounds);
|
||||
+ }
|
||||
+
|
||||
+ let acr: u32 = *0u32
|
||||
+ .set_bits(0..=9, ((amplitude * (1 << 10) as f32) as u32) & 0x3FF)
|
||||
+ .set_bit(12, amplitude != 1.0);
|
||||
+
|
||||
+ Ok(acr as u32)
|
||||
+}
|
||||
+
|
||||
/// Represents a means of serializing a DDS profile for writing to a stream.
|
||||
pub struct ProfileSerializer {
|
||||
// heapless::Vec<u8, 32>, especially its extend_from_slice() is slow
|
||||
@@ -566,6 +676,39 @@ impl ProfileSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
+ /// Update the system clock configuration.
|
||||
+ ///
|
||||
+ /// # Args
|
||||
+ /// * `reference_clock_frequency` - The reference clock frequency provided to the AD9959 core.
|
||||
+ /// * `multiplier` - The frequency multiplier of the system clock. Must be 1 or 4-20.
|
||||
+ ///
|
||||
+ /// # Limitations
|
||||
+ /// The correctness of the FR1 register setting code rely on FR1\[0:17\] staying 0.
|
||||
+ pub fn set_system_clock(
|
||||
+ &mut self,
|
||||
+ reference_clock_frequency: f32,
|
||||
+ multiplier: u8,
|
||||
+ ) -> Result<f32, Error> {
|
||||
+ let frequency = reference_clock_frequency * multiplier as f32;
|
||||
+
|
||||
+ // The enabled channel will be updated after clock reconfig
|
||||
+ let mut fr1 = [0u8; 3];
|
||||
+
|
||||
+ // The ad9959 crate does not modify FR1[0:17]. These bits keep their default value.
|
||||
+ // These bits by default are 0.
|
||||
+ // Reading the register then update is not possible to implement in a serializer, where
|
||||
+ // many QSPI writes are performed in burst. Switching between read and write requires
|
||||
+ // breaking the QSPI indirect write mode and switch into the QSPI indirect read mode.
|
||||
+ fr1[0].set_bits(2..=6, multiplier);
|
||||
+
|
||||
+ // Frequencies within the VCO forbidden range (160e6, 255e6) are already rejected.
|
||||
+ let vco_range = HIGH_GAIN_VCO_RANGE.contains(&frequency);
|
||||
+ fr1[0].set_bit(7, vco_range);
|
||||
+
|
||||
+ self.add_write(Register::FR1, &fr1);
|
||||
+ Ok(frequency)
|
||||
+ }
|
||||
+
|
||||
/// Add a register write to the serialization data.
|
||||
fn add_write(&mut self, register: Register, value: &[u8]) {
|
||||
let data = &mut self.data[self.index..];
|
||||
diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs
|
||||
index c7df3f603..dadd0523c 100644
|
||||
--- a/src/bin/dual-iir.rs
|
||||
+++ b/src/bin/dual-iir.rs
|
||||
@@ -44,6 +44,8 @@ use stabilizer::{
|
||||
afe::Gain,
|
||||
dac::{Dac0Output, Dac1Output, DacCode},
|
||||
hal,
|
||||
+ pounder::{ClockConfig, PounderConfig},
|
||||
+ setup::PounderDevices as Pounder,
|
||||
signal_generator::{self, SignalGenerator},
|
||||
timers::SamplingTimer,
|
||||
DigitalInput0, DigitalInput1, SystemTimer, Systick, AFE0, AFE1,
|
||||
@@ -145,6 +147,16 @@ pub struct Settings {
|
||||
/// See [signal_generator::BasicConfig#miniconf]
|
||||
#[miniconf(defer)]
|
||||
signal_generator: miniconf::Array<signal_generator::BasicConfig, 2>,
|
||||
+
|
||||
+ /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations
|
||||
+ ///
|
||||
+ /// # Path
|
||||
+ /// `pounder`
|
||||
+ ///
|
||||
+ /// # Value
|
||||
+ /// See [PounderConfig#miniconf]
|
||||
+ #[miniconf(defer)]
|
||||
+ pounder: miniconf::Option<PounderConfig>,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
@@ -171,6 +183,8 @@ impl Default for Settings {
|
||||
.into(),
|
||||
|
||||
stream_target: StreamTarget::default(),
|
||||
+
|
||||
+ pounder: None.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,6 +203,7 @@ mod app {
|
||||
settings: Settings,
|
||||
telemetry: TelemetryBuffer,
|
||||
signal_generator: [SignalGenerator; 2],
|
||||
+ pounder: Option<Pounder>,
|
||||
}
|
||||
|
||||
#[local]
|
||||
@@ -199,6 +214,7 @@ mod app {
|
||||
adcs: (Adc0Input, Adc1Input),
|
||||
dacs: (Dac0Output, Dac1Output),
|
||||
iir_state: [[iir::Vec5<f32>; IIR_CASCADE_LENGTH]; 2],
|
||||
+ dds_clock_state: Option<ClockConfig>,
|
||||
generator: FrameGenerator,
|
||||
cpu_temp_sensor: stabilizer::hardware::cpu_temp_sensor::CpuTempSensor,
|
||||
}
|
||||
@@ -208,7 +224,7 @@ mod app {
|
||||
let clock = SystemTimer::new(|| monotonics::now().ticks() as u32);
|
||||
|
||||
// Configure the microcontroller
|
||||
- let (stabilizer, _pounder) = hardware::setup::setup(
|
||||
+ let (stabilizer, pounder) = hardware::setup::setup(
|
||||
c.core,
|
||||
c.device,
|
||||
clock,
|
||||
@@ -216,6 +232,13 @@ mod app {
|
||||
SAMPLE_TICKS,
|
||||
);
|
||||
|
||||
+ let dds_clock_state = pounder.as_ref().map(|_| ClockConfig::default());
|
||||
+
|
||||
+ let mut settings = Settings::default();
|
||||
+ if pounder.is_some() {
|
||||
+ settings.pounder.replace(PounderConfig::default());
|
||||
+ }
|
||||
+
|
||||
let mut network = NetworkUsers::new(
|
||||
stabilizer.net.stack,
|
||||
stabilizer.net.phy,
|
||||
@@ -226,13 +249,12 @@ mod app {
|
||||
.unwrap_or("10.34.16.1")
|
||||
.parse()
|
||||
.unwrap(),
|
||||
+ settings,
|
||||
);
|
||||
|
||||
let generator = network
|
||||
.configure_streaming(StreamFormat::AdcDacData, BATCH_SIZE as _);
|
||||
|
||||
- let settings = Settings::default();
|
||||
-
|
||||
let shared = Shared {
|
||||
network,
|
||||
settings,
|
||||
@@ -249,6 +271,7 @@ mod app {
|
||||
.unwrap(),
|
||||
),
|
||||
],
|
||||
+ pounder,
|
||||
};
|
||||
|
||||
let mut local = Local {
|
||||
@@ -258,6 +281,7 @@ mod app {
|
||||
adcs: stabilizer.adcs,
|
||||
dacs: stabilizer.dacs,
|
||||
iir_state: [[[0.; 5]; IIR_CASCADE_LENGTH]; 2],
|
||||
+ dds_clock_state,
|
||||
generator,
|
||||
cpu_temp_sensor: stabilizer.temperature_sensor,
|
||||
};
|
||||
@@ -407,7 +431,7 @@ mod app {
|
||||
}
|
||||
}
|
||||
|
||||
- #[task(priority = 1, local=[afes], shared=[network, settings, signal_generator])]
|
||||
+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, signal_generator, pounder])]
|
||||
fn settings_update(mut c: settings_update::Context) {
|
||||
let settings = c.shared.network.lock(|net| *net.miniconf.settings());
|
||||
c.shared.settings.lock(|current| *current = settings);
|
||||
@@ -431,15 +455,28 @@ mod app {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Update Pounder configurations
|
||||
+ c.shared.pounder.lock(|pounder| {
|
||||
+ if let Some(pounder) = pounder {
|
||||
+ let pounder_settings = settings.pounder.as_ref().unwrap();
|
||||
+ let mut clocking = c.local.dds_clock_state.unwrap();
|
||||
+ pounder.update_dds(*pounder_settings, &mut clocking);
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
let target = settings.stream_target.into();
|
||||
c.shared.network.lock(|net| net.direct_stream(target));
|
||||
}
|
||||
|
||||
- #[task(priority = 1, shared=[network, settings, telemetry], local=[cpu_temp_sensor])]
|
||||
+ #[task(priority = 1, shared=[network, settings, telemetry, pounder], local=[cpu_temp_sensor])]
|
||||
fn telemetry(mut c: telemetry::Context) {
|
||||
let telemetry: TelemetryBuffer =
|
||||
c.shared.telemetry.lock(|telemetry| *telemetry);
|
||||
|
||||
+ let pounder_telemetry = c.shared.pounder.lock(|pounder| {
|
||||
+ pounder.as_mut().map(|pounder| pounder.get_telemetry())
|
||||
+ });
|
||||
+
|
||||
let (gains, telemetry_period) = c
|
||||
.shared
|
||||
.settings
|
||||
@@ -450,6 +487,7 @@ mod app {
|
||||
gains[0],
|
||||
gains[1],
|
||||
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
||||
+ pounder_telemetry,
|
||||
))
|
||||
});
|
||||
|
||||
diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs
|
||||
index 6896df7ff..1e92a0f75 100644
|
||||
--- a/src/bin/lockin.rs
|
||||
+++ b/src/bin/lockin.rs
|
||||
@@ -254,6 +254,8 @@ mod app {
|
||||
SAMPLE_TICKS,
|
||||
);
|
||||
|
||||
+ let settings = Settings::default();
|
||||
+
|
||||
let mut network = NetworkUsers::new(
|
||||
stabilizer.net.stack,
|
||||
stabilizer.net.phy,
|
||||
@@ -264,6 +266,7 @@ mod app {
|
||||
.unwrap_or("10.34.16.1")
|
||||
.parse()
|
||||
.unwrap(),
|
||||
+ settings,
|
||||
);
|
||||
|
||||
let generator = network
|
||||
@@ -272,7 +275,7 @@ mod app {
|
||||
let shared = Shared {
|
||||
network,
|
||||
telemetry: TelemetryBuffer::default(),
|
||||
- settings: Settings::default(),
|
||||
+ settings,
|
||||
};
|
||||
|
||||
let signal_config = signal_generator::Config {
|
||||
@@ -499,6 +502,7 @@ mod app {
|
||||
gains[0],
|
||||
gains[1],
|
||||
c.local.cpu_temp_sensor.get_temperature().unwrap(),
|
||||
+ None,
|
||||
))
|
||||
});
|
||||
|
||||
diff --git a/src/hardware/pounder/attenuators.rs b/src/hardware/pounder/attenuators.rs
|
||||
index ef22814d4..a5d220dfb 100644
|
||||
--- a/src/hardware/pounder/attenuators.rs
|
||||
+++ b/src/hardware/pounder/attenuators.rs
|
||||
@@ -54,10 +54,9 @@ pub trait AttenuatorInterface {
|
||||
fn get_attenuation(&mut self, channel: Channel) -> Result<f32, Error> {
|
||||
let mut channels = [0_u8; 4];
|
||||
|
||||
- // Reading the data always shifts data out of the staging registers, so we perform a
|
||||
- // duplicate write-back to ensure the staging register is always equal to the output
|
||||
- // register.
|
||||
- self.transfer_attenuators(&mut channels)?;
|
||||
+ // Reading the data always shifts data out of the staging registers, so a duplicate
|
||||
+ // write-back will be performed to ensure the staging register is always equal to the
|
||||
+ // output register.
|
||||
self.transfer_attenuators(&mut channels)?;
|
||||
|
||||
// The attenuation code is stored in the upper 6 bits of the register, where each LSB
|
||||
@@ -68,6 +67,9 @@ pub trait AttenuatorInterface {
|
||||
// care) would contain erroneous data.
|
||||
let attenuation_code = (!channels[channel as usize]) >> 2;
|
||||
|
||||
+ // The write-back transfer is performed. Staging register is now restored.
|
||||
+ self.transfer_attenuators(&mut channels)?;
|
||||
+
|
||||
// Convert the desired channel code into dB of attenuation.
|
||||
Ok(attenuation_code as f32 / 2.0)
|
||||
}
|
||||
diff --git a/src/hardware/pounder/dds_output.rs b/src/hardware/pounder/dds_output.rs
|
||||
index 9af23a9aa..559855fcc 100644
|
||||
--- a/src/hardware/pounder/dds_output.rs
|
||||
+++ b/src/hardware/pounder/dds_output.rs
|
||||
@@ -55,7 +55,7 @@
|
||||
use log::warn;
|
||||
use stm32h7xx_hal as hal;
|
||||
|
||||
-use super::{hrtimer::HighResTimerE, QspiInterface};
|
||||
+use super::{hrtimer::HighResTimerE, Profile, QspiInterface};
|
||||
use ad9959::{Channel, Mode, ProfileSerializer};
|
||||
|
||||
/// The DDS profile update stream.
|
||||
@@ -157,6 +157,46 @@ impl<'a> ProfileBuilder<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
+ /// Update a number of channels with fully defined profile settings.
|
||||
+ ///
|
||||
+ /// # Args
|
||||
+ /// * `channels` - A set of channels to apply the configuration to.
|
||||
+ /// * `profile` - The complete DDS profile, which defines the frequency tuning word,
|
||||
+ /// amplitude control register & the phase offset word of the channels.
|
||||
+ /// # Note
|
||||
+ /// The ACR should be stored in the 3 LSB of the word.
|
||||
+ /// If amplitude scaling is to be used, the "Amplitude multiplier enable" bit must be set.
|
||||
+ #[inline]
|
||||
+ pub fn update_channels_with_profile(
|
||||
+ &mut self,
|
||||
+ channels: Channel,
|
||||
+ profile: Profile,
|
||||
+ ) -> &mut Self {
|
||||
+ self.serializer.update_channels(
|
||||
+ channels,
|
||||
+ Some(profile.frequency_tuning_word),
|
||||
+ Some(profile.phase_offset),
|
||||
+ Some(profile.amplitude_control),
|
||||
+ );
|
||||
+ self
|
||||
+ }
|
||||
+
|
||||
+ /// Update the system clock configuration.
|
||||
+ ///
|
||||
+ /// # Args
|
||||
+ /// * `reference_clock_frequency` - The reference clock frequency provided to the AD9959 core.
|
||||
+ /// * `multiplier` - The frequency multiplier of the system clock. Must be 1 or 4-20.
|
||||
+ #[inline]
|
||||
+ pub fn set_system_clock(
|
||||
+ &mut self,
|
||||
+ reference_clock_frequency: f32,
|
||||
+ multiplier: u8,
|
||||
+ ) -> Result<&mut Self, ad9959::Error> {
|
||||
+ self.serializer
|
||||
+ .set_system_clock(reference_clock_frequency, multiplier)?;
|
||||
+ Ok(self)
|
||||
+ }
|
||||
+
|
||||
/// Write the profile to the DDS asynchronously.
|
||||
#[allow(dead_code)]
|
||||
#[inline]
|
||||
diff --git a/src/hardware/pounder/mod.rs b/src/hardware/pounder/mod.rs
|
||||
index d6dd654fc..1e436f785 100644
|
||||
--- a/src/hardware/pounder/mod.rs
|
||||
+++ b/src/hardware/pounder/mod.rs
|
||||
@@ -1,10 +1,17 @@
|
||||
use self::attenuators::AttenuatorInterface;
|
||||
|
||||
use super::hal;
|
||||
-use crate::hardware::{shared_adc::AdcChannel, I2c1Proxy};
|
||||
+use crate::hardware::{setup, shared_adc::AdcChannel, I2c1Proxy};
|
||||
+use crate::net::telemetry::PounderTelemetry;
|
||||
+use ad9959::{
|
||||
+ amplitude_to_acr, frequency_to_ftw, phase_to_pow, validate_clocking,
|
||||
+};
|
||||
use embedded_hal::blocking::spi::Transfer;
|
||||
use enum_iterator::Sequence;
|
||||
+use miniconf::Miniconf;
|
||||
+use rf_power::PowerMeasurementInterface;
|
||||
use serde::{Deserialize, Serialize};
|
||||
+use stm32h7xx_hal::time::MegaHertz;
|
||||
|
||||
pub mod attenuators;
|
||||
pub mod dds_output;
|
||||
@@ -91,40 +98,98 @@ impl From<Channel> for GpioPin {
|
||||
}
|
||||
}
|
||||
|
||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||
-pub struct DdsChannelState {
|
||||
- pub phase_offset: f32,
|
||||
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Miniconf)]
|
||||
+pub struct DdsChannelConfig {
|
||||
pub frequency: f32,
|
||||
+ pub phase_offset: f32,
|
||||
pub amplitude: f32,
|
||||
- pub enabled: bool,
|
||||
}
|
||||
|
||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||
-pub struct ChannelState {
|
||||
- pub parameters: DdsChannelState,
|
||||
- pub attenuation: f32,
|
||||
+impl Default for DdsChannelConfig {
|
||||
+ fn default() -> Self {
|
||||
+ Self {
|
||||
+ frequency: 0.0,
|
||||
+ phase_offset: 0.0,
|
||||
+ amplitude: 0.0,
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||
-pub struct InputChannelState {
|
||||
- pub attenuation: f32,
|
||||
- pub power: f32,
|
||||
- pub mixer: DdsChannelState,
|
||||
+/// Represents a fully defined DDS profile, with parameters expressed in machine units
|
||||
+pub struct Profile {
|
||||
+ /// A 32-bits representation of DDS frequency in relation to the system clock frequency.
|
||||
+ /// This value corresponds to the AD9959 CFTW0 register, which specifies the frequency
|
||||
+ /// of DDS channels.
|
||||
+ pub frequency_tuning_word: u32,
|
||||
+ /// The DDS phase offset. It corresponds to the AD9959 CPOW0 register, which specifies
|
||||
+ /// the phase offset of DDS channels.
|
||||
+ pub phase_offset: u16,
|
||||
+ /// Control amplitudes of DDS channels. It corresponds to the AD9959 ACR register, which
|
||||
+ /// controls the amplitude scaling factor of DDS channels.
|
||||
+ pub amplitude_control: u32,
|
||||
+}
|
||||
+
|
||||
+impl TryFrom<(ClockConfig, ChannelConfig)> for Profile {
|
||||
+ type Error = ad9959::Error;
|
||||
+
|
||||
+ fn try_from(
|
||||
+ (clocking, channel): (ClockConfig, ChannelConfig),
|
||||
+ ) -> Result<Self, Self::Error> {
|
||||
+ let system_clock_frequency =
|
||||
+ clocking.reference_clock * clocking.multiplier as f32;
|
||||
+ Ok(Profile {
|
||||
+ frequency_tuning_word: frequency_to_ftw(
|
||||
+ channel.dds.frequency,
|
||||
+ system_clock_frequency,
|
||||
+ )?,
|
||||
+ phase_offset: phase_to_pow(channel.dds.phase_offset)?,
|
||||
+ amplitude_control: amplitude_to_acr(channel.dds.amplitude)?,
|
||||
+ })
|
||||
+ }
|
||||
}
|
||||
|
||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||
-pub struct OutputChannelState {
|
||||
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Miniconf)]
|
||||
+pub struct ChannelConfig {
|
||||
+ #[miniconf(defer)]
|
||||
+ pub dds: DdsChannelConfig,
|
||||
pub attenuation: f32,
|
||||
- pub channel: DdsChannelState,
|
||||
}
|
||||
|
||||
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
|
||||
-pub struct DdsClockConfig {
|
||||
+impl Default for ChannelConfig {
|
||||
+ fn default() -> Self {
|
||||
+ ChannelConfig {
|
||||
+ dds: DdsChannelConfig::default(),
|
||||
+ attenuation: 31.5,
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Miniconf)]
|
||||
+pub struct ClockConfig {
|
||||
pub multiplier: u8,
|
||||
pub reference_clock: f32,
|
||||
pub external_clock: bool,
|
||||
}
|
||||
|
||||
+impl Default for ClockConfig {
|
||||
+ fn default() -> Self {
|
||||
+ Self {
|
||||
+ multiplier: 5,
|
||||
+ reference_clock: MegaHertz::MHz(100).to_Hz() as f32,
|
||||
+ external_clock: false,
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#[derive(Copy, Clone, Debug, Default, Miniconf)]
|
||||
+pub struct PounderConfig {
|
||||
+ pub clock: ClockConfig,
|
||||
+ #[miniconf(defer)]
|
||||
+ pub in_channel: miniconf::Array<ChannelConfig, 2>,
|
||||
+ #[miniconf(defer)]
|
||||
+ pub out_channel: miniconf::Array<ChannelConfig, 2>,
|
||||
+}
|
||||
+
|
||||
impl From<Channel> for ad9959::Channel {
|
||||
/// Translate pounder channels to DDS output channels.
|
||||
fn from(other: Channel) -> Self {
|
||||
@@ -489,3 +554,77 @@ impl rf_power::PowerMeasurementInterface for PounderDevices {
|
||||
Ok(adc_scale * 2.048)
|
||||
}
|
||||
}
|
||||
+
|
||||
+impl setup::PounderDevices {
|
||||
+ pub fn update_dds(
|
||||
+ &mut self,
|
||||
+ settings: PounderConfig,
|
||||
+ clocking: &mut ClockConfig,
|
||||
+ ) {
|
||||
+ if *clocking != settings.clock {
|
||||
+ match validate_clocking(
|
||||
+ settings.clock.reference_clock,
|
||||
+ settings.clock.multiplier,
|
||||
+ ) {
|
||||
+ Ok(_frequency) => {
|
||||
+ self.pounder
|
||||
+ .set_ext_clk(settings.clock.external_clock)
|
||||
+ .unwrap();
|
||||
+
|
||||
+ self.dds_output
|
||||
+ .builder()
|
||||
+ .set_system_clock(
|
||||
+ settings.clock.reference_clock,
|
||||
+ settings.clock.multiplier,
|
||||
+ )
|
||||
+ .unwrap()
|
||||
+ .write();
|
||||
+
|
||||
+ *clocking = settings.clock;
|
||||
+ }
|
||||
+ Err(err) => {
|
||||
+ log::error!("Invalid AD9959 clocking parameters: {:?}", err)
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (channel_config, pounder_channel) in settings
|
||||
+ .in_channel
|
||||
+ .iter()
|
||||
+ .chain(settings.out_channel.iter())
|
||||
+ .zip([Channel::In0, Channel::In1, Channel::Out0, Channel::Out1])
|
||||
+ {
|
||||
+ match Profile::try_from((*clocking, *channel_config)) {
|
||||
+ Ok(dds_profile) => {
|
||||
+ self.dds_output
|
||||
+ .builder()
|
||||
+ .update_channels_with_profile(
|
||||
+ pounder_channel.into(),
|
||||
+ dds_profile,
|
||||
+ )
|
||||
+ .write();
|
||||
+
|
||||
+ if let Err(err) = self.pounder.set_attenuation(
|
||||
+ pounder_channel,
|
||||
+ channel_config.attenuation,
|
||||
+ ) {
|
||||
+ log::error!("Invalid attenuation settings: {:?}", err)
|
||||
+ }
|
||||
+ }
|
||||
+ Err(err) => {
|
||||
+ log::error!("Invalid AD9959 profile settings: {:?}", err)
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pub fn get_telemetry(&mut self) -> PounderTelemetry {
|
||||
+ PounderTelemetry {
|
||||
+ temperature: self.pounder.lm75.read_temperature().unwrap(),
|
||||
+ input_power: [
|
||||
+ self.pounder.measure_power(Channel::In0).unwrap(),
|
||||
+ self.pounder.measure_power(Channel::In1).unwrap(),
|
||||
+ ],
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/net/mod.rs b/src/net/mod.rs
|
||||
index f6372381b..9a88008f7 100644
|
||||
--- a/src/net/mod.rs
|
||||
+++ b/src/net/mod.rs
|
||||
@@ -43,7 +43,7 @@ pub enum NetworkState {
|
||||
}
|
||||
|
||||
/// A structure of Stabilizer's default network users.
|
||||
-pub struct NetworkUsers<S: Default + Miniconf + Clone, T: Serialize> {
|
||||
+pub struct NetworkUsers<S: Miniconf + Clone, T: Serialize> {
|
||||
pub miniconf: miniconf::MqttClient<S, NetworkReference, SystemTimer, 512>,
|
||||
pub processor: NetworkProcessor,
|
||||
stream: DataStream,
|
||||
@@ -53,7 +53,7 @@ pub struct NetworkUsers<S: Default + Miniconf + Clone, T: Serialize> {
|
||||
|
||||
impl<S, T> NetworkUsers<S, T>
|
||||
where
|
||||
- S: Default + Miniconf + Clone,
|
||||
+ S: Miniconf + Clone,
|
||||
T: Serialize,
|
||||
{
|
||||
/// Construct Stabilizer's default network users.
|
||||
@@ -65,6 +65,7 @@ where
|
||||
/// * `app` - The name of the application.
|
||||
/// * `mac` - The MAC address of the network.
|
||||
/// * `broker` - The IP address of the MQTT broker to use.
|
||||
+ /// * `settings` - The initial settings value
|
||||
///
|
||||
/// # Returns
|
||||
/// A new struct of network users.
|
||||
@@ -75,6 +76,7 @@ where
|
||||
app: &str,
|
||||
mac: smoltcp_nal::smoltcp::wire::EthernetAddress,
|
||||
broker: IpAddr,
|
||||
+ settings: S,
|
||||
) -> Self {
|
||||
let stack_manager =
|
||||
cortex_m::singleton!(: NetworkManager = NetworkManager::new(stack))
|
||||
@@ -91,7 +93,7 @@ where
|
||||
&prefix,
|
||||
broker,
|
||||
clock,
|
||||
- S::default(),
|
||||
+ settings,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs
|
||||
index c6e071f17..e35347037 100644
|
||||
--- a/src/net/telemetry.rs
|
||||
+++ b/src/net/telemetry.rs
|
||||
@@ -58,6 +58,23 @@ pub struct Telemetry {
|
||||
|
||||
/// The CPU temperature in degrees Celsius.
|
||||
pub cpu_temp: f32,
|
||||
+
|
||||
+ /// Measurements related to Pounder
|
||||
+ pub pounder: Option<PounderTelemetry>,
|
||||
+}
|
||||
+
|
||||
+/// The structure that holds the telemetry related to Pounder.
|
||||
+///
|
||||
+/// # Note
|
||||
+/// This structure should be generated on-demand by the buffer when required to minimize conversion
|
||||
+/// overhead.
|
||||
+#[derive(Copy, Clone, Serialize)]
|
||||
+pub struct PounderTelemetry {
|
||||
+ /// The Pounder temperature in degrees Celsius
|
||||
+ pub temperature: f32,
|
||||
+
|
||||
+ /// The detected RF power into IN channels
|
||||
+ pub input_power: [f32; 2],
|
||||
}
|
||||
|
||||
impl Default for TelemetryBuffer {
|
||||
@@ -77,10 +94,17 @@ impl TelemetryBuffer {
|
||||
/// * `afe0` - The current AFE configuration for channel 0.
|
||||
/// * `afe1` - The current AFE configuration for channel 1.
|
||||
/// * `cpu_temp` - The current CPU temperature.
|
||||
+ /// * `pounder` - The current Pounder telemetry.
|
||||
///
|
||||
/// # Returns
|
||||
/// The finalized telemetry structure that can be serialized and reported.
|
||||
- pub fn finalize(self, afe0: Gain, afe1: Gain, cpu_temp: f32) -> Telemetry {
|
||||
+ pub fn finalize(
|
||||
+ self,
|
||||
+ afe0: Gain,
|
||||
+ afe1: Gain,
|
||||
+ cpu_temp: f32,
|
||||
+ pounder: Option<PounderTelemetry>,
|
||||
+ ) -> Telemetry {
|
||||
let in0_volts = Into::<f32>::into(self.adcs[0]) / afe0.as_multiplier();
|
||||
let in1_volts = Into::<f32>::into(self.adcs[1]) / afe1.as_multiplier();
|
||||
|
||||
@@ -89,6 +113,7 @@ impl TelemetryBuffer {
|
||||
adcs: [in0_volts, in1_volts],
|
||||
dacs: [self.dacs[0].into(), self.dacs[1].into()],
|
||||
digital_inputs: self.digital_inputs,
|
||||
+ pounder,
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
105
mcu/default.nix
105
mcu/default.nix
|
@ -1,105 +0,0 @@
|
|||
{ # Use master branch of the overlay by default
|
||||
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
|
||||
rustManifest ? ./channel-rust-nightly.toml
|
||||
}:
|
||||
|
||||
let
|
||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix {
|
||||
inherit rustManifest;
|
||||
});
|
||||
buildStm32Firmware = { name, src, patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", ... } @ args:
|
||||
let
|
||||
# If binaryName is specified as an arg of buildStm32Firmware,
|
||||
# then the .nix containing the cargoSha256 must be named "cargosha256-${binaryName}.nix";
|
||||
# otherwise, the .nix must be named "cargosha256.nix".
|
||||
cargoSha256Drv = pkgs.runCommand "${name}-cargosha256" { } ''
|
||||
cp "${src}/cargosha256${
|
||||
if (args ? binaryName) then "-" + args.binaryName else ""
|
||||
}.nix" $out
|
||||
'';
|
||||
# If binaryName is specified as an arg of buildStm32Firmware,
|
||||
# then use it as the filename of the ELF generated from `cargo build`;
|
||||
# otherwise, use the `name` arg (i.e. the Rust package name) as the ELF filename.
|
||||
binaryName = if (args ? binaryName) then args.binaryName else name;
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
inherit name;
|
||||
version = "0.0.0";
|
||||
|
||||
inherit src;
|
||||
cargoSha256 = (import cargoSha256Drv);
|
||||
|
||||
inherit patchPhase;
|
||||
nativeBuildInputs = [ pkgs.llvm ] ++ extraNativeBuildInputs;
|
||||
buildPhase = ''
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
cargo build --release
|
||||
'';
|
||||
|
||||
inherit checkPhase;
|
||||
installPhase = ''
|
||||
mkdir -p $out $out/nix-support
|
||||
cp target/thumbv7em-none-eabihf/release/${binaryName} $out/${name}.elf
|
||||
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
|
||||
llvm-objcopy -O binary target/thumbv7em-none-eabihf/release/${binaryName} $out/${name}.bin
|
||||
echo file binary-dist $out/${name}.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
};
|
||||
migen = (import ../artiq-fast/pkgs/python-deps.nix { inherit (pkgs) stdenv fetchgit fetchFromGitHub python3Packages; misoc-new = true; }).migen;
|
||||
in
|
||||
{
|
||||
stabilizer-dual-iir = buildStm32Firmware {
|
||||
name = "stabilizer-dual-iir";
|
||||
binaryName = "dual-iir";
|
||||
src = <stabilizerSrc>;
|
||||
patchPhase = ''
|
||||
substituteInPlace src/hardware/configuration.rs \
|
||||
--replace "IpAddress::v4(10, 34, 16, 103)" \
|
||||
"IpAddress::v4(192, 168, 1, 76)" \
|
||||
--replace "Ipv4Address::new(10, 34, 16, 1)" \
|
||||
"Ipv4Address::new(192, 168, 1, 1)"
|
||||
'';
|
||||
};
|
||||
thermostat = buildStm32Firmware {
|
||||
name = "thermostat";
|
||||
src = <thermostatSrc>;
|
||||
checkPhase = ''
|
||||
cargo test --target=${pkgs.rust.toRustTarget pkgs.stdenv.targetPlatform}
|
||||
'';
|
||||
};
|
||||
humpback-dds = buildStm32Firmware {
|
||||
name = "humpback-dds";
|
||||
src = <humpbackDdsSrc>;
|
||||
extraNativeBuildInputs = [
|
||||
(pkgs.python3.withPackages(ps: [ migen ]))
|
||||
pkgs.yosys
|
||||
pkgs.nextpnr
|
||||
pkgs.icestorm
|
||||
];
|
||||
};
|
||||
# openMMC build system breaks if host compiler is not available, so do not use stdenvNoCC here
|
||||
sayma-mmc = pkgs.stdenv.mkDerivation {
|
||||
name = "sayma-mmc";
|
||||
src = <saymaMmcSrc>;
|
||||
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
|
||||
nativeBuildInputs = [ pkgs.cmake pkgs.gcc-arm-embedded ];
|
||||
buildPhase =
|
||||
''
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DBOARD=sayma -DBOARD_RTM=sayma -DVERSION= -DTARGET_CONTROLLER=LPC1776 -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
mkdir $out
|
||||
cp out/* $out
|
||||
mkdir -p $out $out/nix-support
|
||||
echo file binary-dist $out/openMMC.axf >> $out/nix-support/hydra-build-products
|
||||
echo file binary-dist $out/openMMC.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
{ recurseIntoAttrs, stdenv, lib,
|
||||
makeRustPlatform,
|
||||
fetchurl, patchelf,
|
||||
rustManifest ? ./channel-rust-nightly.toml
|
||||
}:
|
||||
|
||||
let
|
||||
targets = [
|
||||
"thumbv7em-none-eabihf"
|
||||
];
|
||||
rustChannel =
|
||||
lib.rustLib.fromManifestFile rustManifest {
|
||||
inherit stdenv fetchurl patchelf;
|
||||
};
|
||||
rust =
|
||||
rustChannel.rust.override {
|
||||
inherit targets;
|
||||
};
|
||||
in
|
||||
makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
}
|
29
web.nix
29
web.nix
|
@ -1,7 +1,30 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
src = <webSrc>;
|
||||
web-src = <webSrc>;
|
||||
nmigen-src = <nmigenSrc>;
|
||||
in
|
||||
{
|
||||
web = pkgs.runCommand "web" {} "cd ${src}; ${pkgs.zola}/bin/zola build -o $out";
|
||||
rec {
|
||||
web = pkgs.runCommand "web" {} "cd ${web-src}; ${pkgs.zola}/bin/zola build -o $out";
|
||||
sphinxcontrib-platformpicker = pkgs.python3Packages.buildPythonPackage rec {
|
||||
pname = "sphinxcontrib-platformpicker";
|
||||
version = "1.3";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "whitequark";
|
||||
repo = "sphinxcontrib-platformpicker";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-qKhi4QqYhU7CbNSpziFacXc/sWWPSuM3Nc/oWPmBivM=";
|
||||
};
|
||||
propagatedBuildInputs = [ pkgs.python3Packages.sphinx ];
|
||||
};
|
||||
nmigen-docs = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "nmigen-docs";
|
||||
src = nmigen-src;
|
||||
buildInputs = [ (pkgs.python3.withPackages(ps: [ ps.sphinx ps.sphinx_rtd_theme sphinxcontrib-platformpicker ])) ];
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase =
|
||||
''
|
||||
export PYTHONPATH=$src
|
||||
sphinx-build -b html $src/docs $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
zynq-rs = import <zynq-rs>;
|
||||
in
|
||||
(
|
||||
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) zynq-rs
|
||||
)
|
65
zynq.nix
65
zynq.nix
|
@ -1,65 +0,0 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
zynq-rs-latest = import <zynq-rs>;
|
||||
artiq-zynq = import <artiq-zynq>;
|
||||
artiq-fast = import <artiq-fast> { inherit pkgs; };
|
||||
in
|
||||
(
|
||||
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) zynq-rs-latest
|
||||
) // (
|
||||
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiq-zynq
|
||||
) // {
|
||||
gateware-sim = pkgs.lib.hydraJob (pkgs.stdenv.mkDerivation {
|
||||
name = "gateware-sim";
|
||||
buildInputs = [ artiq-fast.migen artiq-fast.migen-axi artiq-fast.artiq ];
|
||||
|
||||
phases = [ "buildPhase" ];
|
||||
|
||||
buildPhase =
|
||||
''
|
||||
python -m unittest discover ${<artiq-zynq>}/src/gateware -v
|
||||
touch $out
|
||||
'';
|
||||
});
|
||||
zc706-hitl-tests = pkgs.lib.hydraJob (pkgs.stdenv.mkDerivation {
|
||||
name = "zc706-hitl-tests";
|
||||
|
||||
# requires patched Nix
|
||||
__networked = true;
|
||||
|
||||
buildInputs = [
|
||||
pkgs.netcat pkgs.openssh pkgs.rsync artiq-fast.artiq artiq-fast.artiq-netboot
|
||||
];
|
||||
phases = [ "buildPhase" ];
|
||||
|
||||
buildPhase =
|
||||
''
|
||||
echo Power cycling board...
|
||||
(echo b; sleep 5; echo B; sleep 5) | nc -N -w6 192.168.1.31 3131
|
||||
echo Power cycle done.
|
||||
|
||||
export USER=hydra
|
||||
export OPENOCD_ZYNQ=${artiq-zynq.zynq-rs}/openocd
|
||||
export SZL=${(import artiq-zynq.zynq-rs).zc706-szl}/szl.elf
|
||||
pushd ${<artiq-zynq>}
|
||||
bash ${<artiq-zynq>}/remote_run.sh -h rpi-4 -o "-F /dev/null -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -i /opt/hydra_id_rsa" -d ${artiq-zynq.zc706-nist_qc2-jtag}
|
||||
popd
|
||||
|
||||
echo Waiting for the firmware to boot...
|
||||
sleep 15
|
||||
|
||||
echo Running test kernel...
|
||||
artiq_run --device-db ${<artiq-zynq>}/examples/device_db.py ${<artiq-zynq>}/examples/mandelbrot.py
|
||||
|
||||
echo Running ARTIQ unit tests...
|
||||
ARTIQ_ROOT=${<artiq-zynq>}/examples python -m unittest discover artiq.test.coredevice -v
|
||||
|
||||
touch $out
|
||||
|
||||
echo Completed
|
||||
|
||||
(echo b; sleep 5) | nc -N -w6 192.168.1.31 3131
|
||||
echo Board powered off
|
||||
'';
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue