-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SYSTIMER based ESP32-C3 monotonic (#972)
* add esp32c3 monotonic * fix tests
- Loading branch information
Showing
12 changed files
with
395 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
QEMU 8.2.0 monitor - type 'help' for more information | ||
(qemu) q[K | ||
ESP-ROM:esp32c3-api1-20210207 | ||
Build:Feb 7 2021 | ||
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT) | ||
SPIWP:0xee | ||
mode:DIO, clock div:2 | ||
load:0x3fcd5820,len:0x1714 | ||
load:0x403cc710,len:0x968 | ||
load:0x403ce710,len:0x2f9c | ||
entry 0x403cc710 | ||
[0;32mI (0) boot: ESP-IDF v5.1.2-342-gbcf1645e44 2nd stage bootloader[0m | ||
[0;32mI (0) boot: compile time Dec 12 2023 10:50:58[0m | ||
[0;32mI (0) boot: chip revision: v0.3[0m | ||
[0;32mI (0) boot.esp32c3: SPI Speed : 40MHz[0m | ||
[0;32mI (0) boot.esp32c3: SPI Mode : SLOW READ[0m | ||
[0;32mI (0) boot.esp32c3: SPI Flash Size : 4MB[0m | ||
[0;32mI (0) boot: Enabling RNG early entropy source...[0m | ||
[0;32mI (1) boot: Partition Table:[0m | ||
[0;32mI (1) boot: ## Label Usage Type ST Offset Length[0m | ||
[0;32mI (1) boot: 0 nvs WiFi data 01 02 00009000 00006000[0m | ||
[0;32mI (1) boot: 1 phy_init RF data 01 01 0000f000 00001000[0m | ||
[0;32mI (1) boot: 2 factory factory app 00 00 00010000 003f0000[0m | ||
[0;32mI (1) boot: End of partition table[0m | ||
[0;32mI (1) esp_image: REDACTED | ||
[0;32mI (3) esp_image: REDACTED | ||
[0;32mI (3) esp_image: REDACTED | ||
[0;32mI (8) esp_image: REDACTED | ||
[0;32mI (11) boot: Loaded app from partition at offset 0x10000[0m | ||
[0;32mI (11) boot: Disabling RNG early entropy source...[0m | ||
init | ||
hello from bar | ||
hello from baz | ||
hello from foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#![no_main] | ||
#![no_std] | ||
use esp_backtrace as _; | ||
#[rtic::app(device = esp32c3, dispatchers = [])] | ||
mod app { | ||
use rtic_monotonics::esp32c3::prelude::*; | ||
esp32c3_systimer_monotonic!(Mono); | ||
use esp_hal as _; | ||
use esp_println::println; | ||
|
||
#[shared] | ||
struct Shared {} | ||
|
||
#[local] | ||
struct Local {} | ||
|
||
#[init] | ||
fn init(cx: init::Context) -> (Shared, Local) { | ||
println!("init"); | ||
let timer = cx.device.SYSTIMER; | ||
|
||
Mono::start(timer); | ||
|
||
foo::spawn().unwrap(); | ||
bar::spawn().unwrap(); | ||
baz::spawn().unwrap(); | ||
|
||
(Shared {}, Local {}) | ||
} | ||
|
||
#[task] | ||
async fn foo(_cx: foo::Context) { | ||
println!("hello from foo"); | ||
Mono::delay(2_u64.secs()).await; | ||
println!("bye from foo"); | ||
} | ||
|
||
#[task] | ||
async fn bar(_cx: bar::Context) { | ||
println!("hello from bar"); | ||
Mono::delay(3_u64.secs()).await; | ||
println!("bye from bar"); | ||
} | ||
|
||
#[task] | ||
async fn baz(_cx: baz::Context) { | ||
println!("hello from baz"); | ||
Mono::delay(4_u64.secs()).await; | ||
println!("bye from baz"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[toolchain] | ||
channel = "nightly-2023-11-14" | ||
channel = "stable" | ||
components = ["rust-src"] | ||
targets = ["riscv32imc-unknown-none-elf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.