From 94c4cd8500b131bbfb0ed22176c35dc4df5ff009 Mon Sep 17 00:00:00 2001 From: everdrone Date: Tue, 11 Nov 2025 17:00:41 +0100 Subject: cfg out unused items --- embassy-stm32/src/dma/gpdma/mod.rs | 1 + embassy-stm32/src/dma/mod.rs | 4 ++++ embassy-stm32/src/lib.rs | 2 +- embassy-stm32/src/rcc/bd.rs | 8 ++++++-- embassy-stm32/src/ucpd.rs | 3 ++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/embassy-stm32/src/dma/gpdma/mod.rs b/embassy-stm32/src/dma/gpdma/mod.rs index 3e117c331..106558d20 100644 --- a/embassy-stm32/src/dma/gpdma/mod.rs +++ b/embassy-stm32/src/dma/gpdma/mod.rs @@ -136,6 +136,7 @@ pub(crate) unsafe fn init(cs: critical_section::CriticalSection, irq_priority: c impl AnyChannel { /// Safety: Must be called with a matching set of parameters for a valid dma channel + #[cfg(not(stm32n6))] pub(crate) unsafe fn on_irq(&self) { let info = self.info(); #[cfg(feature = "_dual-core")] diff --git a/embassy-stm32/src/dma/mod.rs b/embassy-stm32/src/dma/mod.rs index 297fa3674..de7a2c175 100644 --- a/embassy-stm32/src/dma/mod.rs +++ b/embassy-stm32/src/dma/mod.rs @@ -46,9 +46,11 @@ pub type Request = u8; pub type Request = (); pub(crate) trait SealedChannel { + #[cfg(not(stm32n6))] fn id(&self) -> u8; } +#[cfg(not(stm32n6))] pub(crate) trait ChannelInterrupt { #[cfg_attr(not(feature = "rt"), allow(unused))] unsafe fn on_irq(); @@ -58,6 +60,7 @@ pub(crate) trait ChannelInterrupt { #[allow(private_bounds)] pub trait Channel: SealedChannel + PeripheralType + Into + 'static {} +#[cfg(not(stm32n6))] macro_rules! dma_channel_impl { ($channel_peri:ident, $index:expr) => { impl crate::dma::SealedChannel for crate::peripherals::$channel_peri { @@ -96,6 +99,7 @@ impl AnyChannel { } impl SealedChannel for AnyChannel { + #[cfg(not(stm32n6))] fn id(&self) -> u8 { self.id } diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 5b338a28b..680edf433 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -615,7 +615,7 @@ fn init_hw(config: Config) -> Peripherals { #[cfg(ucpd)] ucpd::init( cs, - #[cfg(peri_ucpd1)] + #[cfg(all(peri_ucpd1, not(stm32n6)))] config.enable_ucpd1_dead_battery, #[cfg(peri_ucpd2)] config.enable_ucpd2_dead_battery, diff --git a/embassy-stm32/src/rcc/bd.rs b/embassy-stm32/src/rcc/bd.rs index 9cad03227..219be208f 100644 --- a/embassy-stm32/src/rcc/bd.rs +++ b/embassy-stm32/src/rcc/bd.rs @@ -1,5 +1,7 @@ +#[cfg(not(stm32n6))] use core::sync::atomic::{Ordering, compiler_fence}; +#[cfg(not(stm32n6))] use crate::pac::common::{RW, Reg}; #[cfg(backup_sram)] use crate::pac::pwr::vals::Retention; @@ -54,7 +56,7 @@ impl From for crate::pac::rcc::vals::Lsedrv { } } -#[cfg(not(any(rtc_v2_l0, rtc_v2_l1, stm32c0)))] +#[cfg(not(any(rtc_v2_l0, rtc_v2_l1, stm32c0, stm32n6)))] type Bdcr = crate::pac::rcc::regs::Bdcr; #[cfg(any(rtc_v2_l0, rtc_v2_l1))] type Bdcr = crate::pac::rcc::regs::Csr; @@ -64,7 +66,7 @@ type Bdcr = crate::pac::rcc::regs::Csr1; #[cfg(any(stm32c0))] fn unlock() {} -#[cfg(not(any(stm32c0)))] +#[cfg(not(any(stm32c0, stm32n6)))] fn unlock() { #[cfg(any(stm32f0, stm32f1, stm32f2, stm32f3, stm32l0, stm32l1))] let cr = crate::pac::PWR.cr(); @@ -79,6 +81,7 @@ fn unlock() { while !cr.read().dbp() {} } +#[cfg(not(stm32n6))] fn bdcr() -> Reg { #[cfg(any(rtc_v2_l0, rtc_v2_l1))] return crate::pac::RCC.csr(); @@ -152,6 +155,7 @@ impl Default for LsConfig { } impl LsConfig { + #[cfg(not(stm32n6))] pub(crate) fn init(&self) -> Option { let rtc_clk = match self.rtc { RtcClockSource::LSI => { diff --git a/embassy-stm32/src/ucpd.rs b/embassy-stm32/src/ucpd.rs index 8f259a917..ae86d28f0 100644 --- a/embassy-stm32/src/ucpd.rs +++ b/embassy-stm32/src/ucpd.rs @@ -32,7 +32,7 @@ use crate::{Peri, interrupt}; pub(crate) fn init( _cs: critical_section::CriticalSection, - #[cfg(peri_ucpd1)] ucpd1_db_enable: bool, + #[cfg(all(peri_ucpd1, not(stm32n6)))] ucpd1_db_enable: bool, #[cfg(peri_ucpd2)] ucpd2_db_enable: bool, ) { #[cfg(stm32g0x1)] @@ -349,6 +349,7 @@ impl<'d, T: Instance> CcPhy<'d, T> { critical_section::with(|cs| { init( cs, + #[cfg(not(stm32n6))] false, #[cfg(peri_ucpd2)] false, -- cgit