From 8c4878cb03b8329bd05c78d394756a457ccf56ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Tue, 1 Jul 2025 16:42:27 +0200 Subject: [PATCH] Refactor AssistDebug symbols (#3730) --- esp-hal/src/assist_debug.rs | 8 ++++---- esp-metadata/devices/esp32c2.toml | 6 ++++-- esp-metadata/devices/esp32c3.toml | 8 +++++--- esp-metadata/devices/esp32c6.toml | 8 +++++--- esp-metadata/devices/esp32h2.toml | 8 +++++--- esp-metadata/devices/esp32s3.toml | 6 ++++-- esp-metadata/src/cfg.rs | 7 ++++++- 7 files changed, 33 insertions(+), 18 deletions(-) diff --git a/esp-hal/src/assist_debug.rs b/esp-hal/src/assist_debug.rs index 5eb7a74a7..8080c3540 100644 --- a/esp-hal/src/assist_debug.rs +++ b/esp-hal/src/assist_debug.rs @@ -73,7 +73,7 @@ impl crate::interrupt::InterruptConfigurable for DebugAssist<'_> { } } -#[cfg(assist_debug_sp_monitor)] +#[cfg(assist_debug_has_sp_monitor)] impl DebugAssist<'_> { /// Enable SP monitoring on main core. When the SP exceeds the /// `lower_bound` or `upper_bound` threshold, the module will record the PC @@ -152,7 +152,7 @@ impl DebugAssist<'_> { } } -#[cfg(all(assist_debug_sp_monitor, multi_core))] +#[cfg(all(assist_debug_has_sp_monitor, multi_core))] impl<'d> DebugAssist<'d> { /// Enable SP monitoring on secondary core. When the SP exceeds the /// `lower_bound` or `upper_bound` threshold, the module will record the PC @@ -231,7 +231,7 @@ impl<'d> DebugAssist<'d> { } } -#[cfg(assist_debug_region_monitor)] +#[cfg(assist_debug_has_region_monitor)] impl DebugAssist<'_> { /// Enable region monitoring of read/write performed by the main CPU in a /// certain memory region0. Whenever the bus reads or writes in the @@ -394,7 +394,7 @@ impl DebugAssist<'_> { } } -#[cfg(all(assist_debug_region_monitor, multi_core))] +#[cfg(all(assist_debug_has_region_monitor, multi_core))] impl DebugAssist<'_> { /// Enable region monitoring of read/write performed by the secondary CPU in /// a certain memory region0. Whenever the bus reads or writes in the diff --git a/esp-metadata/devices/esp32c2.toml b/esp-metadata/devices/esp32c2.toml index 97e84056f..fdfc76f6f 100644 --- a/esp-metadata/devices/esp32c2.toml +++ b/esp-metadata/devices/esp32c2.toml @@ -46,7 +46,6 @@ virtual_peripherals = [ symbols = [ # Additional peripherals defined by us (the developers): - "assist_debug_sp_monitor", "gdma", "phy", @@ -70,6 +69,10 @@ instances = [ { name = "adc1" }, ] +[device.assist_debug] +support_status = "partial" +has_sp_monitor = true + [device.gpio] support_status = "supported" gpio_function = 1 @@ -246,7 +249,6 @@ instances = [ [device.ledc] ## Miscellaneous -[device.assist_debug] [device.dma] [device.io_mux] [device.temp_sensor] diff --git a/esp-metadata/devices/esp32c3.toml b/esp-metadata/devices/esp32c3.toml index c1775cd8f..dd9e71d84 100644 --- a/esp-metadata/devices/esp32c3.toml +++ b/esp-metadata/devices/esp32c3.toml @@ -58,8 +58,6 @@ virtual_peripherals = [ symbols = [ # Additional peripherals defined by us (the developers): - "assist_debug_sp_monitor", - "assist_debug_region_monitor", "gdma", "phy", "tsens", @@ -85,6 +83,11 @@ instances = [ { name = "adc2" }, ] +[device.assist_debug] +support_status = "partial" +has_sp_monitor = true +has_region_monitor = true + [device.gpio] support_status = "supported" gpio_function = 1 @@ -307,7 +310,6 @@ support_status = "not_supported" [device.usb_serial_jtag] ## Miscellaneous -[device.assist_debug] [device.dma] [device.io_mux] [device.temp_sensor] diff --git a/esp-metadata/devices/esp32c6.toml b/esp-metadata/devices/esp32c6.toml index 374b9f473..e24501b49 100644 --- a/esp-metadata/devices/esp32c6.toml +++ b/esp-metadata/devices/esp32c6.toml @@ -83,8 +83,6 @@ virtual_peripherals = [ symbols = [ # Additional peripherals defined by us (the developers): - "assist_debug_sp_monitor", - "assist_debug_region_monitor", "gdma", "plic", "phy", @@ -113,6 +111,11 @@ instances = [ { name = "adc1" }, ] +[device.assist_debug] +support_status = "partial" +has_sp_monitor = true +has_region_monitor = true + [device.gpio] support_status = "supported" gpio_function = 1 @@ -441,7 +444,6 @@ has_wifi6 = true [device.usb_serial_jtag] ## Miscellaneous -[device.assist_debug] [device.dma] [device.etm] [device.io_mux] diff --git a/esp-metadata/devices/esp32h2.toml b/esp-metadata/devices/esp32h2.toml index 55650114e..f201d6068 100644 --- a/esp-metadata/devices/esp32h2.toml +++ b/esp-metadata/devices/esp32h2.toml @@ -75,8 +75,6 @@ virtual_peripherals = [ symbols = [ # Additional peripherals defined by us (the developers): - "assist_debug_sp_monitor", - "assist_debug_region_monitor", "gdma", "plic", "phy", @@ -96,6 +94,11 @@ instances = [ { name = "adc1" }, ] +[device.assist_debug] +support_status = "partial" +has_sp_monitor = true +has_region_monitor = true + [device.gpio] support_status = "supported" gpio_function = 1 @@ -381,7 +384,6 @@ support_status = "not_supported" [device.usb_serial_jtag] ## Miscellaneous -[device.assist_debug] [device.dma] [device.etm] [device.io_mux] diff --git a/esp-metadata/devices/esp32s3.toml b/esp-metadata/devices/esp32s3.toml index 83764bae8..467c8f5fd 100644 --- a/esp-metadata/devices/esp32s3.toml +++ b/esp-metadata/devices/esp32s3.toml @@ -75,7 +75,6 @@ virtual_peripherals = [ symbols = [ # Additional peripherals defined by us (the developers): - "assist_debug_region_monitor", "gdma", "phy", "psram", @@ -108,6 +107,10 @@ instances = [ { name = "adc2" }, ] +[device.assist_debug] +support_status = "partial" +has_region_monitor = true + [device.gpio] support_status = "supported" has_bank_1 = true @@ -563,7 +566,6 @@ support_status = "not_supported" [device.usb_serial_jtag] ## Miscellaneous -[device.assist_debug] [device.dma] [device.io_mux] [device.psram] diff --git a/esp-metadata/src/cfg.rs b/esp-metadata/src/cfg.rs index 2a3eeeea5..6fc1a0ce9 100644 --- a/esp-metadata/src/cfg.rs +++ b/esp-metadata/src/cfg.rs @@ -242,7 +242,12 @@ driver_configs![ driver: assist_debug, name: "ASSIST_DEBUG", peripherals: &["assist_debug"], - properties: {} + properties: { + #[serde(default)] + has_sp_monitor: bool, + #[serde(default)] + has_region_monitor: bool, + } }, DacProperties { driver: dac,