diff --git a/.github/workflows/hitl.yml b/.github/workflows/hitl.yml index f59e8d2..b8611d4 100644 --- a/.github/workflows/hitl.yml +++ b/.github/workflows/hitl.yml @@ -1,9 +1,9 @@ name: HITL on: - push: - branches: [ hitl ] workflow_dispatch: + pull_request: + branches: [ master ] jobs: hitl: diff --git a/Cargo.lock b/Cargo.lock index d203a3c..3aa8999 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ad9959" version = "0.1.0" @@ -36,7 +38,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9a69a963b70ddacfcd382524f72a4576f359af9334b3bf48a79566590bb8bfa" dependencies = [ "bitrate", - "cortex-m 0.7.1", + "cortex-m 0.7.2", "embedded-hal", ] @@ -87,9 +89,9 @@ checksum = "c147d86912d04bef727828fda769a76ca81629a46d8ba311a8d58a26aa91473d" [[package]] name = "byteorder" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" @@ -115,15 +117,15 @@ dependencies = [ "aligned", "bare-metal 0.2.5", "bitfield", - "cortex-m 0.7.1", + "cortex-m 0.7.2", "volatile-register", ] [[package]] name = "cortex-m" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0b756a8bffc56025de45218a48ff9b801180440c0ee49a722b32d49dcebc771" +checksum = "643a210c1bdc23d0db511e2a576082f4ff4dcae9d0c37f50b431b8f8439d6d6b" dependencies = [ "bare-metal 0.2.5", "bitfield", @@ -137,7 +139,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e202d2eac4e34adf7524a563e36623bae6f69cc0a73ef9bd22a4c93a5a806fa" dependencies = [ - "cortex-m 0.7.1", + "cortex-m 0.7.2", "cortex-m-semihosting", "log", ] @@ -195,13 +197,13 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bffa6c1454368a6aa4811ae60964c38e6996d397ff8095a8b9211b1c1f749bc" dependencies = [ - "cortex-m 0.7.1", + "cortex-m 0.7.2", ] [[package]] name = "derive_miniconf" version = "0.1.0" -source = "git+https://github.com/quartiq/miniconf.git?branch=develop#314fa5587d1aa28e1ad70106f19e30db646e9f28" +source = "git+https://github.com/quartiq/miniconf.git?rev=314fa5587d#314fa5587d1aa28e1ad70106f19e30db646e9f28" dependencies = [ "proc-macro2", "quote", @@ -359,9 +361,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" dependencies = [ "autocfg", "hashbrown", @@ -369,9 +371,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.86" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" +checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" [[package]] name = "libm" @@ -390,15 +392,15 @@ dependencies = [ [[package]] name = "managed" -version = "0.8.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" +checksum = "c75de51135344a4f8ed3cfe2720dc27736f7711989703a0b43aadf3753c55577" [[package]] name = "matrixmultiply" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916806ba0031cd542105d916a97c8572e1fa6dd79c9c51e7eb43a09ec2dd84c1" +checksum = "1300bdbea33ec2836b01ff1f5a6eed8bad66d0c31f94d9b7993407a8b054c3a1" dependencies = [ "rawpointer", ] @@ -406,7 +408,7 @@ dependencies = [ [[package]] name = "mcp23017" version = "0.1.1" -source = "git+https://github.com/mrd0ll4r/mcp23017.git#61933f857abe5a837800493a5f58e91a3c9435ec" +source = "git+https://github.com/mrd0ll4r/mcp23017.git?rev=61933f857a#61933f857abe5a837800493a5f58e91a3c9435ec" dependencies = [ "embedded-hal", ] @@ -414,7 +416,7 @@ dependencies = [ [[package]] name = "miniconf" version = "0.1.0" -source = "git+https://github.com/quartiq/miniconf.git?branch=develop#314fa5587d1aa28e1ad70106f19e30db646e9f28" +source = "git+https://github.com/quartiq/miniconf.git?rev=314fa5587d#314fa5587d1aa28e1ad70106f19e30db646e9f28" dependencies = [ "derive_miniconf", "heapless 0.6.1", @@ -426,7 +428,7 @@ dependencies = [ [[package]] name = "minimq" version = "0.2.0" -source = "git+https://github.com/quartiq/minimq.git#933687c2e4bc8a4d972de9a4d1508b0b554a8b38" +source = "git+https://github.com/quartiq/minimq.git?rev=933687c2e4b#933687c2e4bc8a4d972de9a4d1508b0b554a8b38" dependencies = [ "bit_field", "embedded-nal", @@ -452,9 +454,9 @@ checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" [[package]] name = "ndarray" -version = "0.14.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c0d5c9540a691d153064dc47a4db2504587a75eae07bf1d73f7a596ebc73c04" +checksum = "cc1372704f14bb132a49a6701c2238970a359ee0829fed481b522a63bf25456a" dependencies = [ "matrixmultiply", "num-complex", @@ -471,9 +473,9 @@ checksum = "2178127478ae4ee9be7180bc9c3bffb6354dd7238400db567102f98c413a9f35" [[package]] name = "num" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ "num-complex", "num-integer", @@ -484,9 +486,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085" dependencies = [ "num-traits", ] @@ -514,9 +516,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" dependencies = [ "autocfg", "num-integer", @@ -538,7 +540,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d55dedd501dfd02514646e0af4d7016ce36bc12ae177ef52056989966a1eec" dependencies = [ - "cortex-m 0.7.1", + "cortex-m 0.7.2", "cortex-m-semihosting", ] @@ -556,9 +558,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid", ] @@ -667,9 +669,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" +checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" dependencies = [ "serde_derive", ] @@ -677,7 +679,7 @@ dependencies = [ [[package]] name = "serde-json-core" version = "0.2.0" -source = "git+https://github.com/rust-embedded-community/serde-json-core.git?branch=master#ee06ac91bc43b72450a92198a00d9e5c5b9946d2" +source = "git+https://github.com/rust-embedded-community/serde-json-core.git?rev=ee06ac91bc#ee06ac91bc43b72450a92198a00d9e5c5b9946d2" dependencies = [ "heapless 0.5.6", "serde", @@ -685,9 +687,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.124" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" +checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" dependencies = [ "proc-macro2", "quote", @@ -696,8 +698,9 @@ dependencies = [ [[package]] name = "smoltcp" -version = "0.7.0" -source = "git+https://github.com/smoltcp-rs/smoltcp.git#1bff999a6f3f7adf623d837ea96cc807e1b3a470" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97173c1ef35b0a09304cb3882eba594761243005847cbbf6124f966e8da6519a" dependencies = [ "bitflags", "byteorder", @@ -748,24 +751,25 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stm32h7" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7571f17d1ed7d67957d0004de6c52bd1ef5e736ed5ddc2bcecf001512269f77c" +checksum = "8b672c837e0ee8158ecc7fce0f9a948dd0693a9c588338e728d14b73307a0b7d" dependencies = [ "bare-metal 0.2.5", - "cortex-m 0.6.7", + "cortex-m 0.7.2", "cortex-m-rt", "vcell", ] [[package]] name = "stm32h7xx-hal" -version = "0.8.0" -source = "git+https://github.com/stm32-rs/stm32h7xx-hal?branch=master#08231e334a11236fe556668ac19cb1c214da2406" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67034b80041bc33a48df1c1c435b6ae3bb18c35e42aa7e702ce8363b96793398" dependencies = [ "bare-metal 1.0.0", "cast", - "cortex-m 0.6.7", + "cortex-m 0.7.2", "cortex-m-rt", "embedded-dma", "embedded-hal", @@ -778,9 +782,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.60" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" dependencies = [ "proc-macro2", "quote", @@ -789,9 +793,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "unicode-xid" @@ -807,9 +811,9 @@ checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" [[package]] name = "version_check" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "void" @@ -831,3 +835,8 @@ name = "wasi" version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[patch.unused]] +name = "smoltcp" +version = "0.7.0" +source = "git+https://github.com/smoltcp-rs/smoltcp.git#09f941851ded868b759e7db067abd67f2fe136a6" diff --git a/Cargo.toml b/Cargo.toml index fe610d5..144444f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,35 +43,35 @@ enum-iterator = "0.6.0" paste = "1" dsp = { path = "dsp" } ad9959 = { path = "ad9959" } -smoltcp-nal = "0.1.0" -miniconf = "0.1" generic-array = "0.14" +miniconf = "0.1.0" + +[dependencies.mcp23017] +git = "https://github.com/mrd0ll4r/mcp23017.git" +rev = "61933f857a" + +[dependencies.stm32h7xx-hal] +features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"] +version = "0.9.0" [patch.crates-io.miniconf] git = "https://github.com/quartiq/miniconf.git" -branch = "develop" +rev = "314fa5587d" -[patch.crates-io.minimq] -git = "https://github.com/quartiq/minimq.git" - -[patch.crates-io.smoltcp-nal] +[dependencies.smoltcp-nal] git = "https://github.com/quartiq/smoltcp-nal.git" branch = "feature/reset-support" -[patch.crates-io.serde-json-core] -git = "https://github.com/rust-embedded-community/serde-json-core.git" -branch = "master" +[patch.crates-io.minimq] +git = "https://github.com/quartiq/minimq.git" +rev = "933687c2e4b" [patch.crates-io.smoltcp] git = "https://github.com/smoltcp-rs/smoltcp.git" -[dependencies.mcp23017] -git = "https://github.com/mrd0ll4r/mcp23017.git" - -[dependencies.stm32h7xx-hal] -features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"] -git = "https://github.com/stm32-rs/stm32h7xx-hal" -branch = "master" +[patch.crates-io.serde-json-core] +git = "https://github.com/rust-embedded-community/serde-json-core.git" +rev = "ee06ac91bc" [features] semihosting = ["panic-semihosting", "cortex-m-log/semihosting"] diff --git a/README.md b/README.md index 19b5a0d..4250d6a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![QUARTIQ Matrix Chat](https://img.shields.io/matrix/quartiq:matrix.org)](https://matrix.to/#/#quartiq:matrix.org) +[![Continuous Integration](https://github.com/quartiq/stabilizer/actions/workflows/ci.yml/badge.svg)](https://github.com/quartiq/stabilizer/actions/workflows/ci.yml) [![HITL (private)](https://github.com/quartiq/hitl/workflows/Stabilizer/badge.svg)](https://github.com/quartiq/hitl/actions?query=workflow%3AStabilizer) # Stabilizer Firmware diff --git a/cargosha256-dual-iir.nix b/cargosha256-dual-iir.nix index d58968f..2d89c3a 100644 --- a/cargosha256-dual-iir.nix +++ b/cargosha256-dual-iir.nix @@ -1 +1 @@ -"138kpxzxs73zhmd4xi5kw3fddb05gac4mpngizm01831n1ycyhl0" +"06qsl59bljr637xcrplbij7ma8l7waryi4lkbd4fxjac0gqpn55s" diff --git a/dsp/Cargo.toml b/dsp/Cargo.toml index 4c675ff..7b680d3 100644 --- a/dsp/Cargo.toml +++ b/dsp/Cargo.toml @@ -8,13 +8,13 @@ edition = "2018" libm = "0.2.1" serde = { version = "1.0", features = ["derive"], default-features = false } generic-array = "0.14" -num = { version = "0.3.1", default-features = false } +num = { version = "0.4.0", default-features = false } miniconf = "0.1" [dev-dependencies] easybench = "1.0" rand = "0.8" -ndarray = "0.14" +ndarray = "0.15" [[bench]] name = "micro" diff --git a/hitl/README.md b/hitl/README.md new file mode 100644 index 0000000..629b587 --- /dev/null +++ b/hitl/README.md @@ -0,0 +1,25 @@ +# Stabilizer HITL Testing + +This directory contains tooling required for Stabilizer hardware-in-the-loop (HITL) testing. + +There is a `Stabilizer` board connected at the Quartiq office that is accessible via a private HITL +repository in order to provide secure hardware testing of the stabilizer application in a public +repository. + +**Note**: In order to ensure application security, all HITL runs must first be approved by a Quartiq +representative before execution. + +# Configuration +* Stabilizer is configured with an ethernet connection to a router. The router runs a DHCP server for +the local network, and ensures that the Stabilizer used for these tests is available under the hostname `stabilizer-hitl`. +* An MQTT broker is running at the hostname `mqtt`. + +# HITL Workflow +The private HITL repository does the following: + +1. Check out this repository +2. Build firmware images using Cargo +3. Program stabilizer +4. Execute `hitl/run.sh` + +In order to add new HITL tests, update `run.sh` to include the necessary tests. diff --git a/hitl/run.sh b/hitl/run.sh new file mode 100755 index 0000000..a01a472 --- /dev/null +++ b/hitl/run.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Title: +# Stabilizer hardware-in-the-loop (HITL) test script. +# +# Description: +# This shell file is executed by the hardware runner in Quartiq's office to exercise the various +# hardware aspects of Stabilizer. + +# Enable shell operating mode flags. +set -eux + +# Set up python for testing +python3 -m venv --system-site-packages py +. py/bin/activate +python3 -m pip install -r requirements.txt + +# Test pinging Stabilizer. This exercises that: +# * DHCP is functional and an IP has been acquired +# * Stabilizer's network is functioning as intended +# * The stabilizer application is operational +ping -c 5 -w 20 stabilizer-hitl + +# Test the MQTT interface. +python3 miniconf.py dt/sinara/stabilizer afe/0 '"G2"' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a3d7fef --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +gmqtt diff --git a/src/hardware/pounder/mod.rs b/src/hardware/pounder/mod.rs index 0497a37..32a8e80 100644 --- a/src/hardware/pounder/mod.rs +++ b/src/hardware/pounder/mod.rs @@ -231,14 +231,16 @@ impl ad9959::Interface for QspiInterface { }; self.qspi - .write(encoded_address, &encoded_payload) + .write(encoded_address.into(), &encoded_payload) .map_err(|_| Error::Qspi) } ad9959::Mode::FourBitSerial => { if self.streaming { Err(Error::Qspi) } else { - self.qspi.write(addr, data).map_err(|_| Error::Qspi)?; + self.qspi + .write(addr.into(), data) + .map_err(|_| Error::Qspi)?; Ok(()) } } @@ -257,7 +259,7 @@ impl ad9959::Interface for QspiInterface { } self.qspi - .read(0x80_u8 | addr, dest) + .read((0x80_u8 | addr).into(), dest) .map_err(|_| Error::Qspi) } }