From d04a7decfeb9cc96148c2f5559d6b50827426061 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 8 Oct 2021 11:07:12 +0200 Subject: [PATCH 1/6] removed simple variants from zc706 --- README.md | 2 +- default.nix | 8 +------- src/Makefile | 2 +- src/gateware/zc706.py | 38 +++----------------------------------- 4 files changed, 6 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 1db5433..029ff0f 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Note: if you are using Nix channels the first time, you need to be aware of this Pure build with Nix and execution on a remote JTAG server: ```shell -nix-build -A zc706-simple-jtag # or zc706-nist_qc2-jtag or zc706-nist_clock-jtag +nix-build -A zc706-nist_clock-jtag # or zc706-nist_qc2-jtag or zc706-nist_clock_satellite-jtag ./remote_run.sh ``` diff --git a/default.nix b/default.nix index 2826ce1..dbac0c1 100644 --- a/default.nix +++ b/default.nix @@ -8,7 +8,7 @@ let vivado = import { inherit pkgs; }; # FSBL configuration supplied by Vivado 2020.1 for these boards: fsblTargets = ["zc702" "zc706" "zed"]; - sat_variants = ["satellite" "acpki_satellite" "nist_clock_satellite" "nist_qc2_satellite"]; + sat_variants = ["acpki_satellite" "nist_clock_satellite" "nist_qc2_satellite"]; build = { target, variant, json ? null }: let szl = (import zynq-rs)."${target}-szl"; fsbl = import "${zynq-rs}/nix/fsbl.nix" { @@ -133,18 +133,12 @@ let ); in ( - (build { target = "zc706"; variant = "simple"; }) // - (build { target = "zc706"; variant = "master"; }) // - (build { target = "zc706"; variant = "satellite"; }) // (build { target = "zc706"; variant = "nist_clock"; }) // (build { target = "zc706"; variant = "nist_clock_master"; }) // (build { target = "zc706"; variant = "nist_clock_satellite"; }) // (build { target = "zc706"; variant = "nist_qc2"; }) // (build { target = "zc706"; variant = "nist_qc2_master"; }) // (build { target = "zc706"; variant = "nist_qc2_satellite"; }) // - (build { target = "zc706"; variant = "acpki_simple"; }) // - (build { target = "zc706"; variant = "acpki_master"; }) // - (build { target = "zc706"; variant = "acpki_satellite"; }) // (build { target = "zc706"; variant = "acpki_nist_clock"; }) // (build { target = "zc706"; variant = "acpki_nist_clock_master"; }) // (build { target = "zc706"; variant = "acpki_nist_clock_satellite"; }) // diff --git a/src/Makefile b/src/Makefile index a6a15e0..12f33a7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ TARGET := zc706 -GWARGS := -V simple +GWARGS := -V nist_clock all: ../build/runtime.bin diff --git a/src/gateware/zc706.py b/src/gateware/zc706.py index 89def33..ef44286 100755 --- a/src/gateware/zc706.py +++ b/src/gateware/zc706.py @@ -427,22 +427,6 @@ class _SatelliteBase(SoCCore): self.csr_devices.append("routing_table") -class _Simple_RTIO: - def __init__(self): - platform = self.platform - - rtio_channels = [] - for i in range(4): - phy = ttl_simple.Output(platform.request("user_led", i)) - self.submodules += phy - rtio_channels.append(rtio.Channel.from_phy(phy)) - - self.config["RTIO_LOG_CHANNEL"] = len(rtio_channels) - rtio_channels.append(rtio.LogChannel()) - - self.add_rtio(rtio_channels) - - class _NIST_CLOCK_RTIO: """ NIST clock hardware, with old backplane and 11 DDS channels @@ -542,21 +526,6 @@ class _NIST_QC2_RTIO: self.add_rtio(rtio_channels) -class Simple(ZC706, _Simple_RTIO): - def __init__(self, acpki): - ZC706.__init__(self, acpki) - _Simple_RTIO.__init__(self) - -class Master(_MasterBase, _Simple_RTIO): - def __init__(self, acpki): - _MasterBase.__init__(self, acpki) - _Simple_RTIO.__init__(self) - -class Satellite(_SatelliteBase, _Simple_RTIO): - def __init__(self, acpki): - _SatelliteBase.__init__(self, acpki) - _Simple_RTIO.__init__(self) - class NIST_CLOCK(ZC706, _NIST_CLOCK_RTIO): def __init__(self, acpki): ZC706.__init__(self, acpki) @@ -589,8 +558,7 @@ class NIST_QC2_Satellite(_SatelliteBase, _NIST_QC2_RTIO): _NIST_QC2_RTIO.__init__(self) -VARIANTS = {cls.__name__.lower(): cls for cls in [Simple, Master, Satellite, - NIST_CLOCK, NIST_CLOCK_Master, NIST_CLOCK_Satellite, +VARIANTS = {cls.__name__.lower(): cls for cls in [NIST_CLOCK, NIST_CLOCK_Master, NIST_CLOCK_Satellite, NIST_QC2, NIST_QC2_Master, NIST_QC2_Satellite]} @@ -625,9 +593,9 @@ def main(): help="build Rust compiler configuration into the specified file") parser.add_argument("-g", default=None, help="build gateware into the specified directory") - parser.add_argument("-V", "--variant", default="simple", + parser.add_argument("-V", "--variant", default="nist_clock", help="variant: " - "[acpki_]simple/nist_clock/nist_qc2 " + "[acpki_]nist_clock/nist_qc2[_master/_satellite] " "(default: %(default)s)") args = parser.parse_args() From 219c07593183f2cfee1f8e29ad0e9816ac2d6b53 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 8 Oct 2021 21:06:23 +0800 Subject: [PATCH 2/6] added explicit runtime/satman targets for makefile Reviewed-on: https://git.m-labs.hk/M-Labs/artiq-zynq/pulls/144 Co-authored-by: mwojcik Co-committed-by: mwojcik --- README.md | 8 +++++--- default.nix | 2 +- src/Makefile | 12 ++++++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 029ff0f..fdae0d7 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Note: if you are using Nix channels the first time, you need to be aware of this Pure build with Nix and execution on a remote JTAG server: ```shell -nix-build -A zc706-nist_clock-jtag # or zc706-nist_qc2-jtag or zc706-nist_clock_satellite-jtag +nix-build -A zc706-nist_clock-jtag # or zc706-nist_qc2-jtag or zc706-nist_clock_satellite-jtag etc. ./remote_run.sh ``` @@ -54,8 +54,8 @@ Impure incremental build and execution on a remote JTAG server: ```shell nix-shell cd src -gateware/zc706.py -g ../build/gateware # build gateware -make # build firmware +gateware/zc706.py -g ../build/gateware -v # build gateware +make GWARGS="-v " # build firmware cd .. ./remote_run.sh -i ``` @@ -64,6 +64,8 @@ Notes: - This is developed with Nixpkgs 21.05, and the ``nixbld.m-labs.hk`` binary substituter can also be used here (see the ARTIQ manual for the public key and instructions). - The impure build process is also compatible with non-Nix systems. +- When calling make, you need to specify both the variant and firmware type. +- Firmware type must be either ``runtime`` for DRTIO-less or DRTIO master variants, or ``satman`` for DRTIO satellite. - If the board is connected to the local machine, use the ``local_run.sh`` script. - To update ``zynq-rs``, update the cargo files as per usual for Rust projects, but also keep ``zynq-rs.nix`` in sync. diff --git a/default.nix b/default.nix index dbac0c1..40ce07d 100644 --- a/default.nix +++ b/default.nix @@ -35,7 +35,7 @@ let export XARGO_RUST_SRC="${rustPlatform.rust.rustc}/lib/rustlib/src/rust/library" export CLANG_EXTRA_INCLUDE_DIR="${pkgs.llvmPackages_9.clang-unwrapped.lib}/lib/clang/9.0.1/include" export CARGO_HOME=$(mktemp -d cargo-home.XXX) - make TARGET=${target} GWARGS="${if json == null then "-V ${variant}" else json}" ../build/${fwtype}.bin + make TARGET=${target} GWARGS="${if json == null then "-V ${variant}" else json}" ${fwtype} ''; installPhase = '' diff --git a/src/Makefile b/src/Makefile index 12f33a7..f12fb29 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,15 +1,19 @@ TARGET := zc706 GWARGS := -V nist_clock -all: ../build/runtime.bin +all: runtime -.PHONY: all +runtime: ../build/runtime.bin + +satman: ../build/satman.bin + +.PHONY: all runtime_target satman_target ../build/pl.rs ../build/rustc-cfg ../build/mem.rs: gateware/* mkdir -p ../build python gateware/$(TARGET).py -r ../build/pl.rs -c ../build/rustc-cfg -m ../build/mem.rs $(GWARGS) -../build/firmware/armv7-none-eabihf/release/runtime: ../build/pl.rs ../build/rustc-cfg ../build/mem.rs $(shell find . -print) +../build/firmware/armv7-none-eabihf/release/runtime: ../build/pl.rs ../build/rustc-cfg ../build/mem.rs $(shell find . -type f -print) cd runtime && \ XBUILD_SYSROOT_PATH=`pwd`/../../build/sysroot \ cargo xbuild --release \ @@ -19,7 +23,7 @@ all: ../build/runtime.bin ../build/runtime.bin: ../build/firmware/armv7-none-eabihf/release/runtime llvm-objcopy -O binary ../build/firmware/armv7-none-eabihf/release/runtime ../build/runtime.bin -../build/firmware/armv7-none-eabihf/release/satman: ../build/pl.rs ../build/rustc-cfg ../build/mem.rs $(shell find . -print) +../build/firmware/armv7-none-eabihf/release/satman: ../build/pl.rs ../build/rustc-cfg ../build/mem.rs $(shell find . -type f -print) cd satman && \ XBUILD_SYSROOT_PATH=`pwd`/../../build/sysroot \ cargo xbuild --release \ From c4de1c261a723fe32f44d00de2aa2f8d2b620185 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 8 Oct 2021 15:13:56 +0200 Subject: [PATCH 3/6] default.nix: restored proper satellite variants --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 40ce07d..1c101ab 100644 --- a/default.nix +++ b/default.nix @@ -8,7 +8,7 @@ let vivado = import { inherit pkgs; }; # FSBL configuration supplied by Vivado 2020.1 for these boards: fsblTargets = ["zc702" "zc706" "zed"]; - sat_variants = ["acpki_satellite" "nist_clock_satellite" "nist_qc2_satellite"]; + sat_variants = ["satellite" "nist_clock_satellite" "nist_qc2_satellite"]; build = { target, variant, json ? null }: let szl = (import zynq-rs)."${target}-szl"; fsbl = import "${zynq-rs}/nix/fsbl.nix" { From 742ce9fddea2cbf1502a5f8675d912f0ed02e37c Mon Sep 17 00:00:00 2001 From: mwojcik Date: Fri, 8 Oct 2021 15:18:23 +0200 Subject: [PATCH 4/6] fix sd and acpki satellite builds --- default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index 1c101ab..d2dc606 100644 --- a/default.nix +++ b/default.nix @@ -8,7 +8,7 @@ let vivado = import { inherit pkgs; }; # FSBL configuration supplied by Vivado 2020.1 for these boards: fsblTargets = ["zc702" "zc706" "zed"]; - sat_variants = ["satellite" "nist_clock_satellite" "nist_qc2_satellite"]; + sat_variants = ["satellite" "nist_clock_satellite" "nist_qc2_satellite" "acpki_nist_clock_satellite" "acpki_nist_qc2_satellite"]; build = { target, variant, json ? null }: let szl = (import zynq-rs)."${target}-szl"; fsbl = import "${zynq-rs}/nix/fsbl.nix" { @@ -81,14 +81,14 @@ let bifdir=`mktemp -d` cd $bifdir ln -s ${szl}/szl.elf szl.elf - ln -s ${firmware}/runtime.elf runtime.elf + ln -s ${firmware}/${fwtype}.elf ${fwtype}.elf ln -s ${gateware}/top.bit top.bit cat > boot.bif << EOF the_ROM_image: { [bootloader]szl.elf top.bit - runtime.elf + ${fwtype}.elf } EOF mkdir $out $out/nix-support @@ -106,13 +106,13 @@ let cd $bifdir ln -s ${fsbl}/fsbl.elf fsbl.elf ln -s ${gateware}/top.bit top.bit - ln -s ${firmware}/runtime.elf runtime.elf + ln -s ${firmware}/${fwtype}.elf ${fwtype}.elf cat > boot.bif << EOF the_ROM_image: { [bootloader]fsbl.elf top.bit - runtime.elf + ${fwtype}.elf } EOF mkdir $out $out/nix-support From 3582af564d87d759cec1b772d0514425fbc097b9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 10 Oct 2021 20:40:29 +0800 Subject: [PATCH 5/6] runtime: expose rint from libm --- src/runtime/src/kernel/api.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/src/kernel/api.rs b/src/runtime/src/kernel/api.rs index 4d1868e..b8e91cb 100644 --- a/src/runtime/src/kernel/api.rs +++ b/src/runtime/src/kernel/api.rs @@ -254,6 +254,7 @@ pub fn resolve(required: &[u8]) -> Option { api_libm_f64f64!(log10), api_libm_f64f64f64!(nextafter), api_libm_f64f64f64!(pow), + api_libm_f64f64!(rint), api_libm_f64f64!(round), api_libm_f64f64!(sin), api_libm_f64f64!(sinh), From a5e3580d1896b03710fd89af9f91ce673897d36b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 11 Oct 2021 08:13:26 +0800 Subject: [PATCH 6/6] Revert "runtime: expose rint from libm" This reverts commit 3582af564d87d759cec1b772d0514425fbc097b9. --- src/runtime/src/kernel/api.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/runtime/src/kernel/api.rs b/src/runtime/src/kernel/api.rs index b8e91cb..4d1868e 100644 --- a/src/runtime/src/kernel/api.rs +++ b/src/runtime/src/kernel/api.rs @@ -254,7 +254,6 @@ pub fn resolve(required: &[u8]) -> Option { api_libm_f64f64!(log10), api_libm_f64f64f64!(nextafter), api_libm_f64f64f64!(pow), - api_libm_f64f64!(rint), api_libm_f64f64!(round), api_libm_f64f64!(sin), api_libm_f64f64!(sinh),