Skip to content

Commit

Permalink
build for esp-wroom-32
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Nov 16, 2023
1 parent 0abd9c2 commit c43af88
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
25 changes: 21 additions & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
[build]
target = "riscv32imc-esp-espidf"
#target = "xtensa-esp8266-none-elf"
target = "xtensa-esp32-espidf"
#target = "riscv32imc-esp-espidf"

[target.riscv32imc-esp-espidf]
linker = "ldproxy"
# runner = "espflash --monitor" # Select this runner for espflash v1.x.x
runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x
runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x
rustflags = ["--cfg", "espidf_time64", "-C", "default-linker-libraries"]

[target.xtensa-esp32-espidf]
linker = "ldproxy"
# runner = "espflash --monitor" # Select this runner for espflash v1.x.x
runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x
# Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110
rustflags = ["--cfg", "espidf_time64"]

[target.xtensa-esp8266-none-elf]
linker = "ldproxy"
# runner = "espflash --monitor" # Select this runner for espflash v1.x.x
runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x
# Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110
rustflags = ["--cfg", "espidf_time64"]

[unstable]
build-std = ["std", "panic_abort"]

[env]
MCU="esp32c3"
#MCU = "esp8266"
MCU = "esp32"
#MCU = "esp32c3"
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
ESP_IDF_VERSION = "v5.1.1"

4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"args": {
"CONTAINER_USER": "esp",
"CONTAINER_GROUP": "esp",
"ESP_BOARD": "esp32c3"
"ESP_BOARD": "esp32"
}
},
"settings": {
Expand Down Expand Up @@ -41,4 +41,4 @@
],
"workspaceMount": "source=${localWorkspaceFolder},target=/home/esp/esp_ping_leds,type=bind,consistency=cached",
"workspaceFolder": "/home/esp/esp_ping_leds"
}
}
8 changes: 6 additions & 2 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[toolchain]
channel = "nightly"
components = ["rust-src"]
# xtensa
channel = "esp"

# risc-v
#channel = "nightly"
#components = ["rust-src"]
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const MAX_HEALTHY_DURATION: Duration = Duration::from_millis(500);
const LED_STRIP_DURATION: Duration = Duration::from_secs(60);
const LED_COUNT: u32 = 16;
const RESTART_SECONDS: u32 = 3;
const LED_GPIO: u32 = 13; // 6 for C3 mini, wokwi, 13 for ESP-WROOM-32

fn main() -> anyhow::Result<()> {
// It is necessary to call this function once. Otherwise some patches to the runtime
Expand All @@ -34,11 +35,14 @@ fn main() -> anyhow::Result<()> {
log::info!("Get NVS partition");
let nvs = EspDefaultNvsPartition::take()?;

log::info!("Allocate wifi");
let mut wifi = EspWifi::new(peripherals.modem, sysloop.clone(), Some(nvs))?;
let wifi_ssid = WIFI_SSID.unwrap_or("Wokwi-GUEST");
let wifi_pass = WIFI_PASS.unwrap_or("");

let mut ws2812 = Ws2812Esp32Rmt::new(0, 6)?;
log::info!("LED setup");
let mut ws2812 = Ws2812Esp32Rmt::new(0, LED_GPIO)?;
log::info!("LED boot debug lights");
debug_lights(&mut ws2812, 1)?;

match connect_wifi(&mut ws2812, &mut wifi, wifi_ssid, wifi_pass) {
Expand Down

0 comments on commit c43af88

Please sign in to comment.