mcu: temporarily roll back Stabilizer to pre-MQTT, & generate all variants #59

Merged
sb10q merged 5 commits from harry/nix-scripts:fix-mcu into master 2021-07-02 16:30:02 +08:00

This PR will temporarily roll back Stabilizer to the last master commit before it is switched to MQTT (with DHCP for addressing the client but not the broker), as well as enable generation of all the available variants of the repo, namely dual-iir, lockin-external, lockin-internal, and a Pounder v1.1 version per item.

Here, the temporary fix uses a branch on my own Stabilizer fork (https://github.com/HarryMakes/stabilizer/tree/pre-mqtt), which reverts the cargosha256.nix file back to original and updates the hash. This change was made hand-in-hand with this PR, where the name of the Cargo vendor directory can now be independent of the variant, and is now the same per firmware repo (i.e. stabilizer for all Stabilizer variants). The cargoSha256 checksum is still dependent on the directory name because it is calculated from the tarball archiving the directory.

This branch on my fork also fixes some Git entries on Cargo.toml and Cargo.lock which would have prevented cargo vendor from correctly fetching the dependencies. Mainly, either the problematic entries specified branch rather than rev, or they pointed to detached HEADs on the GitHub server.

In addition, buildStm32Firmware now accepts an optional doCheck since firmware usually does not run any test with std. It is true by default, and is set to false on Stabilizer variants. See the NixOS manual for reference: https://nixos.org/manual/nixpkgs/stable/#cross-compilation. It appears that Thermostat runs a number of #[test] that might not be exclusive to the STM32 platforms, but in its checkPhase Cargo runs the tests on the build platform (x86_64-unknown-linux-gnu) rather than host/target, as indicated by the nix-build output: (maybe the Mozilla overlay doesn't take care of stdenv.targetPlatform?)

...
   Compiling stm32f4xx-hal v0.8.3 (https://github.com/astro/stm32f4xx-hal.git?branch=flash#9171ef17)
   Compiling stm32-eth v0.2.0 (https://github.com/stm32-rs/stm32-eth.git#4d6b29bf)
    Finished test [unoptimized + debuginfo] target(s) in 39.74s
     Running target/x86_64-unknown-linux-gnu/debug/deps/thermostat-29f6d02778c919d1

running 28 tests
test command_parser::test::parse_center_point_vref ... ok
test command_parser::test::parse_ipv4 ... ok
...

To build various binaries for the same firmware, this PR introduces a simple function using lib attribute mapping capabilities. As this is my first time contributing such code, I will highly appreciate any feedbacks.

This PR will temporarily roll back Stabilizer to the last master commit before it is switched to MQTT (with DHCP for addressing the client but not the broker), as well as enable generation of all the available variants of the repo, namely `dual-iir`, `lockin-external`, `lockin-internal`, and a Pounder v1.1 version per item. Here, the temporary fix uses a branch on my own Stabilizer fork (https://github.com/HarryMakes/stabilizer/tree/pre-mqtt), which reverts the cargosha256.nix file back to original and updates the hash. This change was made hand-in-hand with this PR, where the name of the Cargo vendor directory can now be independent of the variant, and is now the same per firmware repo (i.e. `stabilizer` for all Stabilizer variants). The `cargoSha256` checksum is still dependent on the directory name because it is calculated from the tarball archiving the directory. This branch on my fork also fixes some Git entries on Cargo.toml and Cargo.lock which would have prevented `cargo vendor` from correctly fetching the dependencies. Mainly, either the problematic entries specified `branch` rather than `rev`, or they pointed to detached HEADs on the GitHub server. In addition, `buildStm32Firmware` now accepts an optional `doCheck` since firmware usually does not run any test with `std`. It is `true` by default, and is set to `false` on Stabilizer variants. See the NixOS manual for reference: https://nixos.org/manual/nixpkgs/stable/#cross-compilation. It appears that Thermostat runs a number of `#[test]` that might not be exclusive to the STM32 platforms, but in its `checkPhase` Cargo runs the tests on the **build** platform (x86_64-unknown-linux-gnu) rather than **host/target**, as indicated by the nix-build output: (maybe the Mozilla overlay doesn't take care of `stdenv.targetPlatform`?) ``` ... Compiling stm32f4xx-hal v0.8.3 (https://github.com/astro/stm32f4xx-hal.git?branch=flash#9171ef17) Compiling stm32-eth v0.2.0 (https://github.com/stm32-rs/stm32-eth.git#4d6b29bf) Finished test [unoptimized + debuginfo] target(s) in 39.74s Running target/x86_64-unknown-linux-gnu/debug/deps/thermostat-29f6d02778c919d1 running 28 tests test command_parser::test::parse_center_point_vref ... ok test command_parser::test::parse_ipv4 ... ok ... ``` To build various binaries for the same firmware, this PR introduces a simple function using lib attribute mapping capabilities. As this is my first time contributing such code, I will highly appreciate any feedbacks.
harry force-pushed fix-mcu from 44ac0a985d to a00537688c 2021-07-02 16:16:10 +08:00 Compare
sb10q merged commit a00537688c into master 2021-07-02 16:30:02 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nix-scripts#59
There is no content yet.