diff options
| -rw-r--r-- | embassy-stm32/Cargo.toml | 4 | ||||
| -rw-r--r-- | embassy-stm32/build.rs | 23 |
2 files changed, 13 insertions, 14 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index 7e11e2631..01a9d482f 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -58,7 +58,7 @@ rand_core = "0.6.3" | |||
| 58 | sdio-host = "0.5.0" | 58 | sdio-host = "0.5.0" |
| 59 | embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } | 59 | embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } |
| 60 | critical-section = "1.1" | 60 | critical-section = "1.1" |
| 61 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8381654ade324de3945c3c755d359686e957e99b" } | 61 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-1374ed622714ef4702826699ca21cc1f741f4133" } |
| 62 | vcell = "0.1.3" | 62 | vcell = "0.1.3" |
| 63 | bxcan = "0.7.0" | 63 | bxcan = "0.7.0" |
| 64 | nb = "1.0.0" | 64 | nb = "1.0.0" |
| @@ -76,7 +76,7 @@ critical-section = { version = "1.1", features = ["std"] } | |||
| 76 | [build-dependencies] | 76 | [build-dependencies] |
| 77 | proc-macro2 = "1.0.36" | 77 | proc-macro2 = "1.0.36" |
| 78 | quote = "1.0.15" | 78 | quote = "1.0.15" |
| 79 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8381654ade324de3945c3c755d359686e957e99b", default-features = false, features = ["metadata"]} | 79 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-1374ed622714ef4702826699ca21cc1f741f4133", default-features = false, features = ["metadata"]} |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | [features] | 82 | [features] |
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 1307656a0..6b41cd397 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -6,7 +6,7 @@ use std::{env, fs}; | |||
| 6 | use proc_macro2::{Ident, TokenStream}; | 6 | use proc_macro2::{Ident, TokenStream}; |
| 7 | use quote::{format_ident, quote}; | 7 | use quote::{format_ident, quote}; |
| 8 | use stm32_metapac::metadata::ir::{BlockItemInner, Enum, FieldSet}; | 8 | use stm32_metapac::metadata::ir::{BlockItemInner, Enum, FieldSet}; |
| 9 | use stm32_metapac::metadata::{MemoryRegionKind, PeripheralRccRegister, METADATA}; | 9 | use stm32_metapac::metadata::{MemoryRegionKind, PeripheralRccRegister, StopMode, METADATA}; |
| 10 | 10 | ||
| 11 | fn main() { | 11 | fn main() { |
| 12 | let target = env::var("TARGET").unwrap(); | 12 | let target = env::var("TARGET").unwrap(); |
| @@ -557,18 +557,18 @@ fn main() { | |||
| 557 | }; | 557 | }; |
| 558 | 558 | ||
| 559 | /* | 559 | /* |
| 560 | If LP and non-LP peripherals share the same RCC enable bit, then a refcount leak will result. | 560 | A refcount leak can result if the same field is shared by peripherals with different stop modes |
| 561 | 561 | ||
| 562 | This should be checked in stm32-data-gen. | 562 | This condition should be checked in stm32-data |
| 563 | */ | 563 | */ |
| 564 | let stop_refcount = if p.name.starts_with("LP") { | 564 | let stop_refcount = match rcc.stop_mode { |
| 565 | quote! { REFCOUNT_STOP2 } | 565 | StopMode::Standby => None, |
| 566 | } else { | 566 | StopMode::Stop2 => Some(quote! { REFCOUNT_STOP2 }), |
| 567 | quote! { REFCOUNT_STOP1 } | 567 | StopMode::Stop1 => Some(quote! { REFCOUNT_STOP1 }), |
| 568 | }; | 568 | }; |
| 569 | 569 | ||
| 570 | let (incr_stop_refcount, decr_stop_refcount) = if p.name != "RTC" { | 570 | let (incr_stop_refcount, decr_stop_refcount) = match stop_refcount { |
| 571 | ( | 571 | Some(stop_refcount) => ( |
| 572 | quote! { | 572 | quote! { |
| 573 | #[cfg(feature = "low-power")] | 573 | #[cfg(feature = "low-power")] |
| 574 | unsafe { crate::rcc::#stop_refcount += 1 }; | 574 | unsafe { crate::rcc::#stop_refcount += 1 }; |
| @@ -577,9 +577,8 @@ fn main() { | |||
| 577 | #[cfg(feature = "low-power")] | 577 | #[cfg(feature = "low-power")] |
| 578 | unsafe { crate::rcc::#stop_refcount -= 1 }; | 578 | unsafe { crate::rcc::#stop_refcount -= 1 }; |
| 579 | }, | 579 | }, |
| 580 | ) | 580 | ), |
| 581 | } else { | 581 | None => (TokenStream::new(), TokenStream::new()), |
| 582 | (quote! {}, quote! {}) | ||
| 583 | }; | 582 | }; |
| 584 | 583 | ||
| 585 | g.extend(quote! { | 584 | g.extend(quote! { |
