From 95f24bd069e20cc6b9643826c5219d42ebb8afea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Mon, 6 Nov 2023 14:56:40 +0100 Subject: [PATCH] RISC-V: Make atomic emulation opt-in --- CHANGELOG.md | 2 + esp-hal-common/Cargo.toml | 11 +- esp-hal-common/build.rs | 22 +++ .../src/embassy/executor/xtensa/interrupt.rs | 14 +- .../src/embassy/executor/xtensa/thread.rs | 11 +- esp-hal-common/src/interrupt/riscv.rs | 139 +++++++++--------- esp-hal-common/src/lib.rs | 8 +- esp32-hal/Cargo.toml | 2 +- esp32c2-hal/.cargo/config.toml | 16 -- esp32c2-hal/Cargo.toml | 7 +- esp32c3-hal/.cargo/config.toml | 16 -- esp32c3-hal/Cargo.toml | 7 +- esp32c6-hal/Cargo.toml | 2 +- esp32h2-hal/Cargo.toml | 2 +- esp32s2-hal/Cargo.toml | 2 +- esp32s2-hal/examples/clock_monitor.rs | 1 - esp32s2-hal/examples/embassy_hello_world.rs | 1 - esp32s2-hal/examples/embassy_rmt_rx.rs | 1 - esp32s2-hal/examples/embassy_rmt_tx.rs | 1 - esp32s2-hal/examples/i2c_display.rs | 1 - esp32s2-hal/examples/ledc.rs | 1 - esp32s2-hal/src/lib.rs | 2 - esp32s3-hal/Cargo.toml | 2 +- 23 files changed, 139 insertions(+), 132 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70adf1ee5ac..bedbd9178fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- C2, C3: atomic emulation trap is now opt-in and `esp-hal` now uses `portable-atomic` by default (#904) + ### Fixed - ESP32-C2/C3 examples: fix build error (#899) diff --git a/esp-hal-common/Cargo.toml b/esp-hal-common/Cargo.toml index 67a076e8450..6efc0421f40 100644 --- a/esp-hal-common/Cargo.toml +++ b/esp-hal-common/Cargo.toml @@ -33,6 +33,10 @@ strum = { version = "0.25.0", default-features = false, features void = { version = "1.0.2", default-features = false } usb-device = { version = "0.2.9", optional = true } +# atomic polyfill options +portable-atomic = { version = "1.5.1", default-features = false, optional = true } +riscv-atomic-emulation-trap = { version = "0.4.1", optional = true } + # async embedded-hal-async = { version = "=1.0.0-rc.1", optional = true } embedded-io-async = { version = "0.6.0", optional = true } @@ -43,7 +47,6 @@ embassy-time = { version = "0.1.5", optional = true, features = ["nightly" # RISC-V esp-riscv-rt = { version = "0.5.0", optional = true, path = "../esp-riscv-rt" } -riscv-atomic-emulation-trap = { version = "0.4.1", optional = true } # Xtensa xtensa-lx = { version = "0.8.0", optional = true } @@ -125,9 +128,13 @@ embassy-time-systick = [] embassy-time-timg0 = [] # Architecture-specific features (intended for internal use) -riscv = ["critical-section/restore-state-u8", "esp-riscv-rt", "esp-riscv-rt/zero-bss", "riscv-atomic-emulation-trap"] +riscv = ["critical-section/restore-state-u8", "esp-riscv-rt", "esp-riscv-rt/zero-bss"] xtensa = ["critical-section/restore-state-u32"] +portable-atomic = ["dep:portable-atomic"] +riscv-atomic-emulation = ["dep:riscv-atomic-emulation-trap", "atomic-emulation"] +atomic-emulation = [] + # Initialize / clear data sections and RTC memory rv-init-data = ["esp-riscv-rt/init-data", "esp-riscv-rt/init-rw-text"] rv-zero-rtc-bss = ["esp-riscv-rt/zero-rtc-fast-bss"] diff --git a/esp-hal-common/build.rs b/esp-hal-common/build.rs index c0e5afb836e..095d30e812e 100644 --- a/esp-hal-common/build.rs +++ b/esp-hal-common/build.rs @@ -136,6 +136,28 @@ fn main() -> Result<(), Box> { unreachable!() // We've confirmed exactly one known device was selected }; + // The C6 has an "atomic" peripheral but it's an exception, not the rule + // For S2, we just keep lying for now. The target has emulation support + // force-enabled. + let has_native_atomic_support = matches!( + device_name, + "esp32" | "esp32s2" | "esp32s3" | "esp32c6" | "esp32h2" + ); + + let atomic_emulation_enabled = cfg!(feature = "atomic-emulation"); + let portable_atomic_enabled = cfg!(feature = "portable-atomic"); + + if atomic_emulation_enabled && portable_atomic_enabled { + panic!("The `atomic-emulation` and `portable-atomic` features cannot be used together"); + } + + if has_native_atomic_support { + if atomic_emulation_enabled { + println!("cargo:warning={} has native atomic instructions, the `atomic-emulation` feature is not needed", device_name); + } + println!("cargo:rustc-cfg=has_native_atomic_support"); + } + // Load the configuration file for the configured device: let chip_toml_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("devices") diff --git a/esp-hal-common/src/embassy/executor/xtensa/interrupt.rs b/esp-hal-common/src/embassy/executor/xtensa/interrupt.rs index 0c2db617c10..2ddcf67a52c 100644 --- a/esp-hal-common/src/embassy/executor/xtensa/interrupt.rs +++ b/esp-hal-common/src/embassy/executor/xtensa/interrupt.rs @@ -1,14 +1,14 @@ //! Multicore-aware interrupt-mode executor. -use core::{ - cell::UnsafeCell, - marker::PhantomData, - mem::MaybeUninit, - sync::atomic::{AtomicUsize, Ordering}, -}; +use core::{cell::UnsafeCell, marker::PhantomData, mem::MaybeUninit}; use embassy_executor::{raw, SendSpawner}; -use crate::{get_core, interrupt, peripherals, peripherals::SYSTEM}; +use crate::{ + atomic::{AtomicUsize, Ordering}, + get_core, + interrupt, + peripherals::{self, SYSTEM}, +}; static FROM_CPU_IRQ_USED: AtomicUsize = AtomicUsize::new(0); diff --git a/esp-hal-common/src/embassy/executor/xtensa/thread.rs b/esp-hal-common/src/embassy/executor/xtensa/thread.rs index 509c99a8604..3defbee350a 100644 --- a/esp-hal-common/src/embassy/executor/xtensa/thread.rs +++ b/esp-hal-common/src/embassy/executor/xtensa/thread.rs @@ -1,12 +1,13 @@ //! Multicore-aware thread-mode embassy executor. -use core::{ - marker::PhantomData, - sync::atomic::{AtomicBool, Ordering}, -}; +use core::marker::PhantomData; use embassy_executor::{raw, Spawner}; -use crate::{get_core, prelude::interrupt}; +use crate::{ + atomic::{AtomicBool, Ordering}, + get_core, + prelude::interrupt, +}; #[cfg(multi_core)] use crate::{ interrupt, diff --git a/esp-hal-common/src/interrupt/riscv.rs b/esp-hal-common/src/interrupt/riscv.rs index c85ae084881..3a88d34583c 100644 --- a/esp-hal-common/src/interrupt/riscv.rs +++ b/esp-hal-common/src/interrupt/riscv.rs @@ -474,74 +474,77 @@ unsafe fn handle_exception(pc: usize, trap_frame: *mut TrapFrame) { return; } - let mut frame = [ - 0, - (*trap_frame).ra, - (*trap_frame).sp, - (*trap_frame).gp, - (*trap_frame).tp, - (*trap_frame).t0, - (*trap_frame).t1, - (*trap_frame).t2, - (*trap_frame).s0, - (*trap_frame).s1, - (*trap_frame).a0, - (*trap_frame).a1, - (*trap_frame).a2, - (*trap_frame).a3, - (*trap_frame).a4, - (*trap_frame).a5, - (*trap_frame).a6, - (*trap_frame).a7, - (*trap_frame).s2, - (*trap_frame).s3, - (*trap_frame).s4, - (*trap_frame).s5, - (*trap_frame).s6, - (*trap_frame).s7, - (*trap_frame).s8, - (*trap_frame).s9, - (*trap_frame).s10, - (*trap_frame).s11, - (*trap_frame).t3, - (*trap_frame).t4, - (*trap_frame).t5, - (*trap_frame).t6, - ]; - riscv_atomic_emulation_trap::atomic_emulation((*trap_frame).pc, &mut frame); - - (*trap_frame).ra = frame[1]; - (*trap_frame).sp = frame[2]; - (*trap_frame).gp = frame[3]; - (*trap_frame).tp = frame[4]; - (*trap_frame).t0 = frame[5]; - (*trap_frame).t1 = frame[6]; - (*trap_frame).t2 = frame[7]; - (*trap_frame).s0 = frame[8]; - (*trap_frame).s1 = frame[9]; - (*trap_frame).a0 = frame[10]; - (*trap_frame).a1 = frame[11]; - (*trap_frame).a2 = frame[12]; - (*trap_frame).a3 = frame[13]; - (*trap_frame).a4 = frame[14]; - (*trap_frame).a5 = frame[15]; - (*trap_frame).a6 = frame[16]; - (*trap_frame).a7 = frame[17]; - (*trap_frame).s2 = frame[18]; - (*trap_frame).s3 = frame[19]; - (*trap_frame).s4 = frame[20]; - (*trap_frame).s5 = frame[21]; - (*trap_frame).s6 = frame[22]; - (*trap_frame).s7 = frame[23]; - (*trap_frame).s8 = frame[24]; - (*trap_frame).s9 = frame[25]; - (*trap_frame).s10 = frame[26]; - (*trap_frame).s11 = frame[27]; - (*trap_frame).t3 = frame[28]; - (*trap_frame).t4 = frame[29]; - (*trap_frame).t5 = frame[30]; - (*trap_frame).t6 = frame[31]; - (*trap_frame).pc = pc + 4; + #[cfg(feature = "atomic-emulation")] + { + let mut frame = [ + 0, + (*trap_frame).ra, + (*trap_frame).sp, + (*trap_frame).gp, + (*trap_frame).tp, + (*trap_frame).t0, + (*trap_frame).t1, + (*trap_frame).t2, + (*trap_frame).s0, + (*trap_frame).s1, + (*trap_frame).a0, + (*trap_frame).a1, + (*trap_frame).a2, + (*trap_frame).a3, + (*trap_frame).a4, + (*trap_frame).a5, + (*trap_frame).a6, + (*trap_frame).a7, + (*trap_frame).s2, + (*trap_frame).s3, + (*trap_frame).s4, + (*trap_frame).s5, + (*trap_frame).s6, + (*trap_frame).s7, + (*trap_frame).s8, + (*trap_frame).s9, + (*trap_frame).s10, + (*trap_frame).s11, + (*trap_frame).t3, + (*trap_frame).t4, + (*trap_frame).t5, + (*trap_frame).t6, + ]; + riscv_atomic_emulation_trap::atomic_emulation((*trap_frame).pc, &mut frame); + + (*trap_frame).ra = frame[1]; + (*trap_frame).sp = frame[2]; + (*trap_frame).gp = frame[3]; + (*trap_frame).tp = frame[4]; + (*trap_frame).t0 = frame[5]; + (*trap_frame).t1 = frame[6]; + (*trap_frame).t2 = frame[7]; + (*trap_frame).s0 = frame[8]; + (*trap_frame).s1 = frame[9]; + (*trap_frame).a0 = frame[10]; + (*trap_frame).a1 = frame[11]; + (*trap_frame).a2 = frame[12]; + (*trap_frame).a3 = frame[13]; + (*trap_frame).a4 = frame[14]; + (*trap_frame).a5 = frame[15]; + (*trap_frame).a6 = frame[16]; + (*trap_frame).a7 = frame[17]; + (*trap_frame).s2 = frame[18]; + (*trap_frame).s3 = frame[19]; + (*trap_frame).s4 = frame[20]; + (*trap_frame).s5 = frame[21]; + (*trap_frame).s6 = frame[22]; + (*trap_frame).s7 = frame[23]; + (*trap_frame).s8 = frame[24]; + (*trap_frame).s9 = frame[25]; + (*trap_frame).s10 = frame[26]; + (*trap_frame).s11 = frame[27]; + (*trap_frame).t3 = frame[28]; + (*trap_frame).t4 = frame[29]; + (*trap_frame).t5 = frame[30]; + (*trap_frame).t6 = frame[31]; + (*trap_frame).pc = pc + 4; + } } #[doc(hidden)] diff --git a/esp-hal-common/src/lib.rs b/esp-hal-common/src/lib.rs index dfcf35b68e2..48269c34901 100644 --- a/esp-hal-common/src/lib.rs +++ b/esp-hal-common/src/lib.rs @@ -161,6 +161,12 @@ pub mod trapframe { // be directly exposed. mod soc; +#[cfg(any(has_native_atomic_support, feature = "atomic-emulation"))] +use core::sync::atomic; + +#[cfg(feature = "portable-atomic")] +use portable_atomic as atomic; + #[no_mangle] extern "C" fn EspDefaultHandler(_level: u32, _interrupt: peripherals::Interrupt) { #[cfg(feature = "log")] @@ -317,7 +323,7 @@ mod critical_section_impl { #[cfg(multi_core)] mod multicore { - use core::sync::atomic::{AtomicUsize, Ordering}; + use crate::atomic::{AtomicUsize, Ordering}; // We're using a value that we know get_raw_core() will never return. This // avoids an unnecessary increment of the core ID. diff --git a/esp32-hal/Cargo.toml b/esp32-hal/Cargo.toml index 81d413ba78d..4ff2d9910af 100644 --- a/esp32-hal/Cargo.toml +++ b/esp32-hal/Cargo.toml @@ -47,7 +47,7 @@ lis3dh-async = "0.8.0" sha2 = { version = "0.10.8", default-features = false} smart-leds = "0.3.0" ssd1306 = "0.8.4" -static_cell = { version = "=1.2.0", features = ["nightly"] } +static_cell = { version = "2.0.0", features = ["nightly"] } [features] default = ["rt", "vectored", "xtal-40mhz"] diff --git a/esp32c2-hal/.cargo/config.toml b/esp32c2-hal/.cargo/config.toml index 9b2287f08a0..c1bf8bdad82 100644 --- a/esp32c2-hal/.cargo/config.toml +++ b/esp32c2-hal/.cargo/config.toml @@ -3,22 +3,6 @@ runner = "espflash flash --monitor" rustflags = [ "-C", "link-arg=-Tlinkall.x", "-C", "force-frame-pointers", - - # comment the cfgs below if you do _not_ wish to emulate atomics. - # enable the atomic codegen option for RISCV - "-C", "target-feature=+a", - # tell the core library have atomics even though it's not specified in the target definition - "--cfg", "target_has_atomic_load_store", - "--cfg", 'target_has_atomic_load_store="8"', - "--cfg", 'target_has_atomic_load_store="16"', - "--cfg", 'target_has_atomic_load_store="32"', - "--cfg", 'target_has_atomic_load_store="ptr"', - # enable cas - "--cfg", "target_has_atomic", - "--cfg", 'target_has_atomic="8"', - "--cfg", 'target_has_atomic="16"', - "--cfg", 'target_has_atomic="32"', - "--cfg", 'target_has_atomic="ptr"', ] [build] diff --git a/esp32c2-hal/Cargo.toml b/esp32c2-hal/Cargo.toml index b00275dc542..036688fbcbd 100644 --- a/esp32c2-hal/Cargo.toml +++ b/esp32c2-hal/Cargo.toml @@ -41,7 +41,7 @@ heapless = "0.7.16" lis3dh-async = "0.8.0" sha2 = { version = "0.10.8", default-features = false} ssd1306 = "0.8.4" -static_cell = { version = "=1.2.0", features = ["nightly"] } +static_cell = { version = "2.0.0", features = ["nightly"] } hex-literal = "0.4.1" crypto-bigint = {version = "0.5.3", default-features = false } elliptic-curve = {version = "0.13.6", default-features = false, features = ["sec1"] } @@ -50,7 +50,7 @@ p256 = {version = "0.13.2", default-features = false, features = [" embassy-sync = "0.3.0" [features] -default = ["rt", "vectored", "xtal-40mhz"] +default = ["rt", "vectored", "xtal-40mhz", "portable-atomic"] async = ["esp-hal-common/async"] debug = ["esp-hal-common/debug"] defmt = ["esp-hal-common/defmt", "esp-println/defmt"] @@ -70,6 +70,9 @@ embassy = ["esp-hal-common/embassy"] embassy-time-systick = ["esp-hal-common/embassy-time-systick", "embassy-time/tick-hz-16_000_000"] embassy-time-timg0 = ["esp-hal-common/embassy-time-timg0", "embassy-time/tick-hz-1_000_000"] +portable-atomic = ["esp-hal-common/portable-atomic"] +atomic-emulation = ["esp-hal-common/riscv-atomic-emulation"] + [profile.release] debug = true diff --git a/esp32c3-hal/.cargo/config.toml b/esp32c3-hal/.cargo/config.toml index 94569ce092e..4f0290eacd5 100644 --- a/esp32c3-hal/.cargo/config.toml +++ b/esp32c3-hal/.cargo/config.toml @@ -3,22 +3,6 @@ runner = "espflash flash --monitor" rustflags = [ "-C", "link-arg=-Tlinkall.x", "-C", "force-frame-pointers", - - # comment the cfgs below if you do _not_ wish to emulate atomics. - # enable the atomic codegen option for RISCV - "-C", "target-feature=+a", - # tell the core library have atomics even though it's not specified in the target definition - "--cfg", "target_has_atomic_load_store", - "--cfg", 'target_has_atomic_load_store="8"', - "--cfg", 'target_has_atomic_load_store="16"', - "--cfg", 'target_has_atomic_load_store="32"', - "--cfg", 'target_has_atomic_load_store="ptr"', - # enable cas - "--cfg", "target_has_atomic", - "--cfg", 'target_has_atomic="8"', - "--cfg", 'target_has_atomic="16"', - "--cfg", 'target_has_atomic="32"', - "--cfg", 'target_has_atomic="ptr"', ] [build] diff --git a/esp32c3-hal/Cargo.toml b/esp32c3-hal/Cargo.toml index 8ace7189071..6ea76ceae84 100644 --- a/esp32c3-hal/Cargo.toml +++ b/esp32c3-hal/Cargo.toml @@ -49,11 +49,11 @@ lis3dh-async = "0.8.0" sha2 = { version = "0.10.8", default-features = false } smart-leds = "0.3.0" ssd1306 = "0.8.4" -static_cell = { version = "=1.2.0", features = ["nightly"] } +static_cell = { version = "2.0.0", features = ["nightly"] } embassy-sync = "0.3.0" [features] -default = ["rt", "vectored", "esp-hal-common/rv-zero-rtc-bss"] +default = ["rt", "vectored", "esp-hal-common/rv-zero-rtc-bss", "portable-atomic"] async = ["esp-hal-common/async"] debug = ["esp-hal-common/debug"] defmt = ["esp-hal-common/defmt", "esp-println/defmt"] @@ -72,6 +72,9 @@ embassy = ["esp-hal-common/embassy"] embassy-time-systick = ["esp-hal-common/embassy-time-systick", "embassy-time/tick-hz-16_000_000"] embassy-time-timg0 = ["esp-hal-common/embassy-time-timg0", "embassy-time/tick-hz-1_000_000"] +portable-atomic = ["esp-hal-common/portable-atomic"] +atomic-emulation = ["esp-hal-common/riscv-atomic-emulation"] + [profile.release] debug = true diff --git a/esp32c6-hal/Cargo.toml b/esp32c6-hal/Cargo.toml index cbe43a5aa56..5b6431ef86a 100644 --- a/esp32c6-hal/Cargo.toml +++ b/esp32c6-hal/Cargo.toml @@ -48,7 +48,7 @@ lis3dh-async = "0.8.0" sha2 = { version = "0.10.8", default-features = false} smart-leds = "0.3.0" ssd1306 = "0.8.4" -static_cell = { version = "=1.2.0", features = ["nightly"] } +static_cell = { version = "2.0.0", features = ["nightly"] } hex-literal = "0.4.1" elliptic-curve = {version = "0.13.6", default-features = false, features = ["sec1"] } p192 = {version = "0.13.0", default-features = false, features = ["arithmetic"] } diff --git a/esp32h2-hal/Cargo.toml b/esp32h2-hal/Cargo.toml index 51b9bfc2ef5..80558db1987 100644 --- a/esp32h2-hal/Cargo.toml +++ b/esp32h2-hal/Cargo.toml @@ -48,7 +48,7 @@ lis3dh-async = "0.8.0" sha2 = { version = "0.10.8", default-features = false} smart-leds = "0.3.0" ssd1306 = "0.8.4" -static_cell = { version = "=1.2.0", features = ["nightly"] } +static_cell = { version = "2.0.0", features = ["nightly"] } hex-literal = "0.4.1" elliptic-curve = {version = "0.13.6", default-features = false, features = ["sec1"] } p192 = {version = "0.13.0", default-features = false, features = ["arithmetic"] } diff --git a/esp32s2-hal/Cargo.toml b/esp32s2-hal/Cargo.toml index 990510abecf..c10ef5001cf 100644 --- a/esp32s2-hal/Cargo.toml +++ b/esp32s2-hal/Cargo.toml @@ -49,7 +49,7 @@ lis3dh-async = "0.8.0" sha2 = { version = "0.10.8", default-features = false } smart-leds = "0.3.0" ssd1306 = "0.8.4" -static_cell = { version = "=1.2.0", features = ["nightly"] } +static_cell = { version = "2.0.0", features = ["nightly"] } usb-device = "0.2.9" usbd-serial = "0.1.1" diff --git a/esp32s2-hal/examples/clock_monitor.rs b/esp32s2-hal/examples/clock_monitor.rs index aff43e7c405..e2135d4dc56 100644 --- a/esp32s2-hal/examples/clock_monitor.rs +++ b/esp32s2-hal/examples/clock_monitor.rs @@ -17,7 +17,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; static RTC: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s2-hal/examples/embassy_hello_world.rs b/esp32s2-hal/examples/embassy_hello_world.rs index 2b1a0a92637..80463666ea7 100644 --- a/esp32s2-hal/examples/embassy_hello_world.rs +++ b/esp32s2-hal/examples/embassy_hello_world.rs @@ -16,7 +16,6 @@ use esp32s2_hal::{ prelude::*, }; use esp_backtrace as _; -use xtensa_atomic_emulation_trap as _; #[embassy_executor::task] async fn run() { diff --git a/esp32s2-hal/examples/embassy_rmt_rx.rs b/esp32s2-hal/examples/embassy_rmt_rx.rs index ab63a0f42f2..43e17233eec 100644 --- a/esp32s2-hal/examples/embassy_rmt_rx.rs +++ b/esp32s2-hal/examples/embassy_rmt_rx.rs @@ -19,7 +19,6 @@ use esp32s2_hal::{ use esp_backtrace as _; use esp_hal_common::gpio::{Gpio15, Output, PushPull}; use esp_println::{print, println}; -use xtensa_atomic_emulation_trap as _; const WIDTH: usize = 80; diff --git a/esp32s2-hal/examples/embassy_rmt_tx.rs b/esp32s2-hal/examples/embassy_rmt_tx.rs index bf468d4addd..0ff96d3f1f4 100644 --- a/esp32s2-hal/examples/embassy_rmt_tx.rs +++ b/esp32s2-hal/examples/embassy_rmt_tx.rs @@ -18,7 +18,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; #[main] async fn main(_spawner: Spawner) -> ! { diff --git a/esp32s2-hal/examples/i2c_display.rs b/esp32s2-hal/examples/i2c_display.rs index 44d51657c80..dd801b621e0 100644 --- a/esp32s2-hal/examples/i2c_display.rs +++ b/esp32s2-hal/examples/i2c_display.rs @@ -30,7 +30,6 @@ use esp32s2_hal::{ use esp_backtrace as _; use nb::block; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; -use xtensa_atomic_emulation_trap as _; #[entry] fn main() -> ! { diff --git a/esp32s2-hal/examples/ledc.rs b/esp32s2-hal/examples/ledc.rs index 0a269b18d3b..c3bcc5ba5c2 100644 --- a/esp32s2-hal/examples/ledc.rs +++ b/esp32s2-hal/examples/ledc.rs @@ -20,7 +20,6 @@ use esp32s2_hal::{ prelude::*, }; use esp_backtrace as _; -use xtensa_atomic_emulation_trap as _; #[entry] fn main() -> ! { diff --git a/esp32s2-hal/src/lib.rs b/esp32s2-hal/src/lib.rs index 9701569ec73..fcb24db1fd4 100644 --- a/esp32s2-hal/src/lib.rs +++ b/esp32s2-hal/src/lib.rs @@ -48,8 +48,6 @@ use esp_hal_common::xtensa_lx_rt::exception::ExceptionCause; pub use esp_hal_common::*; -// Always enable atomic emulation on ESP32-S2 -use xtensa_atomic_emulation_trap as _; /// Function initializes ESP32 specific memories (RTC slow and fast) and /// then calls original Reset function diff --git a/esp32s3-hal/Cargo.toml b/esp32s3-hal/Cargo.toml index 8e69dff3400..d35436f4ae0 100644 --- a/esp32s3-hal/Cargo.toml +++ b/esp32s3-hal/Cargo.toml @@ -51,7 +51,7 @@ lis3dh-async = "0.8.0" sha2 = { version = "0.10.8", default-features = false } smart-leds = "0.3.0" ssd1306 = "0.8.4" -static_cell = { version = "=1.2.0", features = ["nightly"] } +static_cell = { version = "2.0.0", features = ["nightly"] } usb-device = "0.2.9" usbd-serial = "0.1.1"