Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a quick start to the book #202

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- [Terminology](overview/terminology.md)
- [Features](overview/features.md)

- [Quick start](quick/README.md)

- [Applet user guide](applet/README.md)
- [Setup](applet/setup.md)
- [Create a new applet](applet/create.md)
Expand Down
39 changes: 39 additions & 0 deletions book/src/quick/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Quick start

## Repository setup

Clone the repository and run the setup script:

```sh
git clone https://github.com/google/wasefire
cd wasefire
./scripts/setup.sh
```

The setup script is best effort. When possible, it will directly invoke
installation commands, possibly asking for sudo password. Otherwise, it will
return an error and print a message about the next manual step. Once the problem
is addressed, the script must be run again. The script will eventually return a
success code indicating that no manual step is required and everything seems in
order.

## Run an applet

If you don't have a Nordic board, you can run applets on your desktop:

```sh
cargo xtask applet assemblyscript hello runner host
```

If you have an nRF52840 dev-kit, you can also run applets on the board:

```sh
cargo xtask applet rust blink runner nordic
```

The general format is `cargo xtask applet LANGUAGE NAME runner BOARD`. Example
applets are listed in the `examples` directory by _language_ then _name_.
_Boards_ are listed under the `crates` directory and are prefixed by `runner-`.

Feel free to stop and play around by directly editing the examples. Or continue
reading for a deeper tutorial on how to write applets in Rust.
4 changes: 2 additions & 2 deletions crates/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::path::Path;
use std::process::{Command, Output};
use std::str::FromStr;

use anyhow::{ensure, Context, Result};
use anyhow::{bail, ensure, Context, Result};
use clap::Parser;
use lazy_static::lazy_static;
use probe_rs::config::TargetSelector;
Expand Down Expand Up @@ -257,7 +257,7 @@ impl AppletOptions {
match self.lang.as_str() {
"rust" => self.execute_rust(main),
"assemblyscript" => self.execute_assemblyscript(main),
_ => panic!("unsupported language"),
x => bail!("unsupported language {x}"),
}
}

Expand Down