mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 12:55:23 +01:00
Update esp32c{3,6} support to esp-hal-1.0.0-rc.0.
This commit is contained in:
parent
1365471f5a
commit
e8c260a745
15 changed files with 949 additions and 633 deletions
|
|
@ -1,16 +1,20 @@
|
|||
[target.riscv32imc-unknown-none-elf]
|
||||
# Real hardware
|
||||
# runner = "espflash flash --monitor"
|
||||
# runner = "espflash flash --monitor --chip esp32c3"
|
||||
|
||||
# QEMU emulator
|
||||
runner = "./runner.sh"
|
||||
|
||||
[build]
|
||||
rustflags = [
|
||||
"-C", "link-arg=-Tlinkall.x",
|
||||
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
|
||||
# NOTE: May negatively impact performance of produced code
|
||||
"-C", "force-frame-pointers",
|
||||
# This should be last.
|
||||
"-C", "link-arg=-Tlinkall.x",
|
||||
]
|
||||
|
||||
target = "riscv32imc-unknown-none-elf"
|
||||
|
||||
[unstable]
|
||||
build-std = ["alloc", "core"]
|
||||
|
|
|
|||
697
examples/esp32c3/Cargo.lock
generated
697
examples/esp32c3/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,24 +1,25 @@
|
|||
[package]
|
||||
name = "esp32-c3"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[workspace]
|
||||
|
||||
[features]
|
||||
test-critical-section = []
|
||||
riscv-esp32c3-backend = ["rtic/riscv-esp32c3-backend", "rtic-monotonics/esp32c3-systimer"]
|
||||
|
||||
[dependencies]
|
||||
rtic = { path = "../../rtic/" }
|
||||
rtic-monotonics = {path = "../../rtic-monotonics/"}
|
||||
esp-hal = { version = "1.0.0-beta.0", features = ["esp32c3", "unstable"] }
|
||||
esp-backtrace = { version = "0.15.0", features = [
|
||||
esp-backtrace = { version = "0.17.0", features = [
|
||||
"esp32c3",
|
||||
"panic-handler",
|
||||
"exception-handler",
|
||||
"println",
|
||||
] }
|
||||
esp32c3 = {version = "0.29.0", features = ["critical-section"]}
|
||||
esp-println = { version = "0.13.0", features = ["esp32c3"] }
|
||||
|
||||
[features]
|
||||
test-critical-section = []
|
||||
riscv-esp32c3-backend = ["rtic/riscv-esp32c3-backend", "rtic-monotonics/esp32c3-systimer"]
|
||||
esp-bootloader-esp-idf = { version = "0.2.0", features = ["esp32c3"] }
|
||||
esp-hal = { version = "=1.0.0-rc.0", features = ["esp32c3", "unstable"] }
|
||||
esp-println = { version = "0.15.0", features = ["esp32c3"] }
|
||||
esp32c3 = { version = "0.30.0", features = ["critical-section"] }
|
||||
rtic = { path = "../../rtic/" }
|
||||
rtic-monotonics = { path = "../../rtic-monotonics/" }
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
### ESP32-C3 RTIC template
|
||||
# ESP32-C3 RTIC template
|
||||
|
||||
This crate showcases a simple RTIC application for the ESP32-C3.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
# Espressif toolchain
|
||||
### Espressif toolchain
|
||||
|
||||
This crate uses the most convenient option in ``cargo-espflash`` and ``espflash``
|
||||
```cargo install cargo-espflash espflash```
|
||||
|
|
@ -26,7 +27,8 @@ Now, running
|
|||
|
||||
in the root of this crate should do the trick.
|
||||
|
||||
# Expected behavior
|
||||
## Expected behavior
|
||||
|
||||
The example ``sw_and_hw``
|
||||
- Prints ``init``
|
||||
- Enters a high prio task
|
||||
|
|
|
|||
|
|
@ -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_std]
|
||||
use esp_backtrace as _;
|
||||
|
||||
esp_bootloader_esp_idf::esp_app_desc!();
|
||||
|
||||
#[rtic::app(device = esp32c3, dispatchers = [])]
|
||||
mod app {
|
||||
use rtic_monotonics::esp32c3::prelude::*;
|
||||
|
|
|
|||
|
|
@ -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_std]
|
||||
|
||||
esp_bootloader_esp_idf::esp_app_desc!();
|
||||
|
||||
#[rtic::app(device = esp32c3, dispatchers=[FROM_CPU_INTR0, FROM_CPU_INTR1])]
|
||||
mod app {
|
||||
use esp_backtrace as _;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
[target.riscv32imac-unknown-none-elf]
|
||||
runner = "espflash flash --monitor"
|
||||
runner = "espflash flash --monitor --chip esp32c6"
|
||||
|
||||
[build]
|
||||
rustflags = [
|
||||
"-C", "link-arg=-Tlinkall.x",
|
||||
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
|
||||
# NOTE: May negatively impact performance of produced code
|
||||
"-C", "force-frame-pointers",
|
||||
# This should be last.
|
||||
"-C", "link-arg=-Tlinkall.x",
|
||||
]
|
||||
|
||||
target = "riscv32imac-unknown-none-elf"
|
||||
|
||||
[unstable]
|
||||
build-std = ["core"]
|
||||
build-std = ["alloc", "core"]
|
||||
|
|
|
|||
733
examples/esp32c6/Cargo.lock
generated
733
examples/esp32c6/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +1,25 @@
|
|||
[package]
|
||||
name = "esp32-c6"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[workspace]
|
||||
|
||||
[features]
|
||||
test-critical-section = []
|
||||
riscv-esp32c6-backend = ["rtic/riscv-esp32c6-backend", "rtic-monotonics/esp32c6-systimer"]
|
||||
|
||||
[dependencies]
|
||||
rtic = { path = "../../rtic/" }
|
||||
rtic-monotonics = {path = "../../rtic-monotonics/"}
|
||||
esp-hal = { version = "1.0.0-beta.0", features = ["esp32c6", "unstable"] }
|
||||
esp-backtrace = { version = "0.15.1", features = [
|
||||
esp-backtrace = { version = "0.17.0", features = [
|
||||
"esp32c6",
|
||||
"panic-handler",
|
||||
"exception-handler",
|
||||
"println",
|
||||
] }
|
||||
|
||||
esp32c6 = {version = "0.20.0", features = ["critical-section"]}
|
||||
esp-println = { version = "0.13.1", features = ["esp32c6", "auto"] }
|
||||
|
||||
[features]
|
||||
test-critical-section = []
|
||||
riscv-esp32c6-backend = ["rtic/riscv-esp32c6-backend", "rtic-monotonics/esp32c6-systimer"]
|
||||
esp-bootloader-esp-idf = { version = "0.2.0", features = ["esp32c6"] }
|
||||
esp-hal = { version = "=1.0.0-rc.0", features = ["esp32c6", "unstable"] }
|
||||
esp-println = { version = "0.15.0", features = ["esp32c6", "auto"] }
|
||||
esp32c6 = { version = "0.21.0", features = ["critical-section"] }
|
||||
rtic = { path = "../../rtic/" }
|
||||
rtic-monotonics = { path = "../../rtic-monotonics/" }
|
||||
|
|
|
|||
|
|
@ -1,34 +1,39 @@
|
|||
### ESP32-C6 RTIC template
|
||||
# ESP32-C6 RTIC template
|
||||
|
||||
This crate showcases a simple RTIC application for the ESP32-C6.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
# Espressif toolchain
|
||||
### Espressif toolchain
|
||||
|
||||
This crate uses the most convenient option in ``cargo-espflash`` and ``espflash``
|
||||
|
||||
```cargo install cargo-espflash espflash```
|
||||
|
||||
## 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.
|
||||
|
||||
# Expected behavior
|
||||
## 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``
|
||||
|
||||
- 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, and
|
||||
- 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
|
||||
|
||||
- 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, and
|
||||
- Once the wait period is over, each task exits printing ``bye from $TASK`` (now in the proper order).
|
||||
|
|
|
|||
|
|
@ -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_std]
|
||||
use esp_backtrace as _;
|
||||
|
||||
esp_bootloader_esp_idf::esp_app_desc!();
|
||||
|
||||
#[rtic::app(device = esp32c6, dispatchers = [])]
|
||||
mod app {
|
||||
use rtic_monotonics::esp32c6::prelude::*;
|
||||
|
|
|
|||
|
|
@ -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_std]
|
||||
|
||||
esp_bootloader_esp_idf::esp_app_desc!();
|
||||
|
||||
#[rtic::app(device = esp32c6, dispatchers=[FROM_CPU_INTR0, FROM_CPU_INTR1])]
|
||||
mod app {
|
||||
use esp_backtrace as _;
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ mod esp32c6 {
|
|||
use syn::{parse, Attribute, Ident};
|
||||
|
||||
// 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-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#L209
|
||||
// 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];
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ stm32-metapac = { version = "15.0.0", optional = true }
|
|||
# i.MX RT
|
||||
imxrt-ral = { version = "0.6.1", optional = true }
|
||||
|
||||
esp32c3 = {version = "0.29.0", optional = true }
|
||||
esp32c6 = {version = "0.20.0", optional = true }
|
||||
esp32c3 = {version = "0.30.0", optional = true }
|
||||
esp32c6 = {version = "0.21.0", optional = true }
|
||||
riscv = {version = "0.14.0", optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ name = "rtic"
|
|||
|
||||
[dependencies]
|
||||
riscv-slic = { version = "0.2.0", optional = true }
|
||||
esp32c3 = { version = "0.29.0", optional = true }
|
||||
esp32c6 = { version = "0.20.0", optional = true }
|
||||
esp32c3 = { version = "0.30.0", optional = true }
|
||||
esp32c6 = { version = "0.21.0", optional = true }
|
||||
riscv = { version = "0.14.0", optional = true }
|
||||
cortex-m = { version = "0.7.0", optional = true }
|
||||
bare-metal = "1.0.0"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue