cyw43: make sure to yield if doing busy-polling for interrupts.

This commit is contained in:
Dario Nieuwenhuis 2024-08-09 01:05:10 +02:00
parent 3afc5e4838
commit ad4df1c1ad
2 changed files with 10 additions and 0 deletions

View File

@ -365,6 +365,13 @@ where
} }
Either4::Fourth(()) => { Either4::Fourth(()) => {
self.handle_irq(&mut buf).await; self.handle_irq(&mut buf).await;
// If we do busy-polling, make sure to yield.
// `handle_irq` will only do a 32bit read if there's no work to do, which is really fast.
// Depending on optimization level, it is possible that the 32-bit read finishes on
// first poll, so it never yields and we starve all other tasks.
#[cfg(feature = "bluetooth")]
embassy_futures::yield_now().await;
} }
} }
} else { } else {

View File

@ -64,8 +64,11 @@ trouble-host = { version = "0.1.0", features = ["defmt", "gatt"] }
[profile.release] [profile.release]
debug = 2 debug = 2
lto = true
opt-level = 'z'
[profile.dev] [profile.dev]
debug = 2
lto = true lto = true
opt-level = "z" opt-level = "z"