XIAO
This commit is contained in:
parent
dc4de4c184
commit
dfb4b1e765
10 changed files with 2029 additions and 5 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -3,3 +3,8 @@
|
|||
!.gitignore
|
||||
!flake.nix
|
||||
!flake.lock
|
||||
|
||||
!xiao-esp32c6/
|
||||
!xiao-esp32c6/**
|
||||
xiao-esp32c6/.embuild
|
||||
xiao-esp32c6/target
|
||||
|
|
|
|||
129
flake.lock
generated
129
flake.lock
generated
|
|
@ -50,6 +50,44 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"espkgs": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738140586,
|
||||
"narHash": "sha256-Vn4PD4eH18QklgDY1vnjXJqNPmP3SJNejcBroW0yTTA=",
|
||||
"owner": "mirrexagon",
|
||||
"repo": "nixpkgs-esp-dev",
|
||||
"rev": "29517b39abe729e04118bf77af526f9947f6c476",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mirrexagon",
|
||||
"repo": "nixpkgs-esp-dev",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745649180,
|
||||
"narHash": "sha256-3Ptviong+IYr9y3W6ddJMQDn/VpnTQHgwGU3i022HtA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "585fc772cd167cad7d30222b2eb5f5e4bb2166b9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -108,6 +146,24 @@
|
|||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
|
|
@ -237,7 +293,7 @@
|
|||
"nixpkgs-python": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"nixpkgs": "nixpkgs_5"
|
||||
"nixpkgs": "nixpkgs_7"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1745481253,
|
||||
|
|
@ -286,6 +342,37 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1729501122,
|
||||
"narHash": "sha256-tScdcYQ37kMqlyqb5yizNDTKXZASLB4zHitlHwOg+/o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "56c7c4a3f5fdbef5bf81c7d9c28fbb45dc626611",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1745526057,
|
||||
"narHash": "sha256-ITSpPDwvLBZBnPRS2bUcHY3gZSwis/uTe255QgMtTLA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f771eb401a46846c1aebd20552521b233dd7e18b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1745526057,
|
||||
"narHash": "sha256-ITSpPDwvLBZBnPRS2bUcHY3gZSwis/uTe255QgMtTLA=",
|
||||
|
|
@ -301,7 +388,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"nixpkgs_7": {
|
||||
"locked": {
|
||||
"lastModified": 1719253556,
|
||||
"narHash": "sha256-A/76RFUVxZ/7Y8+OMVL1Lc8LRhBxZ8ZE2bpMnvZ1VpY=",
|
||||
|
|
@ -320,11 +407,30 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"espkgs": "espkgs",
|
||||
"fenix": "fenix",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_6",
|
||||
"nixpkgs-python": "nixpkgs-python"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1745591749,
|
||||
"narHash": "sha256-ynI1QfQEMHHuO+hJ8RLzhCo31XLm86vI7zRjKMQ45BQ=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "df594ba8f4f72064002a4170eea031ba4300f087",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
|
|
@ -339,6 +445,21 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
27
flake.nix
27
flake.nix
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
inputs = {
|
||||
devenv.url = "github:cachix/devenv";
|
||||
espkgs.url = "github:mirrexagon/nixpkgs-esp-dev";
|
||||
fenix.url = "github:nix-community/fenix";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-python.url = "github:cachix/nixpkgs-python";
|
||||
|
|
@ -9,6 +11,7 @@
|
|||
outputs = inputs @ {
|
||||
self,
|
||||
devenv,
|
||||
espkgs,
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
...
|
||||
|
|
@ -18,6 +21,7 @@
|
|||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
espPkgs = espkgs.packages.${system};
|
||||
in {
|
||||
packages = {
|
||||
devenv-up = self.devShells.${system}.default.config.procfileScript;
|
||||
|
|
@ -28,12 +32,33 @@
|
|||
inherit inputs pkgs;
|
||||
modules = [
|
||||
{
|
||||
env = {
|
||||
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
||||
};
|
||||
git-hooks.hooks.alejandra.enable = true;
|
||||
languages = {
|
||||
nix.enable = true;
|
||||
rust.enable = true;
|
||||
python.enable = true;
|
||||
rust = {
|
||||
enable = true;
|
||||
channel = "nightly";
|
||||
components = [
|
||||
"cargo"
|
||||
"clippy"
|
||||
"rustc"
|
||||
"rustfmt"
|
||||
"rust-analyzer"
|
||||
"rust-src"
|
||||
];
|
||||
mold.enable = false;
|
||||
};
|
||||
typst.enable = true;
|
||||
};
|
||||
packages = with pkgs; [
|
||||
espflash
|
||||
espPkgs.esp-idf-esp32c6
|
||||
ldproxy
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
|||
16
xiao-esp32c6/.cargo/config.toml
Normal file
16
xiao-esp32c6/.cargo/config.toml
Normal 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
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
31
xiao-esp32c6/Cargo.toml
Normal 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
3
xiao-esp32c6/build.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
embuild::espidf::sysenv::output();
|
||||
}
|
||||
10
xiao-esp32c6/sdkconfig.defaults
Normal file
10
xiao-esp32c6/sdkconfig.defaults
Normal 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
|
||||
16
xiao-esp32c6/src/bin/xiao-esp32c6.rs
Normal file
16
xiao-esp32c6/src/bin/xiao-esp32c6.rs
Normal 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
11
xiao-esp32c6/src/lib.rs
Normal 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue