Skip to content

Commit

Permalink
Add a quick start to the book (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 authored Aug 17, 2023
1 parent 13f0115 commit fd5beee
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
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

0 comments on commit fd5beee

Please sign in to comment.