### Install cargo-generate Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Example of using imperative mood for instructions, combined with code blocks for commands. This is a common pattern for installation or setup procedures. ```rust cargo install cargo-generate ``` -------------------------------- ### Terminal Command Example Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Shows how to format terminal commands and their output. Commands start with '$', while output does not. PowerShell uses '>' instead of '$'. ```markdown - Start the terminal commands with `$` - Output of previous commands should not start with `$` - For PowerShell-specific examples, use `>` instead of `$` ``` -------------------------------- ### Install espflash using cargo-binstall Source: https://github.com/esp-rs/book/blob/main/src/getting-started/tooling/espflash.md Install espflash by downloading pre-compiled artifacts using cargo-binstall. This method can be faster for obtaining the tool. ```bash cargo binstall espflash ``` -------------------------------- ### Install esp-generate Source: https://github.com/esp-rs/book/blob/main/src/getting-started/tooling/esp-generate.md Install the `esp-generate` tool using Cargo. Ensure you use the `--locked` flag for a reproducible build. ```shell cargo install esp-generate --locked ``` -------------------------------- ### Install esp-config Tool Source: https://github.com/esp-rs/book/blob/main/src/getting-started/tooling/esp-config.md Installs the `esp-config` tool with TUI support. Ensure you have Rust and Cargo installed. The `--locked` flag ensures reproducible builds. ```shell cargo install esp-config --features=tui --locked ``` -------------------------------- ### Serve the book locally Source: https://github.com/esp-rs/book/blob/main/README.md Clone the book repository and start a local development server using mdbook. Navigate into the cloned directory before running the serve command. ```shell git clone https://github.com/esp-rs/book cd book/ mdbook serve ``` -------------------------------- ### Install mdbook Source: https://github.com/esp-rs/book/blob/main/README.md Install the mdbook tool using Cargo. This is required to build and serve the book. ```shell cargo install mdbook ``` -------------------------------- ### MSVC and GNU ABIs Example Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Demonstrates using bold text within a list item to highlight specific options or terms, aiding scannability for longer list entries. ```markdown - **MSVC**: Recommended ABI, included in - **GNU**: ABI used by the GCC toolchain ``` -------------------------------- ### Install Rust Toolchain with Rust Source Component Source: https://github.com/esp-rs/book/blob/main/src/getting-started/toolchain.md Installs the stable Rust toolchain along with the `rust-src` component, which is necessary for RISC-V development. Alternatively, the `nightly` toolchain can be installed. ```shell rustup toolchain install stable --component rust-src ``` ```shell rustup toolchain install nightly --component rust-src ``` -------------------------------- ### Install espflash using Cargo Source: https://github.com/esp-rs/book/blob/main/src/getting-started/tooling/espflash.md Install the espflash utility using the cargo command. Ensure you use the --locked flag for a reproducible build. ```shell cargo install espflash --locked ``` -------------------------------- ### Hello World Program Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Example of using monospace font for inline code output, like a program's printed text. ```markdown Writing a program that prints `Hello, world!` ``` -------------------------------- ### Install All Espressif Toolchains with espup Source: https://github.com/esp-rs/book/blob/main/src/getting-started/toolchain.md Uses the `espup` tool to automatically download and install all necessary Rust toolchains and components required for developing on supported Espressif targets. ```shell espup install ``` -------------------------------- ### Compile, Flash, and Monitor ESP Rust Project Source: https://github.com/esp-rs/book/blob/main/src/getting-started/using-esp-generate.md Execute this command to compile your Rust application, flash it to the target Espressif device, and begin monitoring its log output. This is the standard command to get your project running after generation. ```shell cargo run --release ``` -------------------------------- ### Install espup Utility Source: https://github.com/esp-rs/book/blob/main/src/getting-started/toolchain.md Installs the `espup` tool, a helper utility for managing Espressif Rust toolchains, using Cargo. Ensure you use the `--locked` flag for a reproducible build. ```shell cargo install espup --locked ``` -------------------------------- ### Wrapping C API for Rust Integration Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Example of a bulleted list used to describe parts of a process. Each item is a distinct part of the overall task. ```markdown - Wrapping the exposed C API for use with Rust - Building your C or C++ code to be integrated with the Rust code ``` -------------------------------- ### Markdown Note Admonition Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Example of how to format a note using Markdown's admonition syntax. ```markdown > [!NOTE] > Write your note. ``` -------------------------------- ### Declare Reclaimed RAM Heap Allocator Source: https://github.com/esp-rs/book/blob/main/src/application-development/alloc.md Use the `#[ram(reclaimed)]` macro to declare a heap allocator that utilizes memory regions otherwise unused by the bootloader. This example allocates 64kB in the `dram2_seg`. ```rust heap_allocator!(#[ram(reclaimed)] size: 64000); ``` -------------------------------- ### Generate a New ESP Rust Project Source: https://github.com/esp-rs/book/blob/main/src/getting-started/using-esp-generate.md Run this command to launch the interactive configuration tool for generating a new Rust project for an Espressif chip. It will prompt for chip selection and project name, then open a TUI for further configuration. ```shell esp-generate ``` -------------------------------- ### Generate New Project Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Demonstrates generating a new project using a specific git repository. This follows the imperative mood for user actions. ```bash cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart ``` -------------------------------- ### Peripheral Interaction Guidelines Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Illustrates using a bulleted list where each item ends with a full stop, as at least one item is a complete sentence. This ensures consistent punctuation within the list. ```markdown - Always use `volatile` methods to read or write to peripheral memory, as it can change at any time. - In software, we should be able to share any number of read-only accesses to these peripherals. - If some software should have read-write access to a peripheral, it should hold the only reference to that peripheral. ``` -------------------------------- ### Setting ESP HAL Configuration in .cargo/config.toml Source: https://github.com/esp-rs/book/blob/main/src/application-development/configuration.md Configure ESP HAL specific settings by defining them in the [env] section of your .cargo/config.toml file. A clean build is recommended after modification. ```toml # .cargo/config.toml [env] ESP_HAL_CONFIG_PLACE_ANON_IN_RAM="true" ``` -------------------------------- ### No_std Environment Heading Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Shows how to use monospace font within a heading to denote technical terms like `no_std`. ```markdown **A `no_std` Rust Environment** ``` -------------------------------- ### Add RISC-V Targets for Espressif Chips Source: https://github.com/esp-rs/book/blob/main/src/getting-started/toolchain.md Adds the appropriate RISC-V target specifications to your Rust toolchain for ESP32-C2/C3 or ESP32-C6/H2 devices. ```shell rustup target add riscv32imc-unknown-none-elf # For ESP32-C2 and ESP32-C3 ``` ```shell rustup target add riscv32imac-unknown-none-elf # For ESP32-C6 and ESP32-H2 ``` -------------------------------- ### Define and Use Link Variables in Markdown Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Use link variables for easier maintenance and readability in Markdown. Define them before they are used in the same section. ```markdown [`espup`][espup-github] is a tool that simplifies installing and maintaining the components required to develop Rust applications. [espup-github]: https://github.com/esp-rs/espup ``` -------------------------------- ### String Type Link Source: https://github.com/esp-rs/book/blob/main/rust-doc-style-guide.md Illustrates using monospace font within a hyperlink to refer to a specific type, such as `String` in the Rust standard library. ```markdown [`String`](https://doc.rust-lang.org/std/string/struct.String.html) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.