Skip to content

Commit

Permalink
docs: Improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez committed Oct 10, 2024
1 parent bf4eef8 commit d4d6803
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 16 deletions.
81 changes: 76 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,78 @@
# EXPERIMENT - DON'T USE
# `esp-generate`

This is just to explore some ideas - the code is quite ugly
Template generation tool to create `no_std` applications targeting Espressif's line of SoCs and modules. At present, this template supports the ESP32, ESP32-C2, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-S2, and ESP32-S3. Additional devices will be added as they become available.

Things to explore here:
- have a template which is actually a working project, editable in the IDE
- have a TUI to select options
> [!WARNING]
>
> This project is still in the early stages of development. If you encounter any issue or you would like to see any feature added. Please, open an [issue].
[issue]: https://github.com/esp-rs/esp-generate/issues/new

## Quickstart

To generate a proect using this template:
1. Install `esp-generate`:
```
cargo install esp-generate --git https://github.com/esp-rs/esp-template
```
2. Generate a project. There are two options:
1. Using TUI:
```
esp-generate --chip esp32 tests
```
Replace the chip and project name accordingly and choose the different options using the TUI.
2. Adding the options to the `esp-generate command:
```
esp-generate --chip esp32 -o wifi -o alloc tests
```
Replace the chip and project name accordingly and choose the different options using the `-o/--option` flag.
For a full list of available options, see [Usage](#usage) section.
## Usage
```
Usage: esp-generate [OPTIONS] --chip <CHIP> <NAME>

Arguments:
<NAME>

Options:
-c, --chip <CHIP> [possible values: esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2]
--headless
-o, --option <OPTION>
-h, --help Print help
-V, --version Print version
```
### Available Options
- `alloc`: Enables allocations via the `esp-alloc` crate.
- `wifi`: Enables Wi-Fi via the `esp-wifi` crate. Requires `alloc`.
- `ble`: Enables BLE via the `esp-wifi` crate. Requires `alloc`.
- `embassy`: Adds `embassy` framework support.
- `probe-rs`: Enables `defmt` and flashes using `probe-rs` instead of `espflash`.
- `stack-protector`: Enable stack-smash protection (`nightly` only).
- `optional`: Enables the following set of options:
- `wokwi`: Adds support for Wokwi simulation using [VS Code Wokwi extension].
- `dev-container`: Adds support for [VS Code Dev Containers] and [GitHub Codespaces].
- `ci` Adds GitHub Actions support with some basics checks.
[VS Code Wokwi extension]: https://marketplace.visualstudio.com/items?itemName=wokwi.wokwi-vscode
[VS Code Dev Containers]: https://code.visualstudio.com/docs/remote/containers#_quick-start-open-an-existing-folder-in-a-container
[GitHub Codespaces]: https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace
## License
Licensed under either of:
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in
the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without
any additional terms or conditions.
20 changes: 9 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ impl GeneratorOptionItem {
static OPTIONS: &[GeneratorOptionItem] = &[
GeneratorOptionItem::Option(GeneratorOption {
name: "alloc",
display_name: "Alloc",
display_name: "Enables allocations via the `esp-alloc` crate.",
enables: &[],
disables: &[],
chips: &[],
}),
GeneratorOptionItem::Option(GeneratorOption {
name: "wifi",
display_name: "Wifi",
display_name: "Enables Wi-Fi via the `esp-wifi` crate. Requires `alloc`.",
enables: &["alloc"],
disables: &["ble"],
chips: &[
Expand All @@ -80,7 +80,7 @@ static OPTIONS: &[GeneratorOptionItem] = &[
}),
GeneratorOptionItem::Option(GeneratorOption {
name: "ble",
display_name: "BLE",
display_name: "Enables BLE via the `esp-wifi` crate. Requires `alloc`.",
enables: &["alloc"],
disables: &["wifi"],
chips: &[
Expand All @@ -94,21 +94,21 @@ static OPTIONS: &[GeneratorOptionItem] = &[
}),
GeneratorOptionItem::Option(GeneratorOption {
name: "embassy",
display_name: "Embassy",
display_name: "Adds `embassy` framework support.",
enables: &[],
disables: &[],
chips: &[],
}),
GeneratorOptionItem::Option(GeneratorOption {
name: "probe-rs",
display_name: "Flash via probe-rs, use defmt",
display_name: "Enables `defmt` and flashes using `probe-rs` instead of `espflash`.",
enables: &[],
disables: &[],
chips: &[],
}),
GeneratorOptionItem::Option(GeneratorOption {
name: "stack-protector",
display_name: "Enable stack-smash protection (Nightly only)",
display_name: "Enable stack-smash protection (`nightly` only).",
enables: &[],
disables: &[],
chips: &[],
Expand All @@ -119,21 +119,21 @@ static OPTIONS: &[GeneratorOptionItem] = &[
options: &[
GeneratorOptionItem::Option(GeneratorOption {
name: "wokwi",
display_name: "Wokwi Support",
display_name: "Adds support for Wokwi simulation using VS Code Wokwi extension.",
enables: &[],
disables: &[],
chips: &[],
}),
GeneratorOptionItem::Option(GeneratorOption {
name: "dev-container",
display_name: "Dev-Container Support",
display_name: "Adds support for VS Code Dev Containers and GitHub Codespaces.",
enables: &[],
disables: &[],
chips: &[],
}),
GeneratorOptionItem::Option(GeneratorOption {
name: "ci",
display_name: "Add GitHub CI",
display_name: "Adds GitHub Actions support with some basics checks.",
enables: &[],
disables: &[],
chips: &[],
Expand Down Expand Up @@ -428,8 +428,6 @@ fn process_options(args: &Args) {
option, args.chip
);
}
} else {
eprintln!("Error: Option {:?} not found", option);
}
}
}

0 comments on commit d4d6803

Please sign in to comment.