ESP32

Configure an ESP32 template project

Use esp-generate to create an ESP32-C3 Rust starter project and configure espflash, logging, debugging, and VSCode integration.

/esp32/1 of 21 min read283 words
  • esp32
  • toolchain
Contents

Create a starter project with esp-generate#

Before starting, complete the base Rust environment setup, then finish the ESP32 Rust setup.

After completing those steps, create or open a project directory and run the following command in a terminal. You can also run esp-generate by itself and follow its prompts.

esp-generate --chip=esp32c3 esp32c3_embassy_dht11_demo

The command is made up of these parts:

esp-generate # invoke the generator
--chip=esp32c3  # select the chip
esp32c3_embassy_dht11_demo  # project name; snake_case is recommended

The terminal opens an interactive, GUI-like menu. Use the arrow keys to highlight a feature, then press Enter to select it; selected features show a ✅ marker.

esp-generate feature selection screen

A feature prefixed with [▶] contains child features. Highlight it with the arrows and press Enter to open its submenu.

esp-generate feature group screen

Highlight ▶ Flashing, logging and debugging (espflash) and press Enter to open its submenu.

espflash feature group in esp-generate

Select the features shown in the next screen; in this example, options 2 and 3 are selected.

selected flashing and logging features in esp-generate

Note: options 1 and 2 are mutually exclusive. Selecting both will cause a project error.

Press ESC to return to the main menu and continue enabling features.

Highlight ▶ Optional editor integration and press Enter to open its submenu.

optional editor integration menu in esp-generate

This menu selects your editor. The generator can configure the project for it and recommend useful extensions.

VSCode editor integration selected in esp-generate

After selecting the editor feature, press ESC to return to the main menu.

All features are now selected. Press S for Save to generate the project; the terminal will show its progress.

esp-generate project creation complete

🆗 Rust (stable): 1.89.0
🆗 espflash: 4.0.1
🆗 probe-rs: 0.29.1

The template is ready. Future projects follow the same process, and tool versions may differ as the toolchain evolves.

Discussion

Comments and discussion

Sign in with GitHub to leave a comment, ask a question, or add context.