Update esp32c{3,6} support to esp-hal-1.0.0-rc.0.

This commit is contained in:
Paul Bender 2025-09-13 15:17:36 -07:00 committed by Henrik Tjäder
parent 1365471f5a
commit e8c260a745
15 changed files with 949 additions and 633 deletions

View file

@ -1,16 +1,20 @@
[target.riscv32imc-unknown-none-elf] [target.riscv32imc-unknown-none-elf]
# Real hardware # Real hardware
# runner = "espflash flash --monitor" # runner = "espflash flash --monitor --chip esp32c3"
# QEMU emulator # QEMU emulator
runner = "./runner.sh" runner = "./runner.sh"
[build] [build]
rustflags = [ rustflags = [
"-C", "link-arg=-Tlinkall.x",
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
# NOTE: May negatively impact performance of produced code # NOTE: May negatively impact performance of produced code
"-C", "force-frame-pointers", "-C", "force-frame-pointers",
# This should be last.
"-C", "link-arg=-Tlinkall.x",
] ]
target = "riscv32imc-unknown-none-elf" target = "riscv32imc-unknown-none-elf"
[unstable]
build-std = ["alloc", "core"]

File diff suppressed because it is too large Load diff

View file

@ -1,24 +1,25 @@
[package] [package]
name = "esp32-c3" name = "esp32-c3"
version = "0.1.0" version = "0.2.0"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
[workspace] [workspace]
[features]
test-critical-section = []
riscv-esp32c3-backend = ["rtic/riscv-esp32c3-backend", "rtic-monotonics/esp32c3-systimer"]
[dependencies] [dependencies]
rtic = { path = "../../rtic/" } esp-backtrace = { version = "0.17.0", features = [
rtic-monotonics = {path = "../../rtic-monotonics/"}
esp-hal = { version = "1.0.0-beta.0", features = ["esp32c3", "unstable"] }
esp-backtrace = { version = "0.15.0", features = [
"esp32c3", "esp32c3",
"panic-handler", "panic-handler",
"exception-handler", "exception-handler",
"println", "println",
] } ] }
esp32c3 = {version = "0.29.0", features = ["critical-section"]} esp-bootloader-esp-idf = { version = "0.2.0", features = ["esp32c3"] }
esp-println = { version = "0.13.0", features = ["esp32c3"] } esp-hal = { version = "=1.0.0-rc.0", features = ["esp32c3", "unstable"] }
esp-println = { version = "0.15.0", features = ["esp32c3"] }
[features] esp32c3 = { version = "0.30.0", features = ["critical-section"] }
test-critical-section = [] rtic = { path = "../../rtic/" }
riscv-esp32c3-backend = ["rtic/riscv-esp32c3-backend", "rtic-monotonics/esp32c3-systimer"] rtic-monotonics = { path = "../../rtic-monotonics/" }

View file

@ -1,9 +1,10 @@
### ESP32-C3 RTIC template # ESP32-C3 RTIC template
This crate showcases a simple RTIC application for the ESP32-C3. This crate showcases a simple RTIC application for the ESP32-C3.
## Prerequisites ## Prerequisites
# Espressif toolchain ### Espressif toolchain
This crate uses the most convenient option in ``cargo-espflash`` and ``espflash`` This crate uses the most convenient option in ``cargo-espflash`` and ``espflash``
```cargo install cargo-espflash espflash``` ```cargo install cargo-espflash espflash```
@ -26,7 +27,8 @@ Now, running
in the root of this crate should do the trick. in the root of this crate should do the trick.
# Expected behavior ## Expected behavior
The example ``sw_and_hw`` The example ``sw_and_hw``
- Prints ``init`` - Prints ``init``
- Enters a high prio task - Enters a high prio task

View file

@ -1,6 +1,14 @@
#![deny(
clippy::mem_forget,
reason = "mem::forget is generally not safe to do with esp_hal types, especially those \
holding buffers for the duration of a data transfer."
)]
#![no_main] #![no_main]
#![no_std] #![no_std]
use esp_backtrace as _; use esp_backtrace as _;
esp_bootloader_esp_idf::esp_app_desc!();
#[rtic::app(device = esp32c3, dispatchers = [])] #[rtic::app(device = esp32c3, dispatchers = [])]
mod app { mod app {
use rtic_monotonics::esp32c3::prelude::*; use rtic_monotonics::esp32c3::prelude::*;

View file

@ -1,5 +1,13 @@
#![deny(
clippy::mem_forget,
reason = "mem::forget is generally not safe to do with esp_hal types, especially those \
holding buffers for the duration of a data transfer."
)]
#![no_main] #![no_main]
#![no_std] #![no_std]
esp_bootloader_esp_idf::esp_app_desc!();
#[rtic::app(device = esp32c3, dispatchers=[FROM_CPU_INTR0, FROM_CPU_INTR1])] #[rtic::app(device = esp32c3, dispatchers=[FROM_CPU_INTR0, FROM_CPU_INTR1])]
mod app { mod app {
use esp_backtrace as _; use esp_backtrace as _;

View file

@ -1,15 +1,16 @@
[target.riscv32imac-unknown-none-elf] [target.riscv32imac-unknown-none-elf]
runner = "espflash flash --monitor" runner = "espflash flash --monitor --chip esp32c6"
[build] [build]
rustflags = [ rustflags = [
"-C", "link-arg=-Tlinkall.x",
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
# NOTE: May negatively impact performance of produced code # NOTE: May negatively impact performance of produced code
"-C", "force-frame-pointers", "-C", "force-frame-pointers",
# This should be last.
"-C", "link-arg=-Tlinkall.x",
] ]
target = "riscv32imac-unknown-none-elf" target = "riscv32imac-unknown-none-elf"
[unstable] [unstable]
build-std = ["core"] build-std = ["alloc", "core"]

File diff suppressed because it is too large Load diff

View file

@ -1,25 +1,25 @@
[package] [package]
name = "esp32-c6" name = "esp32-c6"
version = "0.1.0" version = "0.2.0"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
[workspace] [workspace]
[features]
test-critical-section = []
riscv-esp32c6-backend = ["rtic/riscv-esp32c6-backend", "rtic-monotonics/esp32c6-systimer"]
[dependencies] [dependencies]
rtic = { path = "../../rtic/" } esp-backtrace = { version = "0.17.0", features = [
rtic-monotonics = {path = "../../rtic-monotonics/"}
esp-hal = { version = "1.0.0-beta.0", features = ["esp32c6", "unstable"] }
esp-backtrace = { version = "0.15.1", features = [
"esp32c6", "esp32c6",
"panic-handler", "panic-handler",
"exception-handler", "exception-handler",
"println", "println",
] } ] }
esp-bootloader-esp-idf = { version = "0.2.0", features = ["esp32c6"] }
esp32c6 = {version = "0.20.0", features = ["critical-section"]} esp-hal = { version = "=1.0.0-rc.0", features = ["esp32c6", "unstable"] }
esp-println = { version = "0.13.1", features = ["esp32c6", "auto"] } esp-println = { version = "0.15.0", features = ["esp32c6", "auto"] }
esp32c6 = { version = "0.21.0", features = ["critical-section"] }
[features] rtic = { path = "../../rtic/" }
test-critical-section = [] rtic-monotonics = { path = "../../rtic-monotonics/" }
riscv-esp32c6-backend = ["rtic/riscv-esp32c6-backend", "rtic-monotonics/esp32c6-systimer"]

View file

@ -1,34 +1,39 @@
### ESP32-C6 RTIC template # ESP32-C6 RTIC template
This crate showcases a simple RTIC application for the ESP32-C6. This crate showcases a simple RTIC application for the ESP32-C6.
## Prerequisites ## Prerequisites
# Espressif toolchain ### Espressif toolchain
This crate uses the most convenient option in ``cargo-espflash`` and ``espflash`` This crate uses the most convenient option in ``cargo-espflash`` and ``espflash``
```cargo install cargo-espflash espflash``` ```cargo install cargo-espflash espflash```
## Running the crate ## Running the crate
```cargo run --example sw_and_hw --features=riscv-esp32c6-backend (--release)``` ```cargo run --example sw_and_hw (--release)```
should do the trick. should do the trick.
# Expected behavior ## Expected behavior
The example ``sw_and_hw`` The example ``sw_and_hw``
- Prints ``init``
- Enters a high prio task - Prints ``init``,
- During the execution of the high prio task, the button should be non-functional - Enters a high prio task,
- Pends a low prio task - During the execution of the high prio task, the button should be non-functional,
- Exits the high prio task - Pends a low prio task,
- Enters the low prio task - Exits the high prio task,
- During the execution of the low prio task, the button should be functional. - Enters the low prio task,
- Exits the low prio task - During the execution of the low prio task, the button should be functional,
- Prints ``idle`` - Exits the low prio task, and
- Prints ``idle``.
The example ``monotonic`` The example ``monotonic``
- Prints ``init``
- Spawns the ``foo``, ``bar``, ``baz`` tasks (because of hardware interrupt latency dispatch, the order here may vary). - Prints ``init``,
- Each task prints ``hello from $TASK`` on entry - Spawns the ``foo``, ``bar``, ``baz`` tasks (because of hardware interrupt latency dispatch, the order here may vary),
- The tasks wait for 1, 2, 3 seconds respectively - Each task prints ``hello from $TASK`` on entry,
- The tasks wait for 1, 2, 3 seconds respectively, and
- Once the wait period is over, each task exits printing ``bye from $TASK`` (now in the proper order). - Once the wait period is over, each task exits printing ``bye from $TASK`` (now in the proper order).

View file

@ -1,6 +1,14 @@
#![deny(
clippy::mem_forget,
reason = "mem::forget is generally not safe to do with esp_hal types, especially those \
holding buffers for the duration of a data transfer."
)]
#![no_main] #![no_main]
#![no_std] #![no_std]
use esp_backtrace as _; use esp_backtrace as _;
esp_bootloader_esp_idf::esp_app_desc!();
#[rtic::app(device = esp32c6, dispatchers = [])] #[rtic::app(device = esp32c6, dispatchers = [])]
mod app { mod app {
use rtic_monotonics::esp32c6::prelude::*; use rtic_monotonics::esp32c6::prelude::*;

View file

@ -1,6 +1,13 @@
#![deny(
clippy::mem_forget,
reason = "mem::forget is generally not safe to do with esp_hal types, especially those \
holding buffers for the duration of a data transfer."
)]
#![no_main] #![no_main]
#![no_std] #![no_std]
esp_bootloader_esp_idf::esp_app_desc!();
#[rtic::app(device = esp32c6, dispatchers=[FROM_CPU_INTR0, FROM_CPU_INTR1])] #[rtic::app(device = esp32c6, dispatchers=[FROM_CPU_INTR0, FROM_CPU_INTR1])]
mod app { mod app {
use esp_backtrace as _; use esp_backtrace as _;

View file

@ -15,8 +15,8 @@ mod esp32c6 {
use syn::{parse, Attribute, Ident}; use syn::{parse, Attribute, Ident};
// esp-hal reserves interrupts 1-19: // esp-hal reserves interrupts 1-19:
// https://github.com/esp-rs/esp-hal/blob/esp-hal-v1.0.0-beta.0/esp-hal/src/interrupt/riscv.rs#L200 // https://github.com/esp-rs/esp-hal/blob/esp-hal-v1.0.0-rc.0/esp-hal/src/interrupt/riscv.rs#L209
// https://github.com/esp-rs/esp-hal/blob/esp-hal-v1.0.0-beta.0/esp-hal/src/interrupt/riscv.rs#L725 // https://github.com/esp-rs/esp-hal/blob/esp-hal-v1.0.0-rc.0/esp-hal/src/interrupt/riscv.rs#L597
const EXTERNAL_INTERRUPTS: [u8; 12] = [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]; const EXTERNAL_INTERRUPTS: [u8; 12] = [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]

View file

@ -67,8 +67,8 @@ stm32-metapac = { version = "15.0.0", optional = true }
# i.MX RT # i.MX RT
imxrt-ral = { version = "0.6.1", optional = true } imxrt-ral = { version = "0.6.1", optional = true }
esp32c3 = {version = "0.29.0", optional = true } esp32c3 = {version = "0.30.0", optional = true }
esp32c6 = {version = "0.20.0", optional = true } esp32c6 = {version = "0.21.0", optional = true }
riscv = {version = "0.14.0", optional = true } riscv = {version = "0.14.0", optional = true }
[build-dependencies] [build-dependencies]

View file

@ -26,8 +26,8 @@ name = "rtic"
[dependencies] [dependencies]
riscv-slic = { version = "0.2.0", optional = true } riscv-slic = { version = "0.2.0", optional = true }
esp32c3 = { version = "0.29.0", optional = true } esp32c3 = { version = "0.30.0", optional = true }
esp32c6 = { version = "0.20.0", optional = true } esp32c6 = { version = "0.21.0", optional = true }
riscv = { version = "0.14.0", optional = true } riscv = { version = "0.14.0", optional = true }
cortex-m = { version = "0.7.0", optional = true } cortex-m = { version = "0.7.0", optional = true }
bare-metal = "1.0.0" bare-metal = "1.0.0"