Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

2 watching

Forks

Repository files navigation

F Prime Wasm

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

Installation

  1. Install Rust: https://doc.rust-lang.org/cargo/getting-started/installation.html

  2. Get the Wasm Rust target:

rustup target add wasm32v1-none
  1. Install fprime-wasm, which is all a sequence project needs. With cargo binstall this downloads a prebuilt binary from the releases; plain cargo install compiles from source, which takes a few minutes:
cargo binstall fprime-wasm   # prebuilt
cargo install fprime-wasm    # from source

Prebuilt 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.

Starting a project

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 verify

See 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.

This repository

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.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Contributors

Languages