diff options
| -rw-r--r-- | embassy-stm32/build.rs | 70 | ||||
| -rw-r--r-- | embassy-stm32/src/dma/dma_bdma.rs | 9 | ||||
| -rw-r--r-- | embassy-stm32/src/dma/gpdma.rs | 9 | ||||
| -rw-r--r-- | embassy-stm32/src/lib.rs | 20 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/bd.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/c0.rs | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/f013.rs | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/f247.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/g0.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/g4.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/h.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/l.rs | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/u5.rs | 1 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/wba.rs | 1 | ||||
| -rw-r--r-- | examples/boot/application/stm32wl/memory.x | 6 | ||||
| -rw-r--r-- | examples/stm32wl/memory.x | 6 |
16 files changed, 108 insertions, 28 deletions
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index d8a7ea0e6..1984a1420 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -1494,6 +1494,36 @@ fn main() { | |||
| 1494 | .flat_map(|p| &p.registers) | 1494 | .flat_map(|p| &p.registers) |
| 1495 | .any(|p| p.kind == "dmamux"); | 1495 | .any(|p| p.kind == "dmamux"); |
| 1496 | 1496 | ||
| 1497 | let mut dma_irqs: BTreeMap<&str, Vec<String>> = BTreeMap::new(); | ||
| 1498 | |||
| 1499 | for p in METADATA.peripherals { | ||
| 1500 | if let Some(r) = &p.registers { | ||
| 1501 | if r.kind == "dma" || r.kind == "bdma" || r.kind == "gpdma" || r.kind == "lpdma" { | ||
| 1502 | for irq in p.interrupts { | ||
| 1503 | let ch_name = format!("{}_{}", p.name, irq.signal); | ||
| 1504 | let ch = METADATA.dma_channels.iter().find(|c| c.name == ch_name).unwrap(); | ||
| 1505 | |||
| 1506 | // Some H7 chips have BDMA1 hardcoded for DFSDM, ie no DMAMUX. It's unsupported, skip it. | ||
| 1507 | if has_dmamux && ch.dmamux.is_none() { | ||
| 1508 | continue; | ||
| 1509 | } | ||
| 1510 | |||
| 1511 | dma_irqs.entry(irq.interrupt).or_default().push(ch_name); | ||
| 1512 | } | ||
| 1513 | } | ||
| 1514 | } | ||
| 1515 | } | ||
| 1516 | |||
| 1517 | #[cfg(feature = "_dual-core")] | ||
| 1518 | let mut dma_ch_to_irq: BTreeMap<&str, Vec<String>> = BTreeMap::new(); | ||
| 1519 | |||
| 1520 | #[cfg(feature = "_dual-core")] | ||
| 1521 | for (irq, channels) in &dma_irqs { | ||
| 1522 | for channel in channels { | ||
| 1523 | dma_ch_to_irq.entry(channel).or_default().push(irq.to_string()); | ||
| 1524 | } | ||
| 1525 | } | ||
| 1526 | |||
| 1497 | for (ch_idx, ch) in METADATA.dma_channels.iter().enumerate() { | 1527 | for (ch_idx, ch) in METADATA.dma_channels.iter().enumerate() { |
| 1498 | // Some H7 chips have BDMA1 hardcoded for DFSDM, ie no DMAMUX. It's unsupported, skip it. | 1528 | // Some H7 chips have BDMA1 hardcoded for DFSDM, ie no DMAMUX. It's unsupported, skip it. |
| 1499 | if has_dmamux && ch.dmamux.is_none() { | 1529 | if has_dmamux && ch.dmamux.is_none() { |
| @@ -1502,6 +1532,16 @@ fn main() { | |||
| 1502 | 1532 | ||
| 1503 | let name = format_ident!("{}", ch.name); | 1533 | let name = format_ident!("{}", ch.name); |
| 1504 | let idx = ch_idx as u8; | 1534 | let idx = ch_idx as u8; |
| 1535 | #[cfg(feature = "_dual-core")] | ||
| 1536 | let irq = { | ||
| 1537 | let irq_name = if let Some(x) = &dma_ch_to_irq.get(ch.name) { | ||
| 1538 | format_ident!("{}", x.get(0).unwrap()) | ||
| 1539 | } else { | ||
| 1540 | panic!("failed to find dma interrupt") | ||
| 1541 | }; | ||
| 1542 | quote!(crate::pac::Interrupt::#irq_name) | ||
| 1543 | }; | ||
| 1544 | |||
| 1505 | g.extend(quote!(dma_channel_impl!(#name, #idx);)); | 1545 | g.extend(quote!(dma_channel_impl!(#name, #idx);)); |
| 1506 | 1546 | ||
| 1507 | let dma = format_ident!("{}", ch.dma); | 1547 | let dma = format_ident!("{}", ch.dma); |
| @@ -1532,6 +1572,7 @@ fn main() { | |||
| 1532 | None => quote!(), | 1572 | None => quote!(), |
| 1533 | }; | 1573 | }; |
| 1534 | 1574 | ||
| 1575 | #[cfg(not(feature = "_dual-core"))] | ||
| 1535 | dmas.extend(quote! { | 1576 | dmas.extend(quote! { |
| 1536 | crate::dma::ChannelInfo { | 1577 | crate::dma::ChannelInfo { |
| 1537 | dma: #dma_info, | 1578 | dma: #dma_info, |
| @@ -1539,31 +1580,20 @@ fn main() { | |||
| 1539 | #dmamux | 1580 | #dmamux |
| 1540 | }, | 1581 | }, |
| 1541 | }); | 1582 | }); |
| 1583 | #[cfg(feature = "_dual-core")] | ||
| 1584 | dmas.extend(quote! { | ||
| 1585 | crate::dma::ChannelInfo { | ||
| 1586 | dma: #dma_info, | ||
| 1587 | num: #ch_num, | ||
| 1588 | irq: #irq, | ||
| 1589 | #dmamux | ||
| 1590 | }, | ||
| 1591 | }); | ||
| 1542 | } | 1592 | } |
| 1543 | 1593 | ||
| 1544 | // ======== | 1594 | // ======== |
| 1545 | // Generate DMA IRQs. | 1595 | // Generate DMA IRQs. |
| 1546 | 1596 | ||
| 1547 | let mut dma_irqs: BTreeMap<&str, Vec<String>> = BTreeMap::new(); | ||
| 1548 | |||
| 1549 | for p in METADATA.peripherals { | ||
| 1550 | if let Some(r) = &p.registers { | ||
| 1551 | if r.kind == "dma" || r.kind == "bdma" || r.kind == "gpdma" { | ||
| 1552 | for irq in p.interrupts { | ||
| 1553 | let ch_name = format!("{}_{}", p.name, irq.signal); | ||
| 1554 | let ch = METADATA.dma_channels.iter().find(|c| c.name == ch_name).unwrap(); | ||
| 1555 | |||
| 1556 | // Some H7 chips have BDMA1 hardcoded for DFSDM, ie no DMAMUX. It's unsupported, skip it. | ||
| 1557 | if has_dmamux && ch.dmamux.is_none() { | ||
| 1558 | continue; | ||
| 1559 | } | ||
| 1560 | |||
| 1561 | dma_irqs.entry(irq.interrupt).or_default().push(ch_name); | ||
| 1562 | } | ||
| 1563 | } | ||
| 1564 | } | ||
| 1565 | } | ||
| 1566 | |||
| 1567 | let dma_irqs: TokenStream = dma_irqs | 1597 | let dma_irqs: TokenStream = dma_irqs |
| 1568 | .iter() | 1598 | .iter() |
| 1569 | .map(|(irq, channels)| { | 1599 | .map(|(irq, channels)| { |
diff --git a/embassy-stm32/src/dma/dma_bdma.rs b/embassy-stm32/src/dma/dma_bdma.rs index 8a6aa53a0..8e2964f94 100644 --- a/embassy-stm32/src/dma/dma_bdma.rs +++ b/embassy-stm32/src/dma/dma_bdma.rs | |||
| @@ -15,6 +15,8 @@ use crate::{interrupt, pac}; | |||
| 15 | pub(crate) struct ChannelInfo { | 15 | pub(crate) struct ChannelInfo { |
| 16 | pub(crate) dma: DmaInfo, | 16 | pub(crate) dma: DmaInfo, |
| 17 | pub(crate) num: usize, | 17 | pub(crate) num: usize, |
| 18 | #[cfg(feature = "_dual-core")] | ||
| 19 | pub(crate) irq: pac::Interrupt, | ||
| 18 | #[cfg(dmamux)] | 20 | #[cfg(dmamux)] |
| 19 | pub(crate) dmamux: super::DmamuxInfo, | 21 | pub(crate) dmamux: super::DmamuxInfo, |
| 20 | } | 22 | } |
| @@ -259,10 +261,12 @@ pub(crate) unsafe fn init( | |||
| 259 | foreach_interrupt! { | 261 | foreach_interrupt! { |
| 260 | ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => { | 262 | ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => { |
| 261 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, dma_priority); | 263 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, dma_priority); |
| 264 | #[cfg(not(feature = "_dual-core"))] | ||
| 262 | crate::interrupt::typelevel::$irq::enable(); | 265 | crate::interrupt::typelevel::$irq::enable(); |
| 263 | }; | 266 | }; |
| 264 | ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => { | 267 | ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => { |
| 265 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, bdma_priority); | 268 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, bdma_priority); |
| 269 | #[cfg(not(feature = "_dual-core"))] | ||
| 266 | crate::interrupt::typelevel::$irq::enable(); | 270 | crate::interrupt::typelevel::$irq::enable(); |
| 267 | }; | 271 | }; |
| 268 | } | 272 | } |
| @@ -341,6 +345,11 @@ impl AnyChannel { | |||
| 341 | options: TransferOptions, | 345 | options: TransferOptions, |
| 342 | ) { | 346 | ) { |
| 343 | let info = self.info(); | 347 | let info = self.info(); |
| 348 | #[cfg(feature = "_dual-core")] | ||
| 349 | { | ||
| 350 | use embassy_hal_internal::interrupt::InterruptExt as _; | ||
| 351 | info.irq.enable(); | ||
| 352 | } | ||
| 344 | 353 | ||
| 345 | #[cfg(dmamux)] | 354 | #[cfg(dmamux)] |
| 346 | super::dmamux::configure_dmamux(&info.dmamux, _request); | 355 | super::dmamux::configure_dmamux(&info.dmamux, _request); |
diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs index 13d5d15be..f9d66ca86 100644 --- a/embassy-stm32/src/dma/gpdma.rs +++ b/embassy-stm32/src/dma/gpdma.rs | |||
| @@ -18,6 +18,8 @@ use crate::pac::gpdma::vals; | |||
| 18 | pub(crate) struct ChannelInfo { | 18 | pub(crate) struct ChannelInfo { |
| 19 | pub(crate) dma: pac::gpdma::Gpdma, | 19 | pub(crate) dma: pac::gpdma::Gpdma, |
| 20 | pub(crate) num: usize, | 20 | pub(crate) num: usize, |
| 21 | #[cfg(feature = "_dual-core")] | ||
| 22 | pub(crate) irq: pac::Interrupt, | ||
| 21 | } | 23 | } |
| 22 | 24 | ||
| 23 | /// GPDMA transfer options. | 25 | /// GPDMA transfer options. |
| @@ -57,6 +59,7 @@ pub(crate) unsafe fn init(cs: critical_section::CriticalSection, irq_priority: P | |||
| 57 | foreach_interrupt! { | 59 | foreach_interrupt! { |
| 58 | ($peri:ident, gpdma, $block:ident, $signal_name:ident, $irq:ident) => { | 60 | ($peri:ident, gpdma, $block:ident, $signal_name:ident, $irq:ident) => { |
| 59 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, irq_priority); | 61 | crate::interrupt::typelevel::$irq::set_priority_with_cs(cs, irq_priority); |
| 62 | #[cfg(not(feature = "_dual-core"))] | ||
| 60 | crate::interrupt::typelevel::$irq::enable(); | 63 | crate::interrupt::typelevel::$irq::enable(); |
| 61 | }; | 64 | }; |
| 62 | } | 65 | } |
| @@ -67,6 +70,12 @@ impl AnyChannel { | |||
| 67 | /// Safety: Must be called with a matching set of parameters for a valid dma channel | 70 | /// Safety: Must be called with a matching set of parameters for a valid dma channel |
| 68 | pub(crate) unsafe fn on_irq(&self) { | 71 | pub(crate) unsafe fn on_irq(&self) { |
| 69 | let info = self.info(); | 72 | let info = self.info(); |
| 73 | #[cfg(feature = "_dual-core")] | ||
| 74 | { | ||
| 75 | use embassy_hal_internal::interrupt::InterruptExt as _; | ||
| 76 | info.irq.enable(); | ||
| 77 | } | ||
| 78 | |||
| 70 | let state = &STATE[self.id as usize]; | 79 | let state = &STATE[self.id as usize]; |
| 71 | 80 | ||
| 72 | let ch = info.dma.ch(info.num); | 81 | let ch = info.dma.ch(info.num); |
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 12ebbae2d..98695e738 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -197,6 +197,7 @@ pub use crate::pac::NVIC_PRIO_BITS; | |||
| 197 | 197 | ||
| 198 | /// `embassy-stm32` global configuration. | 198 | /// `embassy-stm32` global configuration. |
| 199 | #[non_exhaustive] | 199 | #[non_exhaustive] |
| 200 | #[derive(Clone, Copy)] | ||
| 200 | pub struct Config { | 201 | pub struct Config { |
| 201 | /// RCC config. | 202 | /// RCC config. |
| 202 | pub rcc: rcc::Config, | 203 | pub rcc: rcc::Config, |
| @@ -303,6 +304,7 @@ mod dual_core { | |||
| 303 | pub struct SharedData { | 304 | pub struct SharedData { |
| 304 | init_flag: AtomicUsize, | 305 | init_flag: AtomicUsize, |
| 305 | clocks: UnsafeCell<MaybeUninit<Clocks>>, | 306 | clocks: UnsafeCell<MaybeUninit<Clocks>>, |
| 307 | config: UnsafeCell<MaybeUninit<Config>>, | ||
| 306 | } | 308 | } |
| 307 | 309 | ||
| 308 | unsafe impl Sync for SharedData {} | 310 | unsafe impl Sync for SharedData {} |
| @@ -325,6 +327,8 @@ mod dual_core { | |||
| 325 | rcc::set_freqs_ptr(shared_data.clocks.get()); | 327 | rcc::set_freqs_ptr(shared_data.clocks.get()); |
| 326 | let p = init_hw(config); | 328 | let p = init_hw(config); |
| 327 | 329 | ||
| 330 | unsafe { *shared_data.config.get() }.write(config); | ||
| 331 | |||
| 328 | shared_data.init_flag.store(INIT_DONE_FLAG, Ordering::SeqCst); | 332 | shared_data.init_flag.store(INIT_DONE_FLAG, Ordering::SeqCst); |
| 329 | 333 | ||
| 330 | p | 334 | p |
| @@ -372,9 +376,23 @@ mod dual_core { | |||
| 372 | fn init_secondary_hw(shared_data: &'static SharedData) -> Peripherals { | 376 | fn init_secondary_hw(shared_data: &'static SharedData) -> Peripherals { |
| 373 | rcc::set_freqs_ptr(shared_data.clocks.get()); | 377 | rcc::set_freqs_ptr(shared_data.clocks.get()); |
| 374 | 378 | ||
| 379 | let config = unsafe { (*shared_data.config.get()).assume_init() }; | ||
| 380 | |||
| 375 | // We use different timers on the different cores, so we have to still initialize one here | 381 | // We use different timers on the different cores, so we have to still initialize one here |
| 376 | #[cfg(feature = "_time-driver")] | ||
| 377 | critical_section::with(|cs| { | 382 | critical_section::with(|cs| { |
| 383 | unsafe { | ||
| 384 | dma::init( | ||
| 385 | cs, | ||
| 386 | #[cfg(bdma)] | ||
| 387 | config.bdma_interrupt_priority, | ||
| 388 | #[cfg(dma)] | ||
| 389 | config.dma_interrupt_priority, | ||
| 390 | #[cfg(gpdma)] | ||
| 391 | config.gpdma_interrupt_priority, | ||
| 392 | ) | ||
| 393 | } | ||
| 394 | |||
| 395 | #[cfg(feature = "_time-driver")] | ||
| 378 | // must be after rcc init | 396 | // must be after rcc init |
| 379 | time_driver::init(cs); | 397 | time_driver::init(cs); |
| 380 | }); | 398 | }); |
diff --git a/embassy-stm32/src/rcc/bd.rs b/embassy-stm32/src/rcc/bd.rs index 4e9c18594..9ccca8a2a 100644 --- a/embassy-stm32/src/rcc/bd.rs +++ b/embassy-stm32/src/rcc/bd.rs | |||
| @@ -16,6 +16,7 @@ pub enum LseMode { | |||
| 16 | Bypass, | 16 | Bypass, |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | #[derive(Clone, Copy)] | ||
| 19 | pub struct LseConfig { | 20 | pub struct LseConfig { |
| 20 | pub frequency: Hertz, | 21 | pub frequency: Hertz, |
| 21 | pub mode: LseMode, | 22 | pub mode: LseMode, |
| @@ -80,6 +81,7 @@ fn bdcr() -> Reg<Bdcr, RW> { | |||
| 80 | return crate::pac::RCC.csr1(); | 81 | return crate::pac::RCC.csr1(); |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 84 | #[derive(Clone, Copy)] | ||
| 83 | pub struct LsConfig { | 85 | pub struct LsConfig { |
| 84 | pub rtc: RtcClockSource, | 86 | pub rtc: RtcClockSource, |
| 85 | pub lsi: bool, | 87 | pub lsi: bool, |
diff --git a/embassy-stm32/src/rcc/c0.rs b/embassy-stm32/src/rcc/c0.rs index 5adf37941..6712aedc4 100644 --- a/embassy-stm32/src/rcc/c0.rs +++ b/embassy-stm32/src/rcc/c0.rs | |||
| @@ -37,6 +37,7 @@ pub struct Hsi { | |||
| 37 | 37 | ||
| 38 | /// Clocks configutation | 38 | /// Clocks configutation |
| 39 | #[non_exhaustive] | 39 | #[non_exhaustive] |
| 40 | #[derive(Clone, Copy)] | ||
| 40 | pub struct Config { | 41 | pub struct Config { |
| 41 | /// HSI Configuration | 42 | /// HSI Configuration |
| 42 | pub hsi: Option<Hsi>, | 43 | pub hsi: Option<Hsi>, |
diff --git a/embassy-stm32/src/rcc/f013.rs b/embassy-stm32/src/rcc/f013.rs index 63dc27bdd..60577b213 100644 --- a/embassy-stm32/src/rcc/f013.rs +++ b/embassy-stm32/src/rcc/f013.rs | |||
| @@ -76,6 +76,7 @@ pub enum HrtimClockSource { | |||
| 76 | 76 | ||
| 77 | /// Clocks configutation | 77 | /// Clocks configutation |
| 78 | #[non_exhaustive] | 78 | #[non_exhaustive] |
| 79 | #[derive(Clone, Copy)] | ||
| 79 | pub struct Config { | 80 | pub struct Config { |
| 80 | pub hsi: bool, | 81 | pub hsi: bool, |
| 81 | pub hse: Option<Hse>, | 82 | pub hse: Option<Hse>, |
diff --git a/embassy-stm32/src/rcc/f247.rs b/embassy-stm32/src/rcc/f247.rs index 61f687d30..58056301a 100644 --- a/embassy-stm32/src/rcc/f247.rs +++ b/embassy-stm32/src/rcc/f247.rs | |||
| @@ -63,6 +63,7 @@ pub struct Pll { | |||
| 63 | /// Used to calculate flash waitstates. See | 63 | /// Used to calculate flash waitstates. See |
| 64 | /// RM0033 - Table 3. Number of wait states according to Cortex®-M3 clock frequency | 64 | /// RM0033 - Table 3. Number of wait states according to Cortex®-M3 clock frequency |
| 65 | #[cfg(stm32f2)] | 65 | #[cfg(stm32f2)] |
| 66 | #[derive(Clone, Copy)] | ||
| 66 | pub enum VoltageScale { | 67 | pub enum VoltageScale { |
| 67 | /// 2.7 to 3.6 V | 68 | /// 2.7 to 3.6 V |
| 68 | Range0, | 69 | Range0, |
| @@ -76,6 +77,7 @@ pub enum VoltageScale { | |||
| 76 | 77 | ||
| 77 | /// Configuration of the core clocks | 78 | /// Configuration of the core clocks |
| 78 | #[non_exhaustive] | 79 | #[non_exhaustive] |
| 80 | #[derive(Clone, Copy)] | ||
| 79 | pub struct Config { | 81 | pub struct Config { |
| 80 | pub hsi: bool, | 82 | pub hsi: bool, |
| 81 | pub hse: Option<Hse>, | 83 | pub hse: Option<Hse>, |
diff --git a/embassy-stm32/src/rcc/g0.rs b/embassy-stm32/src/rcc/g0.rs index c2fa0ca39..c53c83b0e 100644 --- a/embassy-stm32/src/rcc/g0.rs +++ b/embassy-stm32/src/rcc/g0.rs | |||
| @@ -33,6 +33,7 @@ pub struct Hse { | |||
| 33 | /// Use this struct to configure the PLL source, input frequency, multiplication factor, and output | 33 | /// Use this struct to configure the PLL source, input frequency, multiplication factor, and output |
| 34 | /// dividers. Be sure to keep check the datasheet for your specific part for the appropriate | 34 | /// dividers. Be sure to keep check the datasheet for your specific part for the appropriate |
| 35 | /// frequency ranges for each of these settings. | 35 | /// frequency ranges for each of these settings. |
| 36 | #[derive(Clone, Copy)] | ||
| 36 | pub struct Pll { | 37 | pub struct Pll { |
| 37 | /// PLL Source clock selection. | 38 | /// PLL Source clock selection. |
| 38 | pub source: PllSource, | 39 | pub source: PllSource, |
| @@ -55,6 +56,7 @@ pub struct Pll { | |||
| 55 | 56 | ||
| 56 | /// Clocks configutation | 57 | /// Clocks configutation |
| 57 | #[non_exhaustive] | 58 | #[non_exhaustive] |
| 59 | #[derive(Clone, Copy)] | ||
| 58 | pub struct Config { | 60 | pub struct Config { |
| 59 | /// HSI Enable | 61 | /// HSI Enable |
| 60 | pub hsi: bool, | 62 | pub hsi: bool, |
diff --git a/embassy-stm32/src/rcc/g4.rs b/embassy-stm32/src/rcc/g4.rs index c261c0fed..16561f908 100644 --- a/embassy-stm32/src/rcc/g4.rs +++ b/embassy-stm32/src/rcc/g4.rs | |||
| @@ -32,6 +32,7 @@ pub struct Hse { | |||
| 32 | /// Use this struct to configure the PLL source, input frequency, multiplication factor, and output | 32 | /// Use this struct to configure the PLL source, input frequency, multiplication factor, and output |
| 33 | /// dividers. Be sure to keep check the datasheet for your specific part for the appropriate | 33 | /// dividers. Be sure to keep check the datasheet for your specific part for the appropriate |
| 34 | /// frequency ranges for each of these settings. | 34 | /// frequency ranges for each of these settings. |
| 35 | #[derive(Clone, Copy)] | ||
| 35 | pub struct Pll { | 36 | pub struct Pll { |
| 36 | /// PLL Source clock selection. | 37 | /// PLL Source clock selection. |
| 37 | pub source: PllSource, | 38 | pub source: PllSource, |
| @@ -54,6 +55,7 @@ pub struct Pll { | |||
| 54 | 55 | ||
| 55 | /// Clocks configutation | 56 | /// Clocks configutation |
| 56 | #[non_exhaustive] | 57 | #[non_exhaustive] |
| 58 | #[derive(Clone, Copy)] | ||
| 57 | pub struct Config { | 59 | pub struct Config { |
| 58 | /// HSI Enable | 60 | /// HSI Enable |
| 59 | pub hsi: bool, | 61 | pub hsi: bool, |
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs index e3c7dd158..376a0b454 100644 --- a/embassy-stm32/src/rcc/h.rs +++ b/embassy-stm32/src/rcc/h.rs | |||
| @@ -120,7 +120,7 @@ impl From<TimerPrescaler> for Timpre { | |||
| 120 | /// Power supply configuration | 120 | /// Power supply configuration |
| 121 | /// See RM0433 Rev 4 7.4 | 121 | /// See RM0433 Rev 4 7.4 |
| 122 | #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468, pwr_h7rs))] | 122 | #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468, pwr_h7rs))] |
| 123 | #[derive(PartialEq)] | 123 | #[derive(Clone, Copy, PartialEq)] |
| 124 | pub enum SupplyConfig { | 124 | pub enum SupplyConfig { |
| 125 | /// Default power supply configuration. | 125 | /// Default power supply configuration. |
| 126 | /// V CORE Power Domains are supplied from the LDO according to VOS. | 126 | /// V CORE Power Domains are supplied from the LDO according to VOS. |
| @@ -180,6 +180,7 @@ pub enum SMPSSupplyVoltage { | |||
| 180 | 180 | ||
| 181 | /// Configuration of the core clocks | 181 | /// Configuration of the core clocks |
| 182 | #[non_exhaustive] | 182 | #[non_exhaustive] |
| 183 | #[derive(Clone, Copy)] | ||
| 183 | pub struct Config { | 184 | pub struct Config { |
| 184 | pub hsi: Option<HSIPrescaler>, | 185 | pub hsi: Option<HSIPrescaler>, |
| 185 | pub hse: Option<Hse>, | 186 | pub hse: Option<Hse>, |
diff --git a/embassy-stm32/src/rcc/l.rs b/embassy-stm32/src/rcc/l.rs index e9266c65b..6120d33be 100644 --- a/embassy-stm32/src/rcc/l.rs +++ b/embassy-stm32/src/rcc/l.rs | |||
| @@ -30,6 +30,7 @@ pub struct Hse { | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | /// Clocks configuration | 32 | /// Clocks configuration |
| 33 | #[derive(Clone, Copy)] | ||
| 33 | pub struct Config { | 34 | pub struct Config { |
| 34 | // base clock sources | 35 | // base clock sources |
| 35 | pub msi: Option<MSIRange>, | 36 | pub msi: Option<MSIRange>, |
diff --git a/embassy-stm32/src/rcc/u5.rs b/embassy-stm32/src/rcc/u5.rs index d6331f512..28545ca51 100644 --- a/embassy-stm32/src/rcc/u5.rs +++ b/embassy-stm32/src/rcc/u5.rs | |||
| @@ -59,6 +59,7 @@ pub struct Pll { | |||
| 59 | pub divr: Option<PllDiv>, | 59 | pub divr: Option<PllDiv>, |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | #[derive(Clone, Copy)] | ||
| 62 | pub struct Config { | 63 | pub struct Config { |
| 63 | // base clock sources | 64 | // base clock sources |
| 64 | pub msi: Option<MSIRange>, | 65 | pub msi: Option<MSIRange>, |
diff --git a/embassy-stm32/src/rcc/wba.rs b/embassy-stm32/src/rcc/wba.rs index 8e1779d7c..1fee648d4 100644 --- a/embassy-stm32/src/rcc/wba.rs +++ b/embassy-stm32/src/rcc/wba.rs | |||
| @@ -15,6 +15,7 @@ pub struct Hse { | |||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | /// Clocks configuration | 17 | /// Clocks configuration |
| 18 | #[derive(Clone, Copy)] | ||
| 18 | pub struct Config { | 19 | pub struct Config { |
| 19 | // base clock sources | 20 | // base clock sources |
| 20 | pub hsi: bool, | 21 | pub hsi: bool, |
diff --git a/examples/boot/application/stm32wl/memory.x b/examples/boot/application/stm32wl/memory.x index 5af1723f5..20109e37e 100644 --- a/examples/boot/application/stm32wl/memory.x +++ b/examples/boot/application/stm32wl/memory.x | |||
| @@ -5,8 +5,8 @@ MEMORY | |||
| 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K |
| 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 64K | 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 64K |
| 7 | DFU : ORIGIN = 0x08018000, LENGTH = 68K | 7 | DFU : ORIGIN = 0x08018000, LENGTH = 68K |
| 8 | SHARED_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64 | 8 | SHARED_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128 |
| 9 | RAM (rwx) : ORIGIN = 0x20000040, LENGTH = 32K - 64 | 9 | RAM (rwx) : ORIGIN = 0x20000080, LENGTH = 32K - 128 |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE) - ORIGIN(BOOTLOADER); | 12 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE) - ORIGIN(BOOTLOADER); |
| @@ -21,4 +21,4 @@ SECTIONS | |||
| 21 | { | 21 | { |
| 22 | *(.shared_data) | 22 | *(.shared_data) |
| 23 | } > SHARED_RAM | 23 | } > SHARED_RAM |
| 24 | } \ No newline at end of file | 24 | } |
diff --git a/examples/stm32wl/memory.x b/examples/stm32wl/memory.x index 0298caa4b..4590867a8 100644 --- a/examples/stm32wl/memory.x +++ b/examples/stm32wl/memory.x | |||
| @@ -2,8 +2,8 @@ MEMORY | |||
| 2 | { | 2 | { |
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ |
| 4 | FLASH : ORIGIN = 0x08000000, LENGTH = 256K | 4 | FLASH : ORIGIN = 0x08000000, LENGTH = 256K |
| 5 | SHARED_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64 | 5 | SHARED_RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128 |
| 6 | RAM (rwx) : ORIGIN = 0x20000040, LENGTH = 64K - 64 | 6 | RAM (rwx) : ORIGIN = 0x20000080, LENGTH = 64K - 128 |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | SECTIONS | 9 | SECTIONS |
| @@ -12,4 +12,4 @@ SECTIONS | |||
| 12 | { | 12 | { |
| 13 | *(.shared_data) | 13 | *(.shared_data) |
| 14 | } > SHARED_RAM | 14 | } > SHARED_RAM |
| 15 | } \ No newline at end of file | 15 | } |
