56
									
								
								.github/workflows/rust.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										56
									
								
								.github/workflows/rust.yml
									
									
									
									
										vendored
									
									
								
							@@ -95,24 +95,21 @@ jobs:
 | 
				
			|||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          submodules: true
 | 
					          submodules: true
 | 
				
			||||||
      - uses: actions/cache@v2
 | 
					      - uses: actions-rs/toolchain@v1
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          path: |
 | 
					          toolchain: stable
 | 
				
			||||||
            ~/.cargo/bin/
 | 
					      - name: cache
 | 
				
			||||||
            ~/.cargo/registry/index/
 | 
					        id: cache-target
 | 
				
			||||||
            ~/.cargo/registry/cache/
 | 
					        uses: actions/cache@v2
 | 
				
			||||||
            ~/.cargo/git/db/
 | 
					        with:
 | 
				
			||||||
            target/
 | 
					          path: target
 | 
				
			||||||
          key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }}
 | 
					          key: ${{ runner.os }}-${{ matrix.target }}
 | 
				
			||||||
          restore-keys: |
 | 
					 | 
				
			||||||
            ${{ runner.os }}-cargo-${{ matrix.target }}-
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # We have to append the "-D warnings" flag to .cargo/config rather than
 | 
					      # We have to append the "-D warnings" flag to .cargo/config rather than
 | 
				
			||||||
      # using the RUSTFLAGS environment variable because if we set RUSTFLAGS
 | 
					      # using the RUSTFLAGS environment variable because if we set RUSTFLAGS
 | 
				
			||||||
      # cargo will ignore the rustflags config in .cargo/config.
 | 
					      # cargo will ignore the rustflags config in .cargo/config.
 | 
				
			||||||
      - name: Check
 | 
					      - name: Check
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          export CARGO_TARGET_DIR=$PWD/target
 | 
					 | 
				
			||||||
          mkdir -p .cargo
 | 
					          mkdir -p .cargo
 | 
				
			||||||
          echo -e '[target."cfg(all())"]\nrustflags = ["-D", "warnings"]' >> .cargo/config
 | 
					          echo -e '[target."cfg(all())"]\nrustflags = ["-D", "warnings"]' >> .cargo/config
 | 
				
			||||||
          cd ${{ matrix.package }} && RUSTFLAGS=-Dwarnings cargo check --features=${{ matrix.features }} --target=${{ matrix.target }}
 | 
					          cd ${{ matrix.package }} && RUSTFLAGS=-Dwarnings cargo check --features=${{ matrix.features }} --target=${{ matrix.target }}
 | 
				
			||||||
@@ -121,6 +118,9 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      - uses: actions-rs/toolchain@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          toolchain: stable
 | 
				
			||||||
      - name: Check fmt
 | 
					      - name: Check fmt
 | 
				
			||||||
        run: for i in embassy-*; do (cd $i; cargo fmt -- --check); done
 | 
					        run: for i in embassy-*; do (cd $i; cargo fmt -- --check); done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -128,22 +128,11 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
      - uses: actions/cache@v2
 | 
					      - uses: actions-rs/toolchain@v1
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          path: |
 | 
					          toolchain: stable
 | 
				
			||||||
            ~/.cargo/bin/
 | 
					 | 
				
			||||||
            ~/.cargo/registry/index/
 | 
					 | 
				
			||||||
            ~/.cargo/registry/cache/
 | 
					 | 
				
			||||||
            ~/.cargo/git/db/
 | 
					 | 
				
			||||||
            target/
 | 
					 | 
				
			||||||
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
 | 
					 | 
				
			||||||
          restore-keys: |
 | 
					 | 
				
			||||||
            ${{ runner.os }}-cargo-
 | 
					 | 
				
			||||||
      - name: Test
 | 
					      - name: Test
 | 
				
			||||||
        run: |
 | 
					        run: cd embassy && cargo test
 | 
				
			||||||
          export CARGO_TARGET_DIR=$PWD/target
 | 
					 | 
				
			||||||
          cd embassy
 | 
					 | 
				
			||||||
          cargo test
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  metapac_gen:
 | 
					  metapac_gen:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
@@ -151,19 +140,8 @@ jobs:
 | 
				
			|||||||
      - uses: actions/checkout@v2
 | 
					      - uses: actions/checkout@v2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          submodules: true
 | 
					          submodules: true
 | 
				
			||||||
      - uses: actions/cache@v2
 | 
					      - uses: actions-rs/toolchain@v1
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          path: |
 | 
					          toolchain: stable
 | 
				
			||||||
            ~/.cargo/bin/
 | 
					 | 
				
			||||||
            ~/.cargo/registry/index/
 | 
					 | 
				
			||||||
            ~/.cargo/registry/cache/
 | 
					 | 
				
			||||||
            ~/.cargo/git/db/
 | 
					 | 
				
			||||||
            target/
 | 
					 | 
				
			||||||
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
 | 
					 | 
				
			||||||
          restore-keys: |
 | 
					 | 
				
			||||||
            ${{ runner.os }}-cargo-
 | 
					 | 
				
			||||||
      - name: Generate pregenerated metapac
 | 
					      - name: Generate pregenerated metapac
 | 
				
			||||||
        run: |
 | 
					        run: cd stm32-metapac-gen; cargo run --release
 | 
				
			||||||
          export CARGO_TARGET_DIR=$PWD/target
 | 
					 | 
				
			||||||
          cd stm32-metapac-gen
 | 
					 | 
				
			||||||
          cargo run --release
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,3 +87,4 @@ This work is licensed under either of
 | 
				
			|||||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
 | 
					- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
at your option.
 | 
					at your option.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -143,7 +143,7 @@ unsafe fn on_irq() {
 | 
				
			|||||||
/// safety: must be called only once
 | 
					/// safety: must be called only once
 | 
				
			||||||
pub(crate) unsafe fn init() {
 | 
					pub(crate) unsafe fn init() {
 | 
				
			||||||
    pac::interrupts! {
 | 
					    pac::interrupts! {
 | 
				
			||||||
        (BDMA, $irq:ident) => {
 | 
					        ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
				
			||||||
            crate::interrupt::$irq::steal().enable();
 | 
					            crate::interrupt::$irq::steal().enable();
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -242,7 +242,7 @@ pac::dma_channels! {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pac::interrupts! {
 | 
					pac::interrupts! {
 | 
				
			||||||
    (BDMA, $irq:ident) => {
 | 
					    ($peri:ident, bdma, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
				
			||||||
        #[crate::interrupt]
 | 
					        #[crate::interrupt]
 | 
				
			||||||
        unsafe fn $irq () {
 | 
					        unsafe fn $irq () {
 | 
				
			||||||
            on_irq()
 | 
					            on_irq()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -149,7 +149,7 @@ unsafe fn on_irq() {
 | 
				
			|||||||
/// safety: must be called only once
 | 
					/// safety: must be called only once
 | 
				
			||||||
pub(crate) unsafe fn init() {
 | 
					pub(crate) unsafe fn init() {
 | 
				
			||||||
    pac::interrupts! {
 | 
					    pac::interrupts! {
 | 
				
			||||||
        (DMA, $irq:ident) => {
 | 
					        ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
				
			||||||
            interrupt::$irq::steal().enable();
 | 
					            interrupt::$irq::steal().enable();
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -248,7 +248,7 @@ pac::dma_channels! {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pac::interrupts! {
 | 
					pac::interrupts! {
 | 
				
			||||||
    (DMA, $irq:ident) => {
 | 
					    ($peri:ident, dma, $block:ident, $signal_name:ident, $irq:ident) => {
 | 
				
			||||||
        #[crate::interrupt]
 | 
					        #[crate::interrupt]
 | 
				
			||||||
        unsafe fn $irq () {
 | 
					        unsafe fn $irq () {
 | 
				
			||||||
            on_irq()
 | 
					            on_irq()
 | 
				
			||||||
 
 | 
				
			|||||||
 Submodule stm32-data updated: 5412725bf5...07eae07191
									
								
							@@ -50,6 +50,8 @@ pub struct Peripheral {
 | 
				
			|||||||
    pub pins: Vec<Pin>,
 | 
					    pub pins: Vec<Pin>,
 | 
				
			||||||
    #[serde(default)]
 | 
					    #[serde(default)]
 | 
				
			||||||
    pub dma_channels: HashMap<String, Vec<PeripheralDmaChannel>>,
 | 
					    pub dma_channels: HashMap<String, Vec<PeripheralDmaChannel>>,
 | 
				
			||||||
 | 
					    #[serde(default)]
 | 
				
			||||||
 | 
					    pub interrupts: HashMap<String, String>
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Debug, Eq, PartialEq, Clone, Deserialize)]
 | 
					#[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 {
 | 
					        for (name, p) in &core.peripherals {
 | 
				
			||||||
            let captures = number_suffix_re.captures(&name).unwrap();
 | 
					            let captures = number_suffix_re.captures(&name).unwrap();
 | 
				
			||||||
            let root_peri_name = captures.get(1).unwrap().as_str().to_string();
 | 
					            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 {
 | 
					            if let Some(block) = &p.block {
 | 
				
			||||||
                let bi = BlockInfo::parse(block);
 | 
					                let bi = BlockInfo::parse(block);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if bi.module == "bdma" {
 | 
					 | 
				
			||||||
                    has_bdma = true
 | 
					 | 
				
			||||||
                } else if bi.module == "dma" {
 | 
					 | 
				
			||||||
                    has_dma = true
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                peripheral_counts.insert(
 | 
					                peripheral_counts.insert(
 | 
				
			||||||
                    bi.module.clone(),
 | 
					                    bi.module.clone(),
 | 
				
			||||||
                    peripheral_counts.get(&bi.module).map_or(1, |v| v + 1),
 | 
					                    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);
 | 
					                    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 (request, dma_channels) in &p.dma_channels {
 | 
				
			||||||
                    for channel in dma_channels.iter() {
 | 
					                    for channel in dma_channels.iter() {
 | 
				
			||||||
                        let mut row = Vec::new();
 | 
					                        let mut row = Vec::new();
 | 
				
			||||||
@@ -553,19 +556,6 @@ pub fn gen(options: Options) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            interrupt_table.push(vec![name.clone()]);
 | 
					            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") {
 | 
					            if name.contains("EXTI") {
 | 
				
			||||||
                interrupt_table.push(vec!["EXTI".to_string(), name.clone()]);
 | 
					                interrupt_table.push(vec!["EXTI".to_string(), name.clone()]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user