Skip to content

theembeddedrustacean/ser-no-std

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplified Embedded Rust: ESP Core Library Edition - Book Repository 🦀

BookCover

Welcome to the Simplified Embedded Rust: ESP Core Library Edition book repository. Here you will find all the book related resources. You can get a copy of the book here.

📝 Reporting Issues & Content Suggestions

If you find any text errors, typos, or formatting issues in the book, please report a text error here so that it can be addressed in a later revision.

If you find any code issues in the book, please report a bug here so that it can be addressed in a later revision.

You are also welcome to suggest a feature here so it may be considered for content in the future.

🔗 GitHub Project Links

This is a list of the project links containing the example source code for the different ESP devkits. All projects were setup using VS Code as an editor. Each branch contains the same collection of code examples accomodated for the different ESP devkits supported by Wokwi. Click on the link for the device you desire to work with and clone that particular branch.

Device Devkit GitHub Links
ESP32-C3 ESP32-C3-DevKitM-1 ESP32-C3-DevKitM-1 Branch
ESP32-C3 ESP32-C3-DevKit-RUST-1 ESP32-C3-DevKit-RUST-1 Branch
ESP32-S2 ESP32-S2-DevKitM-1 ESP32-S2-DevKitM-1 Branch
ESP32-S3 ESP32-S3-DevKitC-1 ESP32-S3-DevKitC-1 Branch
ESP32 ESP32-Dev-KitC ESP32-DevKitC Branch

🔗 Wokwi Project Links

This is a list of links to the Wokwi examples presented in each chapter. These are based on the ESP32-C3 device and would need to be rewired for other devices. The Wokwi setup for the different devices can be also extracted from the VSCode projects. If you notice a template missing or would like to request one, feel free to submit a feature request.

Chapter Example Link
CH 5 - GPIO Blinky
Button Controlled Blinking
Button Press Counter
CH 6 - ADC Simple Voltmeter
Temperature Sensing
CH 7 - Timers & Counters Timer Based Delay
Real-Time Timer
CH 8 - PWM LED Fading
CH 9 - Serial Communication Console Printing
Interacting with an I2C RTC
CH 10 - The Embassy Framework Blinky
Real-time Timer
LED Cycling
UART Echo

🔌 Wiring Templates for End of Chapter Questions

These are pre-wired templates to get you started with end of chapter questions. Questions that are not included would use exisiting book examples as templates. These are based on the ESP32-C3 device and would need to be rewired for other devices. If you notice a template missing or would like to request one, feel free to submit a feature request.

Chapter Question Links
CH 5 - GPIO Q5
Q6
Q7 & Q8
CH 6 - ADC Q4
Q5
Q6 & Q7
CH 7 - Timers & Counters Q1
CH 8 - PWM Q4
Q5
Q6
Q7
CH 9 - Serial Communication 🤷‍♂️
CH 10 - The Embassy Framework Q6

🧑‍💻 Development Options

1. 🌐 Wokwi Web Interface (Recommended)

This is the recommended option for beginners as it is the quickest and easiest way to get started. Each code example has a corresponding project on Wokwi, allowing you to run and modify the code directly from your web browser. Links to the examples are provided in the earlier section.

2. 🌐🛠️ Wokwi Web Interface with Hardware

If you prefer to work with physical hardware, Wokwi provides an approach to flash an external development board/device directly from the web interface. To do that you need to press F1 in the Wokwi code window to access the command palette. Afterward, you can select the "Flash Firmware to Device" option.

3. 🏡🛠️ Local Editor with Physical Hardware

If you prefer to develop locally with physical hardware, you can clone the examples locally and set them up to run on an external development board. The software required entails installing the nightly toolchain with the rust src component, modifying the target for cross-compiling in addition to installing flashing tools to download code to the external hardware. This includes the following

a) Install Rust 🦀:

If you do not have Rust installed already, follow the instructions on the rustup website.

b) Install the Nightly Toolchain with the rust-src Component:

Run the following command in a terminal window:

rustup toolchain install nightly --component rust-src

c) Set the target:

Run the following command in a terminal window:

rustup target add riscv32imc -unknown -none -elf

d) Install espflash:

Run the following command in a terminal window:

cargo install espflash

Afterward, the easiest way to flash an ELF binary, is to add espflash as your Cargo runner. This way, when enterning cargo run, the code would automaitcally perform the flashing after file generation. This is done by adding the following line to your .cargo/config.toml file:

[target.'cfg(any(target_arch = "riscv32", target_arch = "xtensa"))']
runner = "espflash flash --monitor"

e) Install cargo-generate:

When creating your own projects from scratch, it is highly recommended that you use cargo-generate. Through cargo-generate you can create new project templates pre-configured for any ESP device. Click on the link below for instructions to install and use cargo-generate. To install cargo-generate run the following command:

cargo install cargo-generate

Afterward, to generate a no-std template run the following command:

cargo generate esp-rs/esp-template

4. 🏡🔮 Local Editor with Wokwi

If you prefer to develop locally with Wowki (no hardware), you can clone the examples locally and install the following extensions for the simulator:

Afterward, you need to also configure your project for Wokwi using these instructions.

⚠️ Local development with Wokwi still requires the same setup as local editor with physical hardware since you will be compiling locally, however, flashing tools are not required since external hardware is not involved. Also through cargo-generate you can generate projects pre-configured for Wokwi skipping the second part after extension installation.

⛔️ Important Note:

Options 2, 3, and 4 are not recommended for beginners due to the added complexity and, in some cases, required installations.

🧱 Hardware Component List (Optional)

This is a list of the components used in the different examples in the book. Acquiring these components is OPTIONAL and recommended only after you are comfortable with the material. You will only need these components if you are interested in doing physical hardware development at a later time (options 2 and 3 listed in the development options section earlier).

Component Documenation Purchase Links
Development Board (Choose one) ESP32-C3-DevKitM-1
ESP32-C3-DevKit-RUST-1
ESP32-C3-DevKitM-1 (AliExpress)
ESP32-C3-DevKit-RUST-1 (AliExpress)
Female to Male Wires N/A AliExpress
Prototyping Breadboard N/A AliExpress
LEDs Datasheet AliExpress
LED Bar Datasheet AliExpress
Push Button Datasheet AliExpress
Potentiometer Datasheet AliExpress
NTC Temperature Sensor Datasheet AliExpress
DS1307 Datasheet AliExpress

About

Simplified Embedded Rust: ESP Core Edition Book Projects and Templates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages