Initial testing, have a blinking LED

This commit is contained in:
Netwxx
2026-08-05 14:35:48 -07:00
commit 1185217fd0
8 changed files with 88 additions and 0 deletions

19
.cargo/config.toml Normal file
View File

@@ -0,0 +1,19 @@
[build]
target = "xtensa-esp32s3-espidf"
[target.'cfg(target_os = "espidf")']
linker = "ldproxy"
runner = "espflash flash --monitor"
rustflags = [ "--cfg", "espidf_time64"]
[unstable]
build-std = ["std", "panic_abort"]
[env]
MCU = "esp32s3"
ESP_IDF_VERSION = "v5.5.3"
ESP_IDF_TOOLS_INSTALL_DIR = "workspace"
# Uncomment this if you have moved the target dir by setting CARGO_TARGET_DIR or similar.
# Required for now due to embuild limitations.
#CARGO_WORKSPACE_DIR = { value = "", relative = true }

1
.envrc Normal file
View File

@@ -0,0 +1 @@
source /home/wyatt/Applications/esp32/export-esp.sh

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
/.vscode
/.embuild
/target
/Cargo.lock

27
Cargo.toml Normal file
View File

@@ -0,0 +1,27 @@
[package]
name = "esp32_experiments"
version = "0.1.0"
authors = ["Netwxx <netwxxt@gmail.com>"]
edition = "2021"
resolver = "2"
rust-version = "1.82"
[[bin]]
name = "esp32_experiments"
harness = false # do not use the built-in cargo test harness -> resolve rust-analyzer errors
[profile.release]
opt-level = "s"
[profile.dev]
debug = true # Symbols are nice, and they don't increase the size on Flash
opt-level = "z"
[dependencies]
log = "0.4"
esp-idf-svc = { version = "0.52.1", features = ["critical-section", "embassy-time-driver", "embassy-sync"] }
# Remove `generic-queue-8` if you plan to use `embassy-time` WITH `embassy-executor`
embassy-time = { version = "0.5", features = ["generic-queue-8"] }
[build-dependencies]
embuild = "0.33"

3
build.rs Normal file
View File

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

2
rust-toolchain.toml Normal file
View File

@@ -0,0 +1,2 @@
[toolchain]
channel = "esp"

12
sdkconfig.defaults Normal file
View File

@@ -0,0 +1,12 @@
# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K)
# You might have to increase this further if you allocate large stack variables in the main task
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
# Increase a bit these stack sizes as they are also a bit too small by default
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=4096
# You might have to increase this further if you spawn your own Rust threads
# that allocate large stack variables; or better yet - use
# `std::thread::Builder::new().stack_size(XXX)` for spawning
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=4096

20
src/main.rs Normal file
View File

@@ -0,0 +1,20 @@
use esp_idf_svc::hal::delay::FreeRtos;
use esp_idf_svc::hal::gpio::PinDriver;
use esp_idf_svc::hal::peripherals::Peripherals;
fn main() {
esp_idf_svc::sys::link_patches();
esp_idf_svc::log::EspLogger::initialize_default();
log::info!("Hello, world!");
let peripherals = Peripherals::take().unwrap();
let mut led = PinDriver::output(peripherals.pins.gpio17).unwrap();
loop {
led.set_high().unwrap();
FreeRtos::delay_ms(500);
led.set_low().unwrap();
FreeRtos::delay_ms(500);
log::info!("Blink");
}
}