aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-executor/CHANGELOG.md2
-rw-r--r--embassy-executor/Cargo.toml2
-rw-r--r--embassy-executor/src/raw/mod.rs10
-rw-r--r--embassy-executor/src/raw/state_atomics.rs21
-rw-r--r--embassy-executor/src/raw/state_critical_section.rs15
-rw-r--r--embassy-stm32/CHANGELOG.md2
-rw-r--r--embassy-stm32/src/usb/usb.rs11
-rw-r--r--examples/nrf-rtos-trace/Cargo.toml4
8 files changed, 51 insertions, 16 deletions
diff --git a/embassy-executor/CHANGELOG.md b/embassy-executor/CHANGELOG.md
index 999c77a83..69c82653b 100644
--- a/embassy-executor/CHANGELOG.md
+++ b/embassy-executor/CHANGELOG.md
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10 10
11- Added new metadata API for tasks 11- Added new metadata API for tasks
12- Named main task when rtos-trace feature is enabled. 12- Named main task when rtos-trace feature is enabled.
13- Upgraded rtos-trace
14- Fixed performance regression on some ESP32 MCUs.
13 15
14## 0.9.0 - 2025-08-26 16## 0.9.0 - 2025-08-26
15 17
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index 79680ae74..dc423aba2 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -51,7 +51,7 @@ features = ["defmt", "arch-cortex-m", "executor-thread", "executor-interrupt"]
51[dependencies] 51[dependencies]
52defmt = { version = "1.0.1", optional = true } 52defmt = { version = "1.0.1", optional = true }
53log = { version = "0.4.14", optional = true } 53log = { version = "0.4.14", optional = true }
54rtos-trace = { version = "0.1.3", optional = true } 54rtos-trace = { version = "0.2", optional = true }
55 55
56embassy-executor-macros = { version = "0.7.0", path = "../embassy-executor-macros" } 56embassy-executor-macros = { version = "0.7.0", path = "../embassy-executor-macros" }
57embassy-time-driver = { version = "0.2.1", path = "../embassy-time-driver", optional = true } 57embassy-time-driver = { version = "0.2.1", path = "../embassy-time-driver", optional = true }
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs
index bdaa32951..4280c5750 100644
--- a/embassy-executor/src/raw/mod.rs
+++ b/embassy-executor/src/raw/mod.rs
@@ -12,8 +12,14 @@
12mod run_queue; 12mod run_queue;
13 13
14#[cfg_attr(all(cortex_m, target_has_atomic = "32"), path = "state_atomics_arm.rs")] 14#[cfg_attr(all(cortex_m, target_has_atomic = "32"), path = "state_atomics_arm.rs")]
15#[cfg_attr(all(not(cortex_m), target_has_atomic = "8"), path = "state_atomics.rs")] 15#[cfg_attr(
16#[cfg_attr(not(target_has_atomic = "8"), path = "state_critical_section.rs")] 16 all(not(cortex_m), any(target_has_atomic = "8", target_has_atomic = "32")),
17 path = "state_atomics.rs"
18)]
19#[cfg_attr(
20 not(any(target_has_atomic = "8", target_has_atomic = "32")),
21 path = "state_critical_section.rs"
22)]
17mod state; 23mod state;
18 24
19#[cfg(feature = "_any_trace")] 25#[cfg(feature = "_any_trace")]
diff --git a/embassy-executor/src/raw/state_atomics.rs b/embassy-executor/src/raw/state_atomics.rs
index e813548ae..6675875be 100644
--- a/embassy-executor/src/raw/state_atomics.rs
+++ b/embassy-executor/src/raw/state_atomics.rs
@@ -1,4 +1,15 @@
1use core::sync::atomic::{AtomicU8, Ordering}; 1// Prefer pointer-width atomic operations, as narrower ones may be slower.
2#[cfg(all(target_pointer_width = "32", target_has_atomic = "32"))]
3type AtomicState = core::sync::atomic::AtomicU32;
4#[cfg(not(all(target_pointer_width = "32", target_has_atomic = "32")))]
5type AtomicState = core::sync::atomic::AtomicU8;
6
7#[cfg(all(target_pointer_width = "32", target_has_atomic = "32"))]
8type StateBits = u32;
9#[cfg(not(all(target_pointer_width = "32", target_has_atomic = "32")))]
10type StateBits = u8;
11
12use core::sync::atomic::Ordering;
2 13
3#[derive(Clone, Copy)] 14#[derive(Clone, Copy)]
4pub(crate) struct Token(()); 15pub(crate) struct Token(());
@@ -11,18 +22,18 @@ pub(crate) fn locked<R>(f: impl FnOnce(Token) -> R) -> R {
11} 22}
12 23
13/// Task is spawned (has a future) 24/// Task is spawned (has a future)
14pub(crate) const STATE_SPAWNED: u8 = 1 << 0; 25pub(crate) const STATE_SPAWNED: StateBits = 1 << 0;
15/// Task is in the executor run queue 26/// Task is in the executor run queue
16pub(crate) const STATE_RUN_QUEUED: u8 = 1 << 1; 27pub(crate) const STATE_RUN_QUEUED: StateBits = 1 << 1;
17 28
18pub(crate) struct State { 29pub(crate) struct State {
19 state: AtomicU8, 30 state: AtomicState,
20} 31}
21 32
22impl State { 33impl State {
23 pub const fn new() -> State { 34 pub const fn new() -> State {
24 Self { 35 Self {
25 state: AtomicU8::new(0), 36 state: AtomicState::new(0),
26 } 37 }
27 } 38 }
28 39
diff --git a/embassy-executor/src/raw/state_critical_section.rs b/embassy-executor/src/raw/state_critical_section.rs
index ec08f2f58..b69a6ac66 100644
--- a/embassy-executor/src/raw/state_critical_section.rs
+++ b/embassy-executor/src/raw/state_critical_section.rs
@@ -3,13 +3,18 @@ use core::cell::Cell;
3pub(crate) use critical_section::{with as locked, CriticalSection as Token}; 3pub(crate) use critical_section::{with as locked, CriticalSection as Token};
4use critical_section::{CriticalSection, Mutex}; 4use critical_section::{CriticalSection, Mutex};
5 5
6#[cfg(target_arch = "avr")]
7type StateBits = u8;
8#[cfg(not(target_arch = "avr"))]
9type StateBits = usize;
10
6/// Task is spawned (has a future) 11/// Task is spawned (has a future)
7pub(crate) const STATE_SPAWNED: u8 = 1 << 0; 12pub(crate) const STATE_SPAWNED: StateBits = 1 << 0;
8/// Task is in the executor run queue 13/// Task is in the executor run queue
9pub(crate) const STATE_RUN_QUEUED: u8 = 1 << 1; 14pub(crate) const STATE_RUN_QUEUED: StateBits = 1 << 1;
10 15
11pub(crate) struct State { 16pub(crate) struct State {
12 state: Mutex<Cell<u8>>, 17 state: Mutex<Cell<StateBits>>,
13} 18}
14 19
15impl State { 20impl State {
@@ -19,11 +24,11 @@ impl State {
19 } 24 }
20 } 25 }
21 26
22 fn update<R>(&self, f: impl FnOnce(&mut u8) -> R) -> R { 27 fn update<R>(&self, f: impl FnOnce(&mut StateBits) -> R) -> R {
23 critical_section::with(|cs| self.update_with_cs(cs, f)) 28 critical_section::with(|cs| self.update_with_cs(cs, f))
24 } 29 }
25 30
26 fn update_with_cs<R>(&self, cs: CriticalSection<'_>, f: impl FnOnce(&mut u8) -> R) -> R { 31 fn update_with_cs<R>(&self, cs: CriticalSection<'_>, f: impl FnOnce(&mut StateBits) -> R) -> R {
27 let s = self.state.borrow(cs); 32 let s = self.state.borrow(cs);
28 let mut val = s.get(); 33 let mut val = s.get();
29 let r = f(&mut val); 34 let r = f(&mut val);
diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md
index c8ae7a357..dfb8ca066 100644
--- a/embassy-stm32/CHANGELOG.md
+++ b/embassy-stm32/CHANGELOG.md
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8<!-- next-header --> 8<!-- next-header -->
9## Unreleased - ReleaseDate 9## Unreleased - ReleaseDate
10 10
11- fix: Fixed STM32H5 builds requiring time feature
12
11## 0.4.0 - 2025-08-26 13## 0.4.0 - 2025-08-26
12 14
13- feat: stm32/sai: make NODIV independent of MCKDIV 15- feat: stm32/sai: make NODIV independent of MCKDIV
diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs
index 92c1601cc..54596aeae 100644
--- a/embassy-stm32/src/usb/usb.rs
+++ b/embassy-stm32/src/usb/usb.rs
@@ -912,7 +912,16 @@ impl<'d, T: Instance> driver::EndpointOut for Endpoint<'d, T, Out> {
912 // Software should ensure that a small delay is included before accessing the SRAM contents. This delay should be 912 // Software should ensure that a small delay is included before accessing the SRAM contents. This delay should be
913 // 800 ns in Full Speed mode and 6.4 μs in Low Speed mode. 913 // 800 ns in Full Speed mode and 6.4 μs in Low Speed mode.
914 #[cfg(stm32h5)] 914 #[cfg(stm32h5)]
915 embassy_time::block_for(embassy_time::Duration::from_nanos(800)); 915 {
916 #[cfg(feature = "time")]
917 embassy_time::block_for(embassy_time::Duration::from_nanos(800));
918 #[cfg(not(feature = "time"))]
919 {
920 let freq = unsafe { crate::rcc::get_freqs() }.sys.to_hertz().unwrap().0 as u64;
921 let cycles = freq * 800 / 1_000_000;
922 cortex_m::asm::delay(cycles as u32);
923 }
924 }
916 925
917 RX_COMPLETE[index].store(false, Ordering::Relaxed); 926 RX_COMPLETE[index].store(false, Ordering::Relaxed);
918 927
diff --git a/examples/nrf-rtos-trace/Cargo.toml b/examples/nrf-rtos-trace/Cargo.toml
index a2dc0c7ad..c9eeaaac7 100644
--- a/examples/nrf-rtos-trace/Cargo.toml
+++ b/examples/nrf-rtos-trace/Cargo.toml
@@ -25,8 +25,8 @@ cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-sing
25cortex-m-rt = "0.7.0" 25cortex-m-rt = "0.7.0"
26panic-probe = "1.0.0" 26panic-probe = "1.0.0"
27serde = { version = "1.0.136", default-features = false } 27serde = { version = "1.0.136", default-features = false }
28rtos-trace = "0.1.3" 28rtos-trace = "0.2"
29systemview-target = { version = "0.1.2", features = ["callbacks-app", "callbacks-os", "log", "cortex-m"] } 29systemview-target = { version = "0.2", features = ["callbacks-app", "callbacks-os", "log", "cortex-m"] }
30log = { version = "0.4.17", optional = true } 30log = { version = "0.4.17", optional = true }
31 31
32[[bin]] 32[[bin]]