aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-10-21 01:10:55 +0200
committerDario Nieuwenhuis <[email protected]>2024-10-21 01:30:21 +0200
commitecac24a1c7283ab3e3a10df801270eea5491ef3a (patch)
tree9e4afa208185ad2a86e35f205453a33fa0ae267a
parentf92b27d0480616dd1cc19b9793e0054aa90d0e8d (diff)
stm32: Fix build for chips with octospim but not octospi2.
-rwxr-xr-xci.sh1
-rw-r--r--embassy-stm32/build.rs14
-rw-r--r--embassy-stm32/src/ospi/mod.rs2
3 files changed, 11 insertions, 6 deletions
diff --git a/ci.sh b/ci.sh
index aa078be31..b04a4b288 100755
--- a/ci.sh
+++ b/ci.sh
@@ -166,6 +166,7 @@ cargo batch \
166 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h562ag,defmt,exti,time-driver-any,time \ 166 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h562ag,defmt,exti,time-driver-any,time \
167 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba50ke,defmt,exti,time-driver-any,time \ 167 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba50ke,defmt,exti,time-driver-any,time \
168 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba55ug,defmt,exti,time-driver-any,time \ 168 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32wba55ug,defmt,exti,time-driver-any,time \
169 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32u5f9zj,defmt,exti,time-driver-any,time \
169 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32u5g9nj,defmt,exti,time-driver-any,time \ 170 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32u5g9nj,defmt,exti,time-driver-any,time \
170 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb35ce,defmt,exti,time-driver-any,time \ 171 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb35ce,defmt,exti,time-driver-any,time \
171 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u031r8,defmt,exti,time-driver-any,time \ 172 --- build --release --manifest-path embassy-stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u031r8,defmt,exti,time-driver-any,time \
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs
index 966dce121..71bfb3747 100644
--- a/embassy-stm32/build.rs
+++ b/embassy-stm32/build.rs
@@ -55,7 +55,7 @@ fn main() {
55 let mut singletons: Vec<String> = Vec::new(); 55 let mut singletons: Vec<String> = Vec::new();
56 for p in METADATA.peripherals { 56 for p in METADATA.peripherals {
57 if let Some(r) = &p.registers { 57 if let Some(r) = &p.registers {
58 if r.kind == "adccommon" || r.kind == "sai" || r.kind == "ucpd" || r.kind == "otg" { 58 if r.kind == "adccommon" || r.kind == "sai" || r.kind == "ucpd" || r.kind == "otg" || r.kind == "octospi" {
59 // TODO: should we emit this for all peripherals? if so, we will need a list of all 59 // TODO: should we emit this for all peripherals? if so, we will need a list of all
60 // possible peripherals across all chips, so that we can declare the configs 60 // possible peripherals across all chips, so that we can declare the configs
61 // (replacing the hard-coded list of `peri_*` cfgs below) 61 // (replacing the hard-coded list of `peri_*` cfgs below)
@@ -113,6 +113,7 @@ fn main() {
113 "peri_ucpd2", 113 "peri_ucpd2",
114 "peri_usb_otg_fs", 114 "peri_usb_otg_fs",
115 "peri_usb_otg_hs", 115 "peri_usb_otg_hs",
116 "peri_octospi2",
116 ]); 117 ]);
117 cfgs.declare_all(&["mco", "mco1", "mco2"]); 118 cfgs.declare_all(&["mco", "mco1", "mco2"]);
118 119
@@ -1137,11 +1138,14 @@ fn main() {
1137 1138
1138 // OCTOSPIM is special 1139 // OCTOSPIM is special
1139 if p.name == "OCTOSPIM" { 1140 if p.name == "OCTOSPIM" {
1141 // Some chips have OCTOSPIM but not OCTOSPI2.
1142 if METADATA.peripherals.iter().any(|p| p.name == "OCTOSPI2") {
1143 peri = format_ident!("{}", "OCTOSPI2");
1144 g.extend(quote! {
1145 pin_trait_impl!(#tr, #peri, #pin_name, #af);
1146 });
1147 }
1140 peri = format_ident!("{}", "OCTOSPI1"); 1148 peri = format_ident!("{}", "OCTOSPI1");
1141 g.extend(quote! {
1142 pin_trait_impl!(#tr, #peri, #pin_name, #af);
1143 });
1144 peri = format_ident!("{}", "OCTOSPI2");
1145 } 1149 }
1146 1150
1147 g.extend(quote! { 1151 g.extend(quote! {
diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs
index 48a1ea5e6..e4adc4b09 100644
--- a/embassy-stm32/src/ospi/mod.rs
+++ b/embassy-stm32/src/ospi/mod.rs
@@ -1178,7 +1178,7 @@ impl SealedOctospimInstance for peripherals::OCTOSPI1 {
1178 const OCTOSPI_IDX: u8 = 1; 1178 const OCTOSPI_IDX: u8 = 1;
1179} 1179}
1180 1180
1181#[cfg(octospim_v1)] 1181#[cfg(all(octospim_v1, peri_octospi2))]
1182impl SealedOctospimInstance for peripherals::OCTOSPI2 { 1182impl SealedOctospimInstance for peripherals::OCTOSPI2 {
1183 const OCTOSPIM_REGS: Octospim = crate::pac::OCTOSPIM; 1183 const OCTOSPIM_REGS: Octospim = crate::pac::OCTOSPIM;
1184 const OCTOSPI_IDX: u8 = 2; 1184 const OCTOSPI_IDX: u8 = 2;