From 9fec792a6af4bc7707983eb9772cb4a0d09ee1f5 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Tue, 27 Jul 2021 12:39:34 -0400 Subject: [PATCH 1/6] Update data to include peripheral IRQs. --- stm32-data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stm32-data b/stm32-data index 5412725bf..bad463688 160000 --- a/stm32-data +++ b/stm32-data @@ -1 +1 @@ -Subproject commit 5412725bf5401c6d49c4932487d80463fdb02286 +Subproject commit bad4636883f97a8377be15bd7de6aa3ab5e7d386 From b910551c9ac9857e77eea79a4845a38f38111d83 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Tue, 27 Jul 2021 12:52:01 -0400 Subject: [PATCH 2/6] Generate more rows in the interrupts! table. Adjust DMA/BDMA to use the new style. --- embassy-stm32/src/dma/bdma.rs | 2 +- embassy-stm32/src/dma/dma.rs | 2 +- stm32-metapac-gen/src/lib.rs | 34 ++++++++++++---------------------- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index c52188c36..5b8f31c21 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs @@ -242,7 +242,7 @@ pac::dma_channels! { } pac::interrupts! { - (BDMA, $irq:ident) => { + ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => { #[crate::interrupt] unsafe fn $irq () { on_irq() diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index 606c9d3d7..c6d35dc46 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs @@ -248,7 +248,7 @@ pac::dma_channels! { } pac::interrupts! { - (DMA, $irq:ident) => { + ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => { #[crate::interrupt] unsafe fn $irq () { on_irq() diff --git a/stm32-metapac-gen/src/lib.rs b/stm32-metapac-gen/src/lib.rs index 203d943de..ce720c677 100644 --- a/stm32-metapac-gen/src/lib.rs +++ b/stm32-metapac-gen/src/lib.rs @@ -50,6 +50,8 @@ pub struct Peripheral { pub pins: Vec, #[serde(default)] pub dma_channels: HashMap>, + #[serde(default)] + pub interrupts: HashMap } #[derive(Debug, Eq, PartialEq, Clone, Deserialize)] @@ -306,9 +308,6 @@ pub fn gen(options: Options) { } } - let mut has_bdma = false; - let mut has_dma = false; - for (name, p) in &core.peripherals { let captures = number_suffix_re.captures(&name).unwrap(); let root_peri_name = captures.get(1).unwrap().as_str().to_string(); @@ -328,12 +327,6 @@ pub fn gen(options: Options) { if let Some(block) = &p.block { let bi = BlockInfo::parse(block); - if bi.module == "bdma" { - has_bdma = true - } else if bi.module == "dma" { - has_dma = true - } - peripheral_counts.insert( bi.module.clone(), peripheral_counts.get(&bi.module).map_or(1, |v| v + 1), @@ -352,6 +345,16 @@ pub fn gen(options: Options) { peripheral_pins_table.push(row); } + for (signal, irq_name) in &p.interrupts { + let mut row = Vec::new(); + row.push(name.clone()); + row.push(bi.module.clone()); + row.push(bi.block.clone()); + row.push( signal.clone() ); + row.push( irq_name.to_ascii_uppercase() ); + interrupt_table.push(row) + } + for (request, dma_channels) in &p.dma_channels { for channel in dma_channels.iter() { let mut row = Vec::new(); @@ -553,19 +556,6 @@ pub fn gen(options: Options) { interrupt_table.push(vec![name.clone()]); - if name.starts_with("DMA1_") || name.starts_with("DMA2_") || name.contains("_DMA") { - if has_dma { - interrupt_table.push(vec!["DMA".to_string(), name.clone()]); - } else if has_bdma { - interrupt_table.push(vec!["BDMA".to_string(), name.clone()]); - } - } - - if name.starts_with("BDMA_") || name.starts_with("BDMA1_") || name.starts_with("BDMA2_") - { - interrupt_table.push(vec!["BDMA".to_string(), name.clone()]); - } - if name.contains("EXTI") { interrupt_table.push(vec!["EXTI".to_string(), name.clone()]); } From 8759213fcc5ba154b1d39362d81da85164b3aab2 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Tue, 27 Jul 2021 13:23:33 -0400 Subject: [PATCH 3/6] Use new interrupt! table format to /enable/ the IRQs also. --- embassy-stm32/src/dma/bdma.rs | 2 +- embassy-stm32/src/dma/dma.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index 5b8f31c21..2aa00ebee 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs @@ -143,7 +143,7 @@ unsafe fn on_irq() { /// safety: must be called only once pub(crate) unsafe fn init() { pac::interrupts! { - (BDMA, $irq:ident) => { + ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => { crate::interrupt::$irq::steal().enable(); }; } diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index c6d35dc46..47120c39d 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs @@ -149,7 +149,7 @@ unsafe fn on_irq() { /// safety: must be called only once pub(crate) unsafe fn init() { pac::interrupts! { - (DMA, $irq:ident) => { + ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => { interrupt::$irq::steal().enable(); }; } From ee755a729f58a5d7722f6cfa41c7a9252ba05717 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Tue, 27 Jul 2021 13:49:14 -0400 Subject: [PATCH 4/6] Update to new stm32-data with better multicore NVIC parsing. --- stm32-data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stm32-data b/stm32-data index bad463688..07eae0719 160000 --- a/stm32-data +++ b/stm32-data @@ -1 +1 @@ -Subproject commit bad4636883f97a8377be15bd7de6aa3ab5e7d386 +Subproject commit 07eae071915f8ffbf311bd5dfc6391dcca92ee10 From abe13e6b18dfd5c68f201decf6940abc7f6356c2 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Wed, 28 Jul 2021 09:09:19 -0400 Subject: [PATCH 5/6] Trivial to trigger checks from CI. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8d5fddd0d..13bcf6e5b 100644 --- a/README.md +++ b/README.md @@ -87,3 +87,4 @@ This work is licensed under either of - MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. + From d8c6ffe3a28aa41e46e880e475b0e7aedc9ece71 Mon Sep 17 00:00:00 2001 From: Bob McWhirter Date: Wed, 28 Jul 2021 09:24:45 -0400 Subject: [PATCH 6/6] Revert "Optimize CI" This reverts commit fe58e9541d97d16d39534cb8d38c68c61b6f8726. --- .github/workflows/rust.yml | 56 ++++++++++++-------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 69cd9ff14..118143daa 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -95,24 +95,21 @@ jobs: - uses: actions/checkout@v2 with: submodules: true - - uses: actions/cache@v2 + - uses: actions-rs/toolchain@v1 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo-${{ matrix.target }}- + toolchain: stable + - name: cache + id: cache-target + uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-${{ matrix.target }} # We have to append the "-D warnings" flag to .cargo/config rather than # using the RUSTFLAGS environment variable because if we set RUSTFLAGS # cargo will ignore the rustflags config in .cargo/config. - name: Check run: | - export CARGO_TARGET_DIR=$PWD/target mkdir -p .cargo echo -e '[target."cfg(all())"]\nrustflags = ["-D", "warnings"]' >> .cargo/config cd ${{ matrix.package }} && RUSTFLAGS=-Dwarnings cargo check --features=${{ matrix.features }} --target=${{ matrix.target }} @@ -121,6 +118,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable - name: Check fmt run: for i in embassy-*; do (cd $i; cargo fmt -- --check); done @@ -128,22 +128,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/cache@v2 + - uses: actions-rs/toolchain@v1 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo- + toolchain: stable - name: Test - run: | - export CARGO_TARGET_DIR=$PWD/target - cd embassy - cargo test + run: cd embassy && cargo test metapac_gen: runs-on: ubuntu-latest @@ -151,19 +140,8 @@ jobs: - uses: actions/checkout@v2 with: submodules: true - - uses: actions/cache@v2 + - uses: actions-rs/toolchain@v1 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} - restore-keys: | - ${{ runner.os }}-cargo- + toolchain: stable - name: Generate pregenerated metapac - run: | - export CARGO_TARGET_DIR=$PWD/target - cd stm32-metapac-gen - cargo run --release + run: cd stm32-metapac-gen; cargo run --release