This repository includes compile-time and runtime-time dependencies for interfacing Rust with F Prime running inside a Wasm interpreter.
| Crate | |
|---|---|
fprime-wasm |
The fprime-wasm command: scaffold a sequence project, add sequences, build and test them, size a module against the on-board interpreter |
fprime_test |
The #[fprime_test] DSL: run a sequence on spacewasm and check what it does |
fprime_core |
no_std runtime a sequence links against, and the guest side of the fprime_v1 host ABI |
fprime_build |
build.rs code generator, turning an F Prime JSON dictionary into a typed Rust API |
fprime_macros |
#[fprime_main] and the sequencing DSL |
fprime_dictionary |
Deserialisation of F Prime JSON dictionaries |
-
Install Rust: https://doc.rust-lang.org/cargo/getting-started/installation.html
-
Get the Wasm Rust target:
rustup target add wasm32v1-none- Install
fprime-wasm, which is all a sequence project needs. Withcargo binstallthis downloads a prebuilt binary from the releases; plaincargo installcompiles from source, which takes a few minutes:
cargo binstall fprime-wasm # prebuilt
cargo install fprime-wasm # from sourcePrebuilt binaries are published for Linux, macOS and Windows, each on x86_64
and aarch64. The Linux ones are static (musl), so they run on any
distribution. cargo binstall falls back to
building from source on anything else.
fprime-wasm carries its own wasm-opt, the binaryen release it was tested
with, and every release build runs it, never one on the PATH. The first
release build writes it out to the user cache directory. Set
SPACEWASM_WASM_OPT to the path of a different one to run that instead.
mkdir my-sequences && cd my-sequences
fprime-wasm init --fprime-version 4.4.0 # asks for the deployment's JSON dictionary
fprime-wasm test
fprime-wasm verifySee fprime_wasm/README.md for what init, add,
build, test, verify and backtrace do.
VS Code is the recommended editor for a generated sequences project.
Besides the six published crates, crates/ holds what exercises them:
| Crate | |
|---|---|
crates/example |
A small project against the Ref F Prime deployment |
crates/bench |
One sequence per command/telemetry/parameter shape |
crates/wasm_size |
Measures and compares the size of the sequences bench and example build |
example and bench build for wasm32v1-none behind a wasm feature, so a
host build of the workspace skips their sequence bins:
cargo build -p fprime-wasm # the linker the sequences build through
cargo test --workspace
cd crates/example
cargo build --release --features wasm.cargo/config.toml builds the sequences with this checkout's own
fprime-wasm, so build it first, and again after changing fprime_wasm or
fprime_test. The workspace targets the newest on-board interpreter.