Skip to content

Commit

Permalink
Add defmt documentation (#540)
Browse files Browse the repository at this point in the history
* docs: Document differnt logging formats

* docs: Add Logging format section and format ToC
  • Loading branch information
SergioGasquez authored Jan 9, 2024
1 parent 3d91a9b commit a3028ec
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 13 deletions.
16 changes: 15 additions & 1 deletion cargo-espflash/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- omit in toc -->
# cargo-espflash

[![Crates.io](https://img.shields.io/crates/v/cargo-espflash?labelColor=1C2C2E&color=C96329&logo=Rust&style=flat-square)](https://crates.io/crates/cargo-espflash)
Expand All @@ -8,6 +9,7 @@ Cross-compiler and Cargo extension for flashing Espressif devices.

Supports the **ESP32**, **ESP32-C2/C3/C6**, **ESP32-H2**, **ESP32-S2/S3**, and **ESP8266**.

<!-- omit in toc -->
## Table of Contents

- [Installation](#installation)
Expand All @@ -17,7 +19,8 @@ Supports the **ESP32**, **ESP32-C2/C3/C6**, **ESP32-H2**, **ESP32-S2/S3**, and *
- [Bootloader and Partition Table](#bootloader-and-partition-table)
- [Package Metadata](#package-metadata)
- [Configuration File](#configuration-file)
- [Configuration examples](#configuration-examples)
- [Configuration Examples](#configuration-examples)
- [Logging Format](#logging-format)
- [License](#license)
- [Contribution](#contribution)

Expand Down Expand Up @@ -148,6 +151,17 @@ vid = "303a"
pid = "1001"
```

## Logging Format

`cargo-espflash` `flash` and `monitor` subcommands support several logging formats using the `-L/--log-format` argument:
- `serial`: Default logging format
- `defmt`: Uses [`defmt`] logging framework. With logging format, logging strings have framing bytes to indicate that they are `defmt` messages.
- See [`defmt` section] of `esp-println` readme.
- For a detailed guide on how to use `defmt` in the `no_std` ecosystem, see [`defmt` project] of Embedded Rust (no_std) on Espressif book.

[`defmt` section]: https://github.com/esp-rs/esp-println?tab=readme-ov-file#defmt
[`defmt` project]: https://esp-rs.github.io/no_std-training/03_6_defmt.html

## License

Licensed under either of:
Expand Down
36 changes: 24 additions & 12 deletions espflash/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- omit in toc -->
# espflash

[![Crates.io](https://img.shields.io/crates/v/espflash?labelColor=1C2C2E&color=C96329&logo=Rust&style=flat-square)](https://crates.io/crates/espflash)
Expand All @@ -9,20 +10,20 @@ A library and command-line tool for flashing Espressif devices.

Supports the **ESP32**, **ESP32-C2/C3/C6**, **ESP32-H2**, **ESP32-S2/S3**, and **ESP8266**.

<!-- omit in toc -->
## Table of Contents

- [espflash](#espflash)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
- [Permissions on Linux](#permissions-on-linux)
- [Windows Subsystem for Linux](#windows-subsystem-for-linux)
- [Cargo Runner](#cargo-runner)
- [Using `espflash` as a Library](#using-espflash-as-a-library)
- [Configuration File](#configuration-file)
- [Configuration Examples](#configuration-examples)
- [License](#license)
- [Contribution](#contribution)
- [Installation](#installation)
- [Usage](#usage)
- [Permissions on Linux](#permissions-on-linux)
- [Windows Subsystem for Linux](#windows-subsystem-for-linux)
- [Cargo Runner](#cargo-runner)
- [Using `espflash` as a Library](#using-espflash-as-a-library)
- [Configuration File](#configuration-file)
- [Configuration Examples](#configuration-examples)
- [Logging Format](#logging-format)
- [License](#license)
- [Contribution](#contribution)

## Installation

Expand Down Expand Up @@ -157,6 +158,17 @@ vid = "303a"
pid = "1001"
```

## Logging Format

`espflash` `flash` and `monitor` subcommands support several logging formats using the `-L/--log-format` argument:
- `serial`: Default logging format
- `defmt`: Uses [`defmt`] logging framework. With logging format, logging strings have framing bytes to indicate that they are `defmt` messages.
- See [`defmt` section] of `esp-println` readme.
- For a detailed guide on how to use `defmt` in the `no_std` ecosystem, see [`defmt` project] of Embedded Rust (no_std) on Espressif book.

[`defmt` section]: https://github.com/esp-rs/esp-println?tab=readme-ov-file#defmt
[`defmt` project]: https://esp-rs.github.io/no_std-training/03_6_defmt.html

## License

Licensed under either of:
Expand Down

0 comments on commit a3028ec

Please sign in to comment.