This commit is contained in:
Invariantspace 2025-04-27 07:19:52 +08:00 committed by macronova
parent dc4de4c184
commit dfb4b1e765
Signed by: macronova
GPG key ID: CE969670FB4B4A56
10 changed files with 2029 additions and 5 deletions

View file

@ -0,0 +1,16 @@
[build]
target = "riscv32imac-esp-espidf"
[target.riscv32imac-esp-espidf]
linker = "ldproxy"
runner = "espflash flash --monitor"
rustflags = [ "--cfg", "espidf_time64"]
[unstable]
build-std = ["std", "panic_abort"]
[env]
MCU="esp32c6"
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
# ESP_IDF_VERSION = "v5.2.3"

1786
xiao-esp32c6/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

31
xiao-esp32c6/Cargo.toml Normal file
View file

@ -0,0 +1,31 @@
[package]
name = "xiao-esp32c6"
version = "0.1.0"
edition = "2024"
[[bin]]
name = "xiao-esp32c6"
harness = false
[build-dependencies]
embuild = "*"
[dependencies]
critical-section = { version = "*", features = ["std"] }
embassy-executor = { version = "*", features = ["arch-std", "executor-thread", "log"] }
esp-idf-svc = { version = "*", features = ["embassy-time-driver"] }
log = "*"
riscv-rt = "*"
static_cell = "*"
[features]
default = []
experimental = ["esp-idf-svc/experimental"]
[profile.release]
opt-level = "s"
[profile.dev]
debug = true
opt-level = "z"

3
xiao-esp32c6/build.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
embuild::espidf::sysenv::output();
}

View file

@ -0,0 +1,10 @@
# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K)
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8000
# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default).
# This allows to use 1 ms granularity for thread sleeps (10 ms by default).
#CONFIG_FREERTOS_HZ=1000
# Workaround for https://github.com/espressif/esp-idf/issues/7631
#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n
#CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n

View file

@ -0,0 +1,16 @@
#![no_main]
use embassy_executor::Executor;
use static_cell::StaticCell;
use xiao_esp32c6::entrypoint;
static EXECUTOR: StaticCell<Executor> = StaticCell::new();
#[unsafe(no_mangle)]
fn main() {
EXECUTOR.init(Executor::new()).run(|spawner| {
spawner
.spawn(entrypoint(spawner))
.expect("Embassy should be able to spawn entrypoint task");
});
}

11
xiao-esp32c6/src/lib.rs Normal file
View file

@ -0,0 +1,11 @@
use embassy_executor::Spawner;
#[embassy_executor::task]
pub async fn entrypoint(_spawner: Spawner) {
// It is necessary to call this function once. Otherwise some patches to the runtime
// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71
esp_idf_svc::sys::link_patches();
// Bind the log crate to the ESP Logging facilities
esp_idf_svc::log::EspLogger::initialize_default();
}