Merge pull request #3435 from embassy-rs/octospim-fix

stm32: Fix build for chips with octospim but not octospi2.
This commit is contained in:
Dario Nieuwenhuis 2024-10-20 23:37:47 +00:00 committed by GitHub
commit 34eeaa0787
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

1
ci.sh
View File

@ -166,6 +166,7 @@ cargo batch \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h562ag,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba50ke,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba55ug,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32u5f9zj,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32u5g9nj,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb35ce,defmt,exti,time-driver-any,time \
--- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u031r8,defmt,exti,time-driver-any,time \

View File

@ -55,7 +55,7 @@ fn main() {
let mut singletons: Vec<String> = Vec::new();
for p in METADATA.peripherals {
if let Some(r) = &p.registers {
if r.kind == "adccommon" || r.kind == "sai" || r.kind == "ucpd" || r.kind == "otg" {
if r.kind == "adccommon" || r.kind == "sai" || r.kind == "ucpd" || r.kind == "otg" || r.kind == "octospi" {
// TODO: should we emit this for all peripherals? if so, we will need a list of all
// possible peripherals across all chips, so that we can declare the configs
// (replacing the hard-coded list of `peri_*` cfgs below)
@ -113,6 +113,7 @@ fn main() {
"peri_ucpd2",
"peri_usb_otg_fs",
"peri_usb_otg_hs",
"peri_octospi2",
]);
cfgs.declare_all(&["mco", "mco1", "mco2"]);
@ -1137,11 +1138,14 @@ fn main() {
// OCTOSPIM is special
if p.name == "OCTOSPIM" {
// Some chips have OCTOSPIM but not OCTOSPI2.
if METADATA.peripherals.iter().any(|p| p.name == "OCTOSPI2") {
peri = format_ident!("{}", "OCTOSPI2");
g.extend(quote! {
pin_trait_impl!(#tr, #peri, #pin_name, #af);
});
}
peri = format_ident!("{}", "OCTOSPI1");
g.extend(quote! {
pin_trait_impl!(#tr, #peri, #pin_name, #af);
});
peri = format_ident!("{}", "OCTOSPI2");
}
g.extend(quote! {

View File

@ -1178,7 +1178,7 @@ impl SealedOctospimInstance for peripherals::OCTOSPI1 {
const OCTOSPI_IDX: u8 = 1;
}
#[cfg(octospim_v1)]
#[cfg(all(octospim_v1, peri_octospi2))]
impl SealedOctospimInstance for peripherals::OCTOSPI2 {
const OCTOSPIM_REGS: Octospim = crate::pac::OCTOSPIM;
const OCTOSPI_IDX: u8 = 2;