Fixed triggering a debug-assertion during scan (#2612)

* Fixed triggering a debug-assertion during scan

* CHANGELOGs

* Change `debug_assert` into warning level log

* Enable debug-asserts in hil-test, qa-test and examples

* Change the way we detect and warn about debug-builds

* Warn if opt-level is `0` or `1`
This commit is contained in:
Björn Quentin 2024-11-27 15:14:04 +01:00 committed by GitHub
parent 2512658653
commit cfb83b153d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 44 additions and 19 deletions

View File

@ -37,6 +37,7 @@ embedded-hal-nb = "1.0.0"
embedded-io = "0.6.1"
embedded-io-async = "0.6.1"
enumset = "1.1.5"
esp-build = { version = "0.1.0", path = "../esp-build" }
esp-synopsys-usb-otg = { version = "0.4.2", optional = true, features = ["fs", "esp32sx"] }
fugit = "0.3.7"
log = { version = "0.4.22", optional = true }

View File

@ -11,16 +11,14 @@ use esp_build::assert_unique_used_features;
use esp_config::{generate_config, Value};
use esp_metadata::{Chip, Config};
#[cfg(debug_assertions)]
esp_build::warning! {"
WARNING: use --release
We *strongly* recommend using release profile when building esp-hal.
The dev profile can potentially be one or more orders of magnitude
slower than release, and may cause issues with timing-senstive
peripherals and/or devices.
"}
fn main() -> Result<(), Box<dyn Error>> {
println!("cargo:rustc-check-cfg=cfg(is_debug_build)");
if let Ok(level) = std::env::var("OPT_LEVEL") {
if level == "0" || level == "1" {
println!("cargo:rustc-cfg=is_debug_build");
}
}
// NOTE: update when adding new device support!
// Ensure that exactly one chip has been specified:
assert_unique_used_features!(

View File

@ -261,6 +261,15 @@ pub mod trapframe {
// be directly exposed.
mod soc;
#[cfg(is_debug_build)]
esp_build::warning! {"
WARNING: use --release
We *strongly* recommend using release profile when building esp-hal.
The dev profile can potentially be one or more orders of magnitude
slower than release, and may cause issues with timing-senstive
peripherals and/or devices.
"}
/// A marker trait for initializing drivers in a specific mode.
pub trait Mode: crate::private::Sealed {}

View File

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Introduced the `wifi6` symbol (#2612)
### Fixed

View File

@ -80,6 +80,7 @@ symbols = [
"phy",
"bt",
"wifi",
"wifi6",
"ieee802154",
"lp_core",

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
### Fixed
- Fixed triggering a debug-assertion during scan (#2612)
### Removed

View File

@ -104,7 +104,7 @@ macro_rules! impl_wifi_event {
}
impl_wifi_event!(WifiReady);
impl_wifi_event!(ScanDone);
impl_wifi_event!(ScanDone, wifi_event_sta_scan_done_t);
impl_wifi_event!(StaStart);
impl_wifi_event!(StaStop);
impl_wifi_event!(StaConnected, wifi_event_sta_connected_t);
@ -131,13 +131,25 @@ impl_wifi_event!(ApWpsRgFailed, wifi_event_ap_wps_rg_fail_reason_t);
impl_wifi_event!(ApWpsRgTimeout);
impl_wifi_event!(ApWpsRgPin, wifi_event_ap_wps_rg_pin_t);
impl_wifi_event!(ApWpsRgPbcOverlap);
impl_wifi_event!(ItwtSetup);
impl_wifi_event!(ItwtTeardown);
impl_wifi_event!(ItwtProbe);
impl_wifi_event!(ItwtSuspend);
impl_wifi_event!(TwtWakeup);
impl_wifi_event!(BtwtSetup);
impl_wifi_event!(BtwtTeardown);
cfg_if::cfg_if! {
if #[cfg(wifi6)] {
impl_wifi_event!(ItwtSetup, wifi_event_sta_itwt_setup_t);
impl_wifi_event!(ItwtTeardown, wifi_event_sta_itwt_teardown_t);
impl_wifi_event!(ItwtProbe, wifi_event_sta_itwt_probe_t);
impl_wifi_event!(ItwtSuspend, wifi_event_sta_itwt_suspend_t);
impl_wifi_event!(TwtWakeup);
impl_wifi_event!(BtwtSetup, wifi_event_sta_btwt_setup_t);
impl_wifi_event!(BtwtTeardown, wifi_event_sta_btwt_teardown_t);
} else {
impl_wifi_event!(ItwtSetup);
impl_wifi_event!(ItwtTeardown);
impl_wifi_event!(ItwtProbe);
impl_wifi_event!(ItwtSuspend);
impl_wifi_event!(TwtWakeup);
impl_wifi_event!(BtwtSetup);
impl_wifi_event!(BtwtTeardown);
}
}
impl_wifi_event!(NanStarted);
impl_wifi_event!(NanStopped);
impl_wifi_event!(NanSvcMatch, wifi_event_nan_svc_match_t);
@ -173,6 +185,7 @@ pub(crate) unsafe fn handle_raw<Event: EventExt>(
core::mem::size_of::<Event>(),
"wrong size event data"
);
handle::<Event>(unsafe { &Event::from_raw_event_data(event_data) })
}

View File

@ -65,7 +65,7 @@ embassy-generic-timers = ["embassy-time/generic-queue-8"]
[profile.release]
codegen-units = 1
debug = 2
debug-assertions = false
debug-assertions = true
incremental = false
opt-level = 3
lto = 'fat'

View File

@ -311,7 +311,7 @@ overflow-checks = true
[profile.release]
codegen-units = 1
debug = 2
debug-assertions = false
debug-assertions = true
incremental = false
opt-level = 3
lto = false # LTO (thin or fat) miscompiles some tests on RISC-V

View File

@ -32,5 +32,6 @@ embassy-generic-timers = ["embassy-time/generic-queue-8"]
[profile.release]
debug = 2
debug-assertions = true
lto = "fat"
codegen-units = 1