Skip to content

Commit 97bd17c

Browse files
authored
Update to esp-hal RC1 (#45)
* Update to esp-hal from GIT * Update to embassy-nrf 0.8 * Update to esp-rtos * Update to just-released esp-hal rc1 * Remove unnecessary parenthesis
1 parent 0bfc15b commit 97bd17c

File tree

15 files changed

+1067
-636
lines changed

15 files changed

+1067
-636
lines changed

examples/esp/Cargo.lock

Lines changed: 544 additions & 312 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/esp/Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resolver = "2"
77
categories = ["embedded", "hardware-support"]
88
keywords = ["thread", "openthread", "embedded", "embassy"]
99
description = "openthread examples for Espressif chips"
10-
repository = "https://github.com/ivmarkov/esp-openthread"
10+
repository = "https://github.com/esp-rs/openthread"
1111
license = "MIT OR Apache-2.0"
1212
readme = "README.md"
1313
rust-version = "1.84"
@@ -27,29 +27,29 @@ overflow-checks = false
2727

2828
[features]
2929
default = ["esp32c6"]
30-
esp32c6 = [ "esp-hal-embassy/esp32c6", "esp-ieee802154/esp32c6", "esp-backtrace/esp32c6", "esp-println/esp32c6", "esp-bootloader-esp-idf/esp32c6"]
31-
esp32h2 = [ "esp-hal-embassy/esp32h2", "esp-ieee802154/esp32h2", "esp-backtrace/esp32h2", "esp-println/esp32h2", "esp-bootloader-esp-idf/esp32h2"]
30+
esp32c6 = ["esp-rtos/esp32c6", "esp-radio/esp32c6", "esp-backtrace/esp32c6", "esp-println/esp32c6", "esp-bootloader-esp-idf/esp32c6"]
31+
esp32h2 = ["esp-rtos/esp32h2", "esp-radio/esp32h2", "esp-backtrace/esp32h2", "esp-println/esp32h2", "esp-bootloader-esp-idf/esp32h2"]
3232

3333
[dependencies]
34-
embassy-executor = { version = "0.7", features = ["task-arena-size-32768", "log"] }
34+
embassy-executor = "0.9"
3535
embassy-sync = "0.7"
3636
embassy-futures = "0.1"
37-
embassy-time = "0.4"
38-
embassy-net = { version = "0.6", features = ["proto-ipv6", "medium-ip", "udp", "log"] }
39-
esp-hal = { version = "=1.0.0-rc.0", features = ["log-04","unstable"] }
40-
esp-hal-embassy = "0.9"
41-
esp-alloc = { version = "0.8", optional = true }
42-
esp-backtrace = { version = "0.17", features = ["panic-handler", "exception-handler", "println"] }
43-
esp-println = { version = "0.15", features = ["log-04"] }
44-
esp-ieee802154 = { version= "0.8", features = ["log-04"] }
45-
esp-bootloader-esp-idf = { version = "0.2", features = ["log-04"] }
37+
embassy-time = "0.5"
38+
embassy-net = { version = "0.7", features = ["proto-ipv6", "medium-ip", "udp", "log"] }
39+
esp-hal = { version = "=1.0.0-rc.1", features = ["log-04", "unstable", "exception-handler"] }
40+
esp-rtos = { version = "0.1.0", features = ["esp-radio", "embassy"] }
41+
esp-alloc = { version = "0.9", optional = true }
42+
esp-backtrace = { version = "0.18", features = ["panic-handler", "println"] }
43+
esp-println = { version = "0.16", features = ["log-04"] }
44+
esp-radio = { version = "0.16", features = ["unstable", "ieee802154"] }
45+
esp-bootloader-esp-idf = { version = "0.3", features = ["log-04"] }
4646
log = "0.4"
4747
heapless = "0.8"
4848
critical-section = "1.2"
4949
rand_core = "0.9"
5050
static_cell = "2.1"
5151

52-
openthread = { path = "../../openthread", features = ["udp", "srp", "embassy-net-driver-channel", "esp-ieee802154", "isupper", "log"] }
52+
openthread = { path = "../../openthread", features = ["udp", "srp", "embassy-net-driver-channel", "esp-radio", "isupper", "log"] }
5353
tinyrlibc = { version = "0.5", default-features = false, features = ["utoa", "strtoul"] }
5454

5555
[[bin]]

examples/esp/src/bin/basic_enet.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use embassy_net::udp::{PacketMetadata, UdpMetadata, UdpSocket};
1717
use embassy_net::{Config, ConfigV6, Ipv6Cidr, Runner, StackResources, StaticConfigV6};
1818

1919
use esp_hal::rng::Rng;
20-
use esp_hal::timer::systimer::SystemTimer;
21-
use esp_ieee802154::Ieee802154;
20+
use esp_hal::timer::timg::TimerGroup;
21+
use esp_radio::ieee802154::Ieee802154;
2222
use {esp_backtrace as _, esp_println as _};
2323

2424
use heapless::Vec;
@@ -41,7 +41,7 @@ macro_rules! mk_static {
4141
($t:ty,$val:expr) => {{
4242
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
4343
#[deny(unused_attributes)]
44-
let x = STATIC_CELL.uninit().write(($val));
44+
let x = STATIC_CELL.uninit().write($val);
4545
x
4646
}};
4747
}
@@ -59,17 +59,24 @@ const THREAD_DATASET: &str = if let Some(dataset) = option_env!("THREAD_DATASET"
5959

6060
esp_bootloader_esp_idf::esp_app_desc!();
6161

62-
#[esp_hal_embassy::main]
62+
#[esp_rtos::main]
6363
async fn main(spawner: Spawner) {
6464
esp_println::logger::init_logger_from_env();
6565

6666
info!("Starting...");
6767

6868
let peripherals = esp_hal::init(esp_hal::Config::default());
6969

70-
esp_hal_embassy::init(SystemTimer::new(peripherals.SYSTIMER).alarm0);
70+
let timg0 = TimerGroup::new(peripherals.TIMG0);
71+
esp_rtos::start(
72+
timg0.timer0,
73+
#[cfg(target_arch = "riscv32")]
74+
esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT)
75+
.software_interrupt0,
76+
);
7177

72-
let rng = mk_static!(Rng, Rng::new(peripherals.RNG));
78+
// TODO: Use TRNG?
79+
let rng = mk_static!(Rng, Rng::new());
7380

7481
let enet_seed = rng.next_u64();
7582

examples/esp/src/bin/basic_udp.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use log::info;
1515
use embassy_executor::Spawner;
1616

1717
use esp_hal::rng::Rng;
18-
use esp_hal::timer::systimer::SystemTimer;
19-
use esp_ieee802154::Ieee802154;
18+
use esp_hal::timer::timg::TimerGroup;
19+
use esp_radio::ieee802154::Ieee802154;
2020
use {esp_backtrace as _, esp_println as _};
2121

2222
use openthread::esp::EspRadio;
@@ -36,7 +36,7 @@ macro_rules! mk_static {
3636
($t:ty,$val:expr) => {{
3737
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
3838
#[deny(unused_attributes)]
39-
let x = STATIC_CELL.uninit().write(($val));
39+
let x = STATIC_CELL.uninit().write($val);
4040
x
4141
}};
4242
}
@@ -54,17 +54,24 @@ const THREAD_DATASET: &str = if let Some(dataset) = option_env!("THREAD_DATASET"
5454

5555
esp_bootloader_esp_idf::esp_app_desc!();
5656

57-
#[esp_hal_embassy::main]
57+
#[esp_rtos::main]
5858
async fn main(spawner: Spawner) {
5959
esp_println::logger::init_logger_from_env();
6060

6161
info!("Starting...");
6262

6363
let peripherals = esp_hal::init(esp_hal::Config::default());
6464

65-
esp_hal_embassy::init(SystemTimer::new(peripherals.SYSTIMER).alarm0);
65+
let timg0 = TimerGroup::new(peripherals.TIMG0);
66+
esp_rtos::start(
67+
timg0.timer0,
68+
#[cfg(target_arch = "riscv32")]
69+
esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT)
70+
.software_interrupt0,
71+
);
6672

67-
let rng = mk_static!(Rng, Rng::new(peripherals.RNG));
73+
// TODO: Use TRNG?
74+
let rng = mk_static!(Rng, Rng::new());
6875

6976
let mut ieee_eui64 = [0; 8];
7077
rng.fill_bytes(&mut ieee_eui64);

examples/esp/src/bin/srp.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use log::info;
1919
use embassy_executor::Spawner;
2020

2121
use esp_hal::rng::Rng;
22-
use esp_hal::timer::systimer::SystemTimer;
23-
use esp_ieee802154::Ieee802154;
22+
use esp_hal::timer::timg::TimerGroup;
23+
use esp_radio::ieee802154::Ieee802154;
2424
use {esp_backtrace as _, esp_println as _};
2525

2626
use openthread::esp::EspRadio;
@@ -41,7 +41,7 @@ macro_rules! mk_static {
4141
($t:ty,$val:expr) => {{
4242
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
4343
#[deny(unused_attributes)]
44-
let x = STATIC_CELL.uninit().write(($val));
44+
let x = STATIC_CELL.uninit().write($val);
4545
x
4646
}};
4747
}
@@ -62,17 +62,24 @@ const THREAD_DATASET: &str = if let Some(dataset) = option_env!("THREAD_DATASET"
6262

6363
esp_bootloader_esp_idf::esp_app_desc!();
6464

65-
#[esp_hal_embassy::main]
65+
#[esp_rtos::main]
6666
async fn main(spawner: Spawner) {
6767
esp_println::logger::init_logger_from_env();
6868

6969
info!("Starting...");
7070

7171
let peripherals = esp_hal::init(esp_hal::Config::default());
7272

73-
esp_hal_embassy::init(SystemTimer::new(peripherals.SYSTIMER).alarm0);
73+
let timg0 = TimerGroup::new(peripherals.TIMG0);
74+
esp_rtos::start(
75+
timg0.timer0,
76+
#[cfg(target_arch = "riscv32")]
77+
esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT)
78+
.software_interrupt0,
79+
);
7480

75-
let rng = mk_static!(Rng, Rng::new(peripherals.RNG));
81+
// TODO: Use TRNG?
82+
let rng = mk_static!(Rng, Rng::new());
7683

7784
let mut ieee_eui64 = [0; 8];
7885
rng.fill_bytes(&mut ieee_eui64);

0 commit comments

Comments
 (0)