-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This also fixes up runner.sh for the new(ish) VPN layout.
- Loading branch information
1 parent
a8534a9
commit 3ae56d6
Showing
4 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Reference: | ||
# - https://doc.rust-lang.org/stable/clippy/continuous_integration/github_actions.html | ||
# - https://github.com/actions/starter-workflows/blob/main/ci/rust.yml | ||
on: push | ||
|
||
name: Clippy check | ||
|
||
# Make sure CI fails on all warnings, including Clippy lints | ||
env: | ||
RUSTFLAGS: "-Dwarnings" | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
clippy_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run fmt | ||
run: cargo fmt | ||
- name: Run Clippy | ||
run: cargo clippy --all-targets --all-features | ||
- name: Run tests | ||
run: cargo test --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,54 @@ | ||
Ensure rust is up to date: `rustup update` | ||
Install the cross toolchain: `rustup target add armv7-unknown-linux-gnueabihf` | ||
Install cargo-deb: `cargo install cargo-deb` | ||
# Virtual watchdog for the [OreSat C3](https://github.com/oresat/oresat-c3-hardware) | ||
|
||
If it complains about incompatible GLIBC versions consider using an older cross compiler toolchain | ||
https://github.com/abhiTronix/raspberry-pi-cross-compilers | ||
The C3 has a radiation tolerant watchdog circuit that will power cycle the whole satellite if it | ||
hasn't been pet in the last 24 seconds (36s on startup). A "pet" is the rising edge of the GPIO | ||
line `PET_WDT`. It should be kept high for a reasonable amount of time, at least ~10ms, but both | ||
the level and falling edge do not reset the timeout. `PET_WDT` is also attached to an LED so having | ||
a pattern that is pleasing to look at is a plus. | ||
|
||
This application provides software configurable interface to the watchdog hardware. Currently the | ||
two knobs are the initial inhibit time and ongoing reset time. It also provides a UDP interface | ||
instead of GPIO. This was initially written as a quick-to-start shim that can postpone the watchdog | ||
while more heavyweight processes (like [oresatd](https://github.com/oresat/oresat-c3-software)) | ||
start which can take a while, at one point it wasn't able to catch the hardware watchdog in time. | ||
|
||
```mermaid | ||
graph TD; | ||
A(Inhibit) --> B(Timeout); | ||
B --> C; | ||
C(Packet) --> B; | ||
C --> D(Quit); | ||
E(High) --> F(Low); | ||
F --> E; | ||
``` | ||
|
||
The watchdog listens on UDP localhost:20001 for any packet, which resets the timeout. The contents | ||
do not matter and are discarded. This currently doesn't do any kind of exclusion or voting which | ||
is part of more proper software watchdog system, leaving that for programs up the stack. | ||
|
||
## Building | ||
[Install Rust](https://www.rust-lang.org/tools/install) or ensure it is up to date: `rustup update` | ||
|
||
Build the program: `cargo b` | ||
|
||
### Cross compiling to run on the C3 | ||
The C3 is an ARM system so to run the watchdog in its produciton environment you'll need to install | ||
the cross toolchain: `rustup target add armv7-unknown-linux-gnueabihf` and add the `--target` flag | ||
to all cargo commands: | ||
|
||
Compile and run the watchdog: | ||
`cargo r --target armv7-unknown-linux-gnueabihf` | ||
|
||
Build a debian package: | ||
This will also execute `runner.sh`. This script is currently set up to run the watchdog on the | ||
[flatsat C3](https://github.com/oresat/oresat-flatsat) but you'll need to be connected to the | ||
OreSat VPN for this to work. This script could alternatively be modified to launch a local VM for | ||
local testing. | ||
|
||
If it complains about incompatible GLIBC versions consider using an older cross compiler toolchain | ||
[like this one](https://github.com/abhiTronix/raspberry-pi-cross-compilers), and set the linker in | ||
.cargo/config.toml | ||
|
||
### Build a debian package: | ||
Install cargo-deb: `cargo install cargo-deb` | ||
Version set in Cargo.toml. If doing a release be sure to also make a tag | ||
`cargo deb --target armv7-unknown-linux-gnueabihf` | ||
Package will be in `target/armv7-unknown-linux-gnueabihf/debian/` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters