rtic/examples/esp32c3
Jesse Braham 1f6b6a42e5
Update support/example for ESP32-C3 to use latest versions of dependencies (#975)
* Update `rtic` package to use latest version of `esp32c3` dependency

* Update `rtic-macros` ESP32-C3 bindings to reflect changes in HAL

* Update the ESP32-C3 examples to use latest versions of all dependencies

* Update changelogs

* adjust expected qemu output, add compile-time checks

* remove runtime checks, this is checked at compile time

* fix expected qemu output

* Clean up interrupt enable code a bit

* Update `rtic-monotonic` to use the latest PAC for ESP32-C3

* Update `CHANGELOG.md` for `rtic-monotonic`

* ci: esp32c3: Format runner.sh

* ci: esp32c3: Default to silent boot

export DEBUGGING while running to get verbose boot

env DEBUGGING=1 cargo xtask ...

* ci: esp32c3: Update expected example output

---------

Co-authored-by: onsdagens <pawdzi-7@student.ltu.se>
Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
2024-10-16 19:29:51 +00:00
..
.cargo Add SYSTIMER based ESP32-C3 monotonic (#972) 2024-09-29 04:21:14 +00:00
examples Update support/example for ESP32-C3 to use latest versions of dependencies (#975) 2024-10-16 19:29:51 +00:00
Cargo.lock Update support/example for ESP32-C3 to use latest versions of dependencies (#975) 2024-10-16 19:29:51 +00:00
Cargo.toml Update support/example for ESP32-C3 to use latest versions of dependencies (#975) 2024-10-16 19:29:51 +00:00
README.md Add SYSTIMER based ESP32-C3 monotonic (#972) 2024-09-29 04:21:14 +00:00
runner.sh Update support/example for ESP32-C3 to use latest versions of dependencies (#975) 2024-10-16 19:29:51 +00:00
rust-toolchain.toml Add SYSTIMER based ESP32-C3 monotonic (#972) 2024-09-29 04:21:14 +00:00

ESP32-C3 RTIC template

This crate showcases a simple RTIC application for the ESP32-C3.

Prerequisites

Nightly Rust

The ESP32-C3 HAL requires a nightly build of Rust. Following the example of the (Espressif no_std book)[https://docs.esp-rs.org/no_std-training/02_2_software.html], we use this specific build: rustup toolchain install nightly-2023-11-14 --component rust-src --target riscv32imc-unknown-none-elf

Espressif toolchain

This crate uses the most convenient option in cargo-espflash and espflash cargo install cargo-espflash espflash

Running the crate

Uncomment the

runner = "espflash flash --monitor"

line in .cargo/config.toml

and comment out (or remove)

runner = "./runner.sh"

Now, running

cargo run --example sw_and_hw --features=riscv-esp32c3-backend (--release)

in the root of this crate should do the trick.

Expected behavior

The example sw_and_hw

  • Prints init
  • Enters a high prio task
  • During the execution of the high prio task, the button should be non-functional
  • Pends a low prio task
  • Exits the high prio task
  • Enters the low prio task
  • During the execution of the low prio task, the button should be functional.
  • Exits the low prio task
  • Prints idle

The example monotonic

  • Prints init
  • Spawns the foo, bar, baz tasks (because of hardware interrupt latency dispatch, the order here may vary).
  • Each task prints hello from $TASK on entry
  • The tasks wait for 1, 2, 3 seconds respectively
  • Once the wait period is over, each task exits printing bye from $TASK (now in the proper order).