stm32: update metapac and use stop data
This commit is contained in:
parent
46cffcc8d4
commit
239ad5ebea
@ -58,7 +58,7 @@ rand_core = "0.6.3"
|
|||||||
sdio-host = "0.5.0"
|
sdio-host = "0.5.0"
|
||||||
embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true }
|
embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true }
|
||||||
critical-section = "1.1"
|
critical-section = "1.1"
|
||||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8381654ade324de3945c3c755d359686e957e99b" }
|
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-1374ed622714ef4702826699ca21cc1f741f4133" }
|
||||||
vcell = "0.1.3"
|
vcell = "0.1.3"
|
||||||
bxcan = "0.7.0"
|
bxcan = "0.7.0"
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
@ -76,7 +76,7 @@ critical-section = { version = "1.1", features = ["std"] }
|
|||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
proc-macro2 = "1.0.36"
|
proc-macro2 = "1.0.36"
|
||||||
quote = "1.0.15"
|
quote = "1.0.15"
|
||||||
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-8381654ade324de3945c3c755d359686e957e99b", default-features = false, features = ["metadata"]}
|
stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-1374ed622714ef4702826699ca21cc1f741f4133", default-features = false, features = ["metadata"]}
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -6,7 +6,7 @@ use std::{env, fs};
|
|||||||
use proc_macro2::{Ident, TokenStream};
|
use proc_macro2::{Ident, TokenStream};
|
||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
use stm32_metapac::metadata::ir::{BlockItemInner, Enum, FieldSet};
|
use stm32_metapac::metadata::ir::{BlockItemInner, Enum, FieldSet};
|
||||||
use stm32_metapac::metadata::{MemoryRegionKind, PeripheralRccRegister, METADATA};
|
use stm32_metapac::metadata::{MemoryRegionKind, PeripheralRccRegister, StopMode, METADATA};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let target = env::var("TARGET").unwrap();
|
let target = env::var("TARGET").unwrap();
|
||||||
@ -557,18 +557,18 @@ fn main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If LP and non-LP peripherals share the same RCC enable bit, then a refcount leak will result.
|
A refcount leak can result if the same field is shared by peripherals with different stop modes
|
||||||
|
|
||||||
This should be checked in stm32-data-gen.
|
This condition should be checked in stm32-data
|
||||||
*/
|
*/
|
||||||
let stop_refcount = if p.name.starts_with("LP") {
|
let stop_refcount = match rcc.stop_mode {
|
||||||
quote! { REFCOUNT_STOP2 }
|
StopMode::Standby => None,
|
||||||
} else {
|
StopMode::Stop2 => Some(quote! { REFCOUNT_STOP2 }),
|
||||||
quote! { REFCOUNT_STOP1 }
|
StopMode::Stop1 => Some(quote! { REFCOUNT_STOP1 }),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (incr_stop_refcount, decr_stop_refcount) = if p.name != "RTC" {
|
let (incr_stop_refcount, decr_stop_refcount) = match stop_refcount {
|
||||||
(
|
Some(stop_refcount) => (
|
||||||
quote! {
|
quote! {
|
||||||
#[cfg(feature = "low-power")]
|
#[cfg(feature = "low-power")]
|
||||||
unsafe { crate::rcc::#stop_refcount += 1 };
|
unsafe { crate::rcc::#stop_refcount += 1 };
|
||||||
@ -577,9 +577,8 @@ fn main() {
|
|||||||
#[cfg(feature = "low-power")]
|
#[cfg(feature = "low-power")]
|
||||||
unsafe { crate::rcc::#stop_refcount -= 1 };
|
unsafe { crate::rcc::#stop_refcount -= 1 };
|
||||||
},
|
},
|
||||||
)
|
),
|
||||||
} else {
|
None => (TokenStream::new(), TokenStream::new()),
|
||||||
(quote! {}, quote! {})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
g.extend(quote! {
|
g.extend(quote! {
|
||||||
|
Loading…
Reference in New Issue
Block a user