Skip to content

Commit

Permalink
docs: Apply latest vale lints (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez authored Aug 10, 2023
1 parent ec65d05 commit f739bbe
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- [Writing `std` Applications](./writing-your-own-application/std.md)
- [Tooling](./tooling/index.md)
- [Visual Studio Code](./tooling/visual-studio-code.md)
- [espflash](./tooling/espflash.md)
- [`espflash`](./tooling/espflash.md)
- [Debugging](./tooling/debugging/index.md)
- [probe-rs](./tooling/debugging/probe-rs.md)
- [OpenOCD](./tooling/debugging/openocd.md)
Expand Down
4 changes: 2 additions & 2 deletions src/installation/riscv-and-xtensa.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ On Unix-based systems (`$HOME/export-esp.sh`). There are different ways of sourc
1. Add the content of `$HOME/export-esp.sh` to your shell’s profile: `cat $HOME/export-esp.sh >> [path to profile]`, for example, `cat $HOME/export-esp.sh >> ~/.bashrc`.
2. Refresh the configuration by restarting the terminal session or by running `source [path to profile]`, for example, `source ~/.bashrc`.

This approach **does not** require any sourcing. The `export-esp.sh` script will be sourced automatically in every shell.
This approach **doesn't** require any sourcing. The `export-esp.sh` script will be sourced automatically in every shell.

### What `espup` Installs

Expand Down Expand Up @@ -74,7 +74,7 @@ If you run into an error, please, check the [Troubleshooting][troubleshooting] c
### Other Installation Methods for `Xtensa` Targets

- Using [`rust-build`][rust-build] installation scripts. This was the recommended way in the past, but now the installation scripts are feature frozen, and all new features will only be included in `espup`. See the repository README for instructions.
- Building the Rust compiler with `Xtensa` support from source. This process is computationally expensive and can take one or more hours to complete depending on your system. It is not recommended unless there is a major reason to go for this approach. Here is the repository to build it from source: [`esp-rs/rust` repository][esp-rs-rust].
- Building the Rust compiler with `Xtensa` support from source. This process is computationally expensive and can take one or more hours to complete depending on your system. It isn't recommended unless there is a major reason to go for this approach. Here is the repository to build it from source: [`esp-rs/rust` repository][esp-rs-rust].

[rust-build]: https://github.com/esp-rs/rust-build#download-installer-in-bash
[esp-rs-rust]: https://github.com/esp-rs/rust
4 changes: 2 additions & 2 deletions src/installation/riscv.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ To build Rust applications for the Espressif chips based on `RISC-V` architectur

- For `std` applications:

Since this target is currently [Tier 3][rust-lang-book--platform-support-tier3], it does not have pre-built objects distributed through `rustup` and, unlike the `no_std` target, **nothing needs to be installed**. Refer to the [*-esp-idf][rust-lang-book--platform-support--esp-idf] section of the rustc book for the correct target for your device.
Since this target is currently [Tier 3][rust-lang-book--platform-support-tier3], it doesn't have pre-built objects distributed through `rustup` and, unlike the `no_std` target, **nothing needs to be installed**. Refer to the [*-esp-idf][rust-lang-book--platform-support--esp-idf] section of the rustc book for the correct target for your device.
- `riscv32imc-esp-espidf` for SoCs which do not support atomics, like ESP32-C2 and ESP32-C3
- `riscv32imc-esp-espidf` for SoCs which don't support atomics, like ESP32-C2 and ESP32-C3
- `riscv32imac-esp-espidf` for SoCs which support atomics, like ESP32-C6, ESP32-H2, and ESP32-P4
3. To build `std` projects, you also need to install:
- [`LLVM`][llvm-website] compiler infrastructure
Expand Down
2 changes: 1 addition & 1 deletion src/installation/std-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Regardless of the target architecture, make sure you have the following required
cargo install ldproxy
```

The `std` runtime uses [ESP-IDF][esp-idf-github] (Espressif IoT Development Framework) as hosted environment but, users do not need to install it. ESP-IDF is automatically downloaded and installed by [esp-idf-sys][esp-idf-sys-github], a crate that all `std` projects need to use, when building a `std` application.
The `std` runtime uses [ESP-IDF][esp-idf-github] (Espressif IoT Development Framework) as hosted environment but, users don't need to install it. ESP-IDF is automatically downloaded and installed by [esp-idf-sys][esp-idf-sys-github], a crate that all `std` projects need to use, when building a `std` application.
[rust-esp-book-overview-std]: ../overview/using-the-standard-library.md
[python-website-download]: https://www.python.org/downloads/
Expand Down
10 changes: 5 additions & 5 deletions src/installation/using-containers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using Containers

Instead of installing directly on your local system, you can host the development environment inside a container. Espressif provides the [idf-rust] image that supports both `RISC-V` and `Xtensa` target architectures and enables both `std` and `no_std` development.
Instead of installing directly on your local system, you can host the development environment inside a container. Espressif provides the [`idf-rust`][idf-rust] image that supports both `RISC-V` and `Xtensa` target architectures and enables both `std` and `no_std` development.

You can find numerous tags for `linux/arm64`, and `linux/amd64` platforms.

Expand All @@ -14,9 +14,9 @@ There are special cases:
- `<chip>` can be `all` which indicates compatibility with all Espressif targets
- `<rust-toolchain-version>` can be `latest` which indicates the latest release of the `Xtensa` Rust toolchain

Depending on your operating system, you can choose any container runtime, such as [Docker], [Podman], or [Lima].
Depending on your operating system, you can choose any container runtime, such as [Docker][docker], [Podman][podman], or [Lima][lima].

[Docker]: https://www.docker.com/
[Podman]: https://podman.io/
[Lima]: https://github.com/lima-vm/lima
[docker]: https://www.docker.com/
[podman]: https://podman.io/
[lima]: https://github.com/lima-vm/lima
[idf-rust]: https://hub.docker.com/r/espressif/idf-rust/tags
4 changes: 2 additions & 2 deletions src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ If you are unfamiliar or less experienced with anything mentioned above, or if y

| Resource | Description |
| -------------------------------------------- | ------------------------------------------------------------------------------------ |
| [The Rust Programming Language][rust-book] | If you are not familiar with Rust we recommend reading this book first. |
| [The Rust Programming Language][rust-book] | If you aren't familiar with Rust we recommend reading this book first. |
| [The Embedded Rust Book][embedded-rust-book] | Here you can find several other resources provided by Rust's Embedded Working Group. |
| [The Embedonomicon][embedonomicon] | The nitty-gritty details when doing embedded programming in Rust. |
| [Embedded Rust on Espressif][std-training] | Training material created in cooperation with [Ferrous Systems][ferrous-systems]. |
Expand All @@ -60,7 +60,7 @@ This book assumes that you are reading it front-to-back. Content covered in late

The work on this book is coordinated in [this repository][book-repository].

If you have trouble following the instructions in this book or find that some section of the book is not clear enough, then that's a bug. Please report it in [the issue tracker][book-issues] of this book.
If you have trouble following the instructions in this book or find that some section of the book isn't clear enough, then that's a bug. Please report it in [the issue tracker][book-issues] of this book.

Pull requests fixing typos and adding new content are welcome!

Expand Down
26 changes: 13 additions & 13 deletions src/misc/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ error: linker `ldproxy` not found
= note: No such file or directory (os error 2)
```

If you are trying to build a `std` application [`ldproxy`] must be installed. See [`std` Development Requirements][rust-esp-book-std-requirements]
If you are trying to build a `std` application [`ldproxy`][ldproxy] must be installed. See [`std` Development Requirements][rust-esp-book-std-requirements]

```shell
cargo install ldproxy
```

[`ldproxy`]: https://github.com/esp-rs/embuild/tree/master/ldproxy
[ldproxy]: https://github.com/esp-rs/embuild/tree/master/ldproxy
[rust-esp-book-std-requirements]: ./../installation/std-requirements.md

## Using the Wrong Rust Toolchain
Expand All @@ -44,23 +44,23 @@ Caused by:
```

If you are encountering the previous error or a similar one, you are probably not using the proper Rust toolchain. Remember that for `Xtensa` targets, you need to use Espressif Rust fork toolchain, there are several ways to do it:
- A [toolchain override] shorthand used on the command-line: `cargo +esp`.
- A [toolchain override][toolchain-override] shorthand used on the command-line: `cargo +esp`.
- Set `RUSTUP_TOOLCHAIN` environment variable to `esp`.
- Set a [directory override]: `rustup override set esp`
- Add a [rust-toolchain.toml] file to you project:
- Set a [directory override][directory-override]: `rustup override set esp`
- Add a [`rust-toolchain.toml`][rust-toolchain-toml] file to you project:
```toml
[toolchain]
channel = "esp"
```
- Set `esp` as [default toolchain].
- Set `esp` as [default toolchain][default-toolchain].

For more information on toolchain overriding, see the [Overrides chapter of The rustup book].
For more information on toolchain overriding, see the [Overrides chapter][overrides-rust-book] of The rustup book.

[toolchain override]: https://rust-lang.github.io/rustup/overrides.html#toolchain-override-shorthand
[directory override]: https://rust-lang.github.io/rustup/overrides.html#directory-overrides
[rust-toolchain.toml]: https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file
[default toolchain]: https://rust-lang.github.io/rustup/overrides.html#default-toolchain
[Overrides chapter of The rustup book]: https://rust-lang.github.io/rustup/overrides.html#overrides
[toolchain-override]: https://rust-lang.github.io/rustup/overrides.html#toolchain-override-shorthand
[directory-override]: https://rust-lang.github.io/rustup/overrides.html#directory-overrides
[rust-toolchain-toml]: https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file
[default-toolchain]: https://rust-lang.github.io/rustup/overrides.html#default-toolchain
[overrides-rust-book]: https://rust-lang.github.io/rustup/overrides.html#overrides

## Windows

Expand Down Expand Up @@ -89,7 +89,7 @@ warning: build failed, waiting for other jobs to finish...
error: build failed
```

The reason for this error is that we are missing the MSVC C++, hence we are not meeting the [Compile-time Requirements], please install [Visual Studio 2013 (or later) or the Visual C++ Build Tools 2019]. For Visual Studio, make sure to check the "C++ tools" and "Windows 10 SDK" options.
The reason for this error is that we are missing the MSVC C++, hence we aren't meeting the [Compile-time Requirements]. Please, install [Visual Studio 2013 (or later) or the Visual C++ Build Tools 2019]. For Visual Studio, make sure to check the "C++ tools" and "Windows 10 SDK" options.
If using GNU ABI, install [MinGW/MSYS2 toolchain].

[Compile-time Requirements]: https://github.com/rust-lang/cc-rs#compile-time-requirements
Expand Down
4 changes: 2 additions & 2 deletions src/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ In the [esp-rs organization], we use the following wording:
>
> - ✅ - The feature is implemented or supported
> - ⏳ - The feature is under development
> - ❌ - The feature is not supported
> - ❌ - The feature isn't supported
| Chip | `std` | `no_std` |
| -------- | :---: | :------: |
Expand All @@ -49,6 +49,6 @@ In the [esp-rs organization], we use the following wording:
| ESP8266 |||

> ⚠️ **Note**: The ESP8266 series is outside the scope of this book. Rust support for the
> ESP8266 series is limited and is not being officially supported by Espressif.
> ESP8266 series is limited and isn't being officially supported by Espressif.
The products supported in certain circumstances will be called _supported Espressif products_ throughout the book.
4 changes: 2 additions & 2 deletions src/overview/using-the-core-library.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Using the Core Library (`no_std`)

Using `no_std` may be more familiar to embedded Rust developers. It does not use `std` (the Rust [`standard`][rust-lib-std] library) but instead uses a subset, the [`core`][rust-lib-core] library. [The Embedded Rust Book][embedded-rust-book] has a great [section][embedded-rust-book-no-std] on this.
Using `no_std` may be more familiar to embedded Rust developers. It doesn't use `std` (the Rust [`standard`][rust-lib-std] library) but instead uses a subset, the [`core`][rust-lib-core] library. [The Embedded Rust Book][embedded-rust-book] has a great [section][embedded-rust-book-no-std] on this.

It is important to note that `no_std` uses the Rust `core` library. As this library is part of the Rust `standard` library, a `no_std` crate can compile in `std` environment. However, the opposite is not true: an `std` crate can't compile in `no_std` environment. This information is worth remembering when deciding which library to choose.
It is important to note that `no_std` uses the Rust `core` library. As this library is part of the Rust `standard` library, a `no_std` crate can compile in `std` environment. However, the opposite isn't true: an `std` crate can't compile in `no_std` environment. This information is worth remembering when deciding which library to choose.

[embedded-rust-book]: https://docs.rust-embedded.org/
[embedded-rust-book-no-std]: https://docs.rust-embedded.org/book/intro/no-std.html
Expand Down
2 changes: 1 addition & 1 deletion src/overview/using-the-standard-library.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using the Standard Library (`std`)

Espressif provides a C-based development framework called [ESP-IDF][esp-idf-github]. It has, or will have, support for all Espressif chips starting with the ESP32, note that this framework does _not_ support the ESP8266.
Espressif provides a C-based development framework called [ESP-IDF][esp-idf-github]. It has, or will have, support for all Espressif chips starting with the ESP32, note that this framework _doesnn't_ support the ESP8266.

ESP-IDF, in turn, provides a [newlib][newlib-env] environment with enough functionality to build the Rust standard library (`std`) on top of it. This is the approach that is being taken to enable `std` support on Epressif devices.

Expand Down
2 changes: 1 addition & 1 deletion src/tooling/debugging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Debugging Rust applications is also possible using different tools that will be

Refer to the table below to see which chip is supported in every debugging method:

| | **probe-rs** | **openOCD** | **VS Code** |
| | **probe-rs** | **OpenOCD** | **VS Code** |
| :----------: | :----------: | :---------: | :---------: |
| **ESP32** ||||
| **ESP32-C2** ||||
Expand Down
2 changes: 1 addition & 1 deletion src/tooling/debugging/openocd.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# OpenOCD

Similar to [probe-rs][probe-rs], OpenOCD does not have support for the `Xtensa` architecture. However, Espressif does maintain a fork of OpenOCD under [espressif/openocd-esp32][espressif-openocd-esp32] which has support for Espressif's chips.
Similar to [`probe-rs`][probe-rs], OpenOCD doesn't have support for the `Xtensa` architecture. However, Espressif does maintain a fork of OpenOCD under [espressif/openocd-esp32][espressif-openocd-esp32] which has support for Espressif's chips.

Instructions on how to install `openocd-esp32` for your platform can be found in [the Espressif documentation][espressif-documentation].

Expand Down
4 changes: 2 additions & 2 deletions src/tooling/espflash.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Assuming you have built an ELF binary by other means already, `espflash` can be
espflash flash build/blinky --monitor
```

For more information, please see the [espflash README].
For more information, please see the [`espflash` README][espflash-readme].

`espflash` can be used as a Cargo runner by adding the following to your project's `.cargo/config.toml` file:
```toml
Expand All @@ -55,4 +55,4 @@ runner = "espflash flash --monitor"
With this configuration, you can flash and monitor your application using `cargo run`.

[esp-idf]: https://github.com/espressif/esp-idf
[espflash readme]: https://github.com/esp-rs/espflash/blob/master/espflash/README.md
[espflash-readme]: https://github.com/esp-rs/espflash/blob/master/espflash/README.md
2 changes: 1 addition & 1 deletion src/tooling/simulating/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Simulating projects can be handy. It allows users to test projects using CI, try projects without having hardware available, and many other scenarios.

At the moment, there are a few ways of simulating Rust projects on Espressif chips, all of them have some limitations, but it's quickly evolving and getting better every day.
At the moment, there are a few ways of simulating Rust projects on Espressif chips. Every way has some limitations, but it's quickly evolving and getting better every day.

In this chapter, we will discuss currently available simulation tools.

Expand Down
2 changes: 1 addition & 1 deletion src/tooling/visual-studio-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Alongside Rust Analyzer there are other extensions that might be helpful:

### Using Rust Analyzer with `no_std`

If you are developing for a target that does not have `std` support, Rust Analyzer can behave strangely, often reporting various errors. This can be resolved by creating a `.vscode/settings.json` file in your project and populating it with the following:
If you are developing for a target that doesn't have `std` support, Rust Analyzer can behave strangely, often reporting various errors. This can be resolved by creating a `.vscode/settings.json` file in your project and populating it with the following:

```json
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Inside the `main` function we can find:
- Sometimes a peripheral (here the System peripheral) is coarse-grained and doesn't exactly fit the HAL drivers - so here we split the System peripheral into smaller pieces which get passed to the drivers
- `let clocks = ClockControl::boot_defaults(system.clock_control).freeze();`
- Here we configure the system clocks - in this case, we are fine with the defaults
- We freeze the clocks, which means we cannot change them later
- We freeze the clocks, which means we can't change them later
- Some drivers need a reference to the clocks to know how to calculate rates and durations
- The next block of code instantiates some peripherals (namely RTC and the two timer groups) to disable the watchdog, which is armed after boot
- Without that code, the SoC would reboot after some time
Expand Down
2 changes: 1 addition & 1 deletion src/writing-your-own-application/generate-project/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Both templates are based on [`cargo-generate`][cargo-generate], a tool that allo

## Using Dev Containers in the Templates

Both template repositories have a prompt for Dev Containers support, see details in [Dev Container][dev-container] section of the template README.
Both template repositories have a prompt for Dev Containers support, see details in [Dev Containers][dev-container] section of the template README.

Dev Containers use the [`idf-rust`][idf-rust] container image, which was explained in the [Using Container][using-container] section of the [Setting up a Development Environment][setting-env] chapter. This image provides an environment ready to develop Rust applications for Espressif chips with no installation required. Dev Containers also have integration with [Wokwi simulator][wokwi], to simulate the project, and allow flashing from the container using [`web-flash`][web-flash].

Expand Down
2 changes: 1 addition & 1 deletion src/writing-your-own-application/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can write an application in the following ways:

- (**Strongly recommended**) Generate from a template: Gives you a configured project, saves time, and prevents possible errors.
- Start from scratch using Cargo: Requires more expertise since you need to configure several parts of the project.
> ⚠️ **Note**: Starting a project with Cargo does not provide any advantage, only mentioned here since it's the usual way of generating a project in Rust.
> ⚠️ **Note**: Starting a project with Cargo doesn't provide any advantage, only mentioned here since it's the usual way of generating a project in Rust.
This chapter won't cover the instructions on how to create a project from scratch with `cargo`, it will only focus on generating a project from a template project.

Expand Down

0 comments on commit f739bbe

Please sign in to comment.