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

Update espflash chapter #50

Closed
wants to merge 8 commits into from
Closed
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
9 changes: 5 additions & 4 deletions book.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
[book]
title = "The Rust on ESP Book"
description = "A comprehensive guide on using the Rust programming language with Espressif SoCs and modules"
title = "The Rust on ESP Book"
description = "A comprehensive guide on using the Rust programming language with Espressif SoCs and modules"
multilingual = false
language = "en"
language = "en"

[rust]
edition = "2018"

[output.html]
git-repository-url = "https://github.com/esp-rs/book"
additional-js = ["assets/mermaid.min.js", "assets/mermaid-init.js"]
additional-js = ["assets/mermaid.min.js", "assets/mermaid-init.js"]
edit-url-template = "https://github.com/esp-rs/book/edit/main/{path}"

[preprocessor.mermaid]
command = "mdbook-mermaid"
1 change: 0 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
- [Tooling](./tooling/index.md)
- [Text Editors and IDEs](./tooling/text-editors-and-ides.md)
- [espflash](./tooling/espflash.md)
- [espmonitor](./tooling/espmonitor.md)
- [Debugging](./tooling/debugging/index.md)
- [probe-rs](./tooling/debugging/probe-rs.md)
- [OpenOCD](./tooling/debugging/openocd.md)
Expand Down
2 changes: 1 addition & 1 deletion src/installation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Because there is no `Xtensa` support in the mainline Rust compiler you must use

[esp-rs/espup] is a tool for installing and maintaining the required ecosystem to develop applications in Rust for Espressif SoC's (both `Xtensa` and `RISC-V` targets).

`espup` takes care of installing the proper Rust compiler (our fork in case of `Xtensa` targets, and the `nightly` toolchain with the necessary target for `RISC-V` targets), `LLVM` toolchain, `GCC` toolchains, and many other things. For more details, [see Usage section of the `espup` Readme].
`espup` takes care of installing rustup, the proper Rust compiler (our fork in case of `Xtensa` targets, and the `nightly` toolchain with the necessary target for `RISC-V` targets), `LLVM` toolchain, `GCC` toolchains, and many other things. For more details, [see Usage section of the `espup` Readme].

In order to install `espup`:
```sh
Expand Down
40 changes: 23 additions & 17 deletions src/tooling/espflash.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,52 @@ A serial flasher utility for ESP devices. Supports flashing _ESP32_, _ESP32-C2_,

The [esp-rs/espflash] repository contains two crates, `cargo-espflash` and `espflash`. You can find more information on both of these in their respective sections below.

> #### A note on `espflash` and `cargo-espflash`.
>
> The `espflash` and `cargo-espflash` commands shown below, assume that version `2.0` or greater.

[esp-rs/espflash]: https://github.com/esp-rs/espflash

## cargo-espflash

Provides a subcommand for `cargo` which handles cross-compilation and flashing. Note that this requires the unstable `build-std` cargo feature; for more information on this please refer to [the cargo documentation].

To install:
Provides a subcommand for `cargo` that handles cross-compilation and flashing. Note that this requires the unstable `build-std` cargo feature; for more information on this please refer to [the cargo documentation].

```bash
cargo install cargo-espflash
```
See [Installation section of cargo-espflash README] for details on how to install it.

This command must be run within a Cargo project, ie.) a directory containing a `Cargo.toml` file. For example, to build an example named 'blinky' in `release` mode, flash the resulting binary to a device, and then subsequently start a serial monitor:

```bash
cargo espflash --example=blinky --release --monitor
cargo espflash flash --example=blinky --release --monitor
```

For more information please see to the [cargo-espflash README].
For more information about usage, please see [Usage section of cargo-espflash README].

[the cargo documentation]: https://doc.rust-lang.org/cargo/reference/unstable.html#build-std
[cargo-espflash readme]: https://github.com/esp-rs/espflash/blob/master/cargo-espflash/README.md
[Installation section of cargo-espflash README]: https://github.com/esp-rs/espflash/tree/main/cargo-espflash#installation
[Usage section of cargo-espflash README]: https://github.com/esp-rs/espflash/tree/main/cargo-espflash#usage

## espflash

Provides a standalone command-line application which flashes an ELF file to a device.
Provides a standalone command-line application that flashes an ELF file to a device.

To install:
See [Installation section of espflash README] for details on how to install it.

Assuming you have built an ELF binary by other means already, `espflash` can be used to download it to your device and monitor the serial port. For example, if you have built the `getting-started/blinky` example from [esp-idf] using `idf.py` you might run something like:

```bash
cargo install espflash
espflash flash build/blinky --monitor
```
See [Usage section of espflash README] for more details and other commands.

Assuming you have built an ELF binary by other means already, `espflash` can be used to download it to your device. For example, if you have built the `getting-started/blinky` example from [esp-idf] using `idf.py` you might run something like:

```bash
espflash build/blinky
`espflash` can be used as a Cargo runner by adding the following to your project's `.cargo/config.toml` file:
```toml
[target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))']
runner = "espflash flash --monitor"
```
With this configuration you can flash and monitor you application using `cargo run`.

For more information please see to the [espflash README].

[Installation section of espflash README]: https://github.com/esp-rs/espflash/tree/main/espflash#installation
[esp-idf]: https://github.com/espressif/esp-idf
[espflash readme]: https://github.com/esp-rs/espflash/blob/master/espflash/README.md
[Usage section of espflash README]: https://github.com/esp-rs/espflash/tree/main/espflash#usage
17 changes: 0 additions & 17 deletions src/tooling/espmonitor.md

This file was deleted.