From f06a6fb1ba8ddcb02b8fa2a88b08ea9d293a4bef Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 5 Mar 2024 12:32:11 +0100 Subject: [PATCH 1/4] feat: Use unified esp-hal --- Cargo.toml | 16 +++++++++------- pre-script.rhai | 8 -------- src/main.rs | 6 +++--- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index da2e2c6..5c7e1d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,9 @@ license = "MIT OR Apache-2.0" debug = true [dependencies] -{{ mcu }}-hal = "{{ hal_version }}" +esp-hal = { features = [ + "{{ mcu }}", +], git = "https://github.com/esp-rs/esp-hal.git", rev = "6a663f8b1a6bd273cd41d49e2096b8c4906e9da4" } esp-backtrace = { version = "0.11.0", features = ["{{ mcu }}", "panic-handler", "exception-handler", "println"] } {% if logging -%} esp-println = { version = "0.9.0", features = ["{{ mcu }}", "log"] } @@ -21,14 +23,14 @@ esp-println = { version = "0.9.0", features = ["{{ mcu }}"] } esp-alloc = { version = "0.3.0" } {% endif -%} {% if wifi -%} -esp-wifi = { version = "0.3.0", features = ["{{ mcu }}", "wifi"] } +esp-wifi = { git = "https://github.com/esp-rs/esp-wifi", rev = "9be1c01b85d079ea365784216e59ebd0f6a9193d", features = [ + "{{ mcu }}", + "wifi-default", + "utils", + "phy-enable-usb", +] } smoltcp = { version = "0.10.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"] } embedded-svc = { version = "0.26.1", default-features = false, features = [] } embedded-io = "0.6.1" heapless = { version = "0.8.0", default-features = false } {% endif -%} - -{% if mcu == "esp32" or mcu == "esp32c2" %} -[features] -default = ["{{ mcu }}-hal/xtal-40mhz"] -{% endif %} diff --git a/pre-script.rhai b/pre-script.rhai index 36fe5cf..1109057 100644 --- a/pre-script.rhai +++ b/pre-script.rhai @@ -1,37 +1,30 @@ let metadata = #{ // Xtensa devices: esp32: #{ - hal_version: "0.18.0", wokwi_board: "board-esp32-devkit-c-v4", }, esp32s2: #{ - hal_version: "0.15.0", wokwi_board: "board-esp32-s2-devkitm-1", }, esp32s3: #{ - hal_version: "0.15.0", wokwi_board: "board-esp32-s3-devkitc-1", }, // RISC-V devices: esp32c2: #{ extensions: "imc", - hal_version: "0.13.0", wokwi_board: "", }, esp32c3: #{ extensions: "imc", - hal_version: "0.15.0", wokwi_board: "board-esp32-c3-devkitm-1", }, esp32c6: #{ extensions: "imac", - hal_version: "0.8.0", wokwi_board: "board-esp32-c6-devkitc-1", }, esp32h2: #{ extensions: "imac", - hal_version: "0.6.0", wokwi_board: "board-esp32-h2-devkitm-1", }, }; @@ -39,7 +32,6 @@ let metadata = #{ let mcu = variable::get("mcu"); let meta = metadata.get(mcu); -variable::set("hal_version", meta.get("hal_version")); variable::set("wokwi_board", meta.get("wokwi_board")); if mcu in ["esp32", "esp32s2", "esp32s3"] { diff --git a/src/main.rs b/src/main.rs index 33973b8..a1ab439 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,17 +5,17 @@ extern crate alloc; use core::mem::MaybeUninit; {% endif -%} -use {{ mcu }}_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay}; use esp_backtrace as _; +use esp_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay}; use esp_println::println; {% if wifi -%} use esp_wifi::{initialize, EspWifiInitFor}; {% if arch == "riscv" -%} -use {{ mcu }}_hal::{systimer::SystemTimer, Rng}; +use esp_hal::{systimer::SystemTimer, Rng}; {% else -%} -use {{ mcu }}_hal::{timer::TimerGroup, Rng}; +use esp_hal::{timer::TimerGroup, Rng}; {% endif -%} {% endif -%} From 568cc88c4fa7da1147d5bea5056f621c6a890ee9 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 11 Mar 2024 10:00:29 +0100 Subject: [PATCH 2/4] build: Use released esp-hal --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5c7e1d6..6d3e219 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" debug = true [dependencies] -esp-hal = { features = [ +esp-hal = { version = "0.16.0", features = [ "{{ mcu }}" ] } "{{ mcu }}", ], git = "https://github.com/esp-rs/esp-hal.git", rev = "6a663f8b1a6bd273cd41d49e2096b8c4906e9da4" } esp-backtrace = { version = "0.11.0", features = ["{{ mcu }}", "panic-handler", "exception-handler", "println"] } @@ -23,7 +23,7 @@ esp-println = { version = "0.9.0", features = ["{{ mcu }}"] } esp-alloc = { version = "0.3.0" } {% endif -%} {% if wifi -%} -esp-wifi = { git = "https://github.com/esp-rs/esp-wifi", rev = "9be1c01b85d079ea365784216e59ebd0f6a9193d", features = [ +esp-wifi = { git = "https://github.com/esp-rs/esp-wifi", rev = "d5baf9b", features = [ "{{ mcu }}", "wifi-default", "utils", From 244dc36dc8dd90c30e596f6d42d55fbb911a952b Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 11 Mar 2024 10:02:32 +0100 Subject: [PATCH 3/4] style: Format dependencies --- Cargo.toml | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6d3e219..f74f122 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,10 +9,13 @@ license = "MIT OR Apache-2.0" debug = true [dependencies] -esp-hal = { version = "0.16.0", features = [ "{{ mcu }}" ] } +esp-backtrace = { version = "0.11.0", features = [ "{{ mcu }}", -], git = "https://github.com/esp-rs/esp-hal.git", rev = "6a663f8b1a6bd273cd41d49e2096b8c4906e9da4" } -esp-backtrace = { version = "0.11.0", features = ["{{ mcu }}", "panic-handler", "exception-handler", "println"] } + "exception-handler", + "panic-handler", + "println", +] } +esp-hal = { version = "0.16.0", features = [ "{{ mcu }}" ] } {% if logging -%} esp-println = { version = "0.9.0", features = ["{{ mcu }}", "log"] } log = { version = "0.4.20" } @@ -23,14 +26,24 @@ esp-println = { version = "0.9.0", features = ["{{ mcu }}"] } esp-alloc = { version = "0.3.0" } {% endif -%} {% if wifi -%} +embedded-svc = { version = "0.26.1", default-features = false, features = [] } +embedded-io = "0.6.1" esp-wifi = { git = "https://github.com/esp-rs/esp-wifi", rev = "d5baf9b", features = [ "{{ mcu }}", - "wifi-default", - "utils", "phy-enable-usb", + "utils", + "wifi-default", ] } -smoltcp = { version = "0.10.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"] } -embedded-svc = { version = "0.26.1", default-features = false, features = [] } -embedded-io = "0.6.1" heapless = { version = "0.8.0", default-features = false } +smoltcp = { version = "0.10.0", default-features = false, features = [ + "medium-ethernet", + "proto-dhcpv4", + "proto-igmp", + "proto-ipv4", + "socket-dhcpv4", + "socket-icmp", + "socket-raw", + "socket-tcp", + "socket-udp", +] } {% endif -%} From bacf7864aa8024ad7d45f1c8705a8bc16e19a217 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 12 Mar 2024 17:59:42 +0100 Subject: [PATCH 4/4] build: Use esp-wifi release --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f74f122..fcd323c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ esp-alloc = { version = "0.3.0" } {% if wifi -%} embedded-svc = { version = "0.26.1", default-features = false, features = [] } embedded-io = "0.6.1" -esp-wifi = { git = "https://github.com/esp-rs/esp-wifi", rev = "d5baf9b", features = [ +esp-wifi = { version = "0.4.0", features = [ "{{ mcu }}", "phy-enable-usb", "utils",