diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:15:44 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:22:31 +0200 |
| commit | a8703b75988e1e700af701116464025679d2feb8 (patch) | |
| tree | f4ec5de70ec05e793a774049e010935ac45853ed /examples/boot | |
| parent | 6199bdea710cde33e5d5381b6d6abfc8af46df19 (diff) | |
Run rustfmt.
Diffstat (limited to 'examples/boot')
| -rw-r--r-- | examples/boot/nrf/src/bin/a.rs | 14 | ||||
| -rw-r--r-- | examples/boot/nrf/src/bin/b.rs | 7 | ||||
| -rw-r--r-- | examples/boot/stm32f3/src/bin/a.rs | 10 | ||||
| -rw-r--r-- | examples/boot/stm32f3/src/bin/b.rs | 5 | ||||
| -rw-r--r-- | examples/boot/stm32f7/src/bin/a.rs | 10 | ||||
| -rw-r--r-- | examples/boot/stm32f7/src/bin/b.rs | 5 | ||||
| -rw-r--r-- | examples/boot/stm32h7/src/bin/a.rs | 10 | ||||
| -rw-r--r-- | examples/boot/stm32h7/src/bin/b.rs | 5 | ||||
| -rw-r--r-- | examples/boot/stm32l0/src/bin/a.rs | 10 | ||||
| -rw-r--r-- | examples/boot/stm32l0/src/bin/b.rs | 5 | ||||
| -rw-r--r-- | examples/boot/stm32l1/src/bin/a.rs | 10 | ||||
| -rw-r--r-- | examples/boot/stm32l1/src/bin/b.rs | 5 | ||||
| -rw-r--r-- | examples/boot/stm32l4/src/bin/a.rs | 10 | ||||
| -rw-r--r-- | examples/boot/stm32l4/src/bin/b.rs | 5 | ||||
| -rw-r--r-- | examples/boot/stm32wl/src/bin/a.rs | 10 | ||||
| -rw-r--r-- | examples/boot/stm32wl/src/bin/b.rs | 5 |
16 files changed, 41 insertions, 85 deletions
diff --git a/examples/boot/nrf/src/bin/a.rs b/examples/boot/nrf/src/bin/a.rs index d45d0ff34..0b9715e49 100644 --- a/examples/boot/nrf/src/bin/a.rs +++ b/examples/boot/nrf/src/bin/a.rs | |||
| @@ -6,12 +6,9 @@ | |||
| 6 | 6 | ||
| 7 | use embassy_boot_nrf::FirmwareUpdater; | 7 | use embassy_boot_nrf::FirmwareUpdater; |
| 8 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 9 | use embassy_nrf::{ | 9 | use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; |
| 10 | gpio::{Input, Pull}, | 10 | use embassy_nrf::nvmc::Nvmc; |
| 11 | gpio::{Level, Output, OutputDrive}, | 11 | use embassy_nrf::Peripherals; |
| 12 | nvmc::Nvmc, | ||
| 13 | Peripherals, | ||
| 14 | }; | ||
| 15 | use panic_reset as _; | 12 | use panic_reset as _; |
| 16 | 13 | ||
| 17 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 14 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| @@ -35,10 +32,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 35 | for chunk in APP_B.chunks(4096) { | 32 | for chunk in APP_B.chunks(4096) { |
| 36 | let mut buf: [u8; 4096] = [0; 4096]; | 33 | let mut buf: [u8; 4096] = [0; 4096]; |
| 37 | buf[..chunk.len()].copy_from_slice(chunk); | 34 | buf[..chunk.len()].copy_from_slice(chunk); |
| 38 | updater | 35 | updater.write_firmware(offset, &buf, &mut nvmc, 4096).await.unwrap(); |
| 39 | .write_firmware(offset, &buf, &mut nvmc, 4096) | ||
| 40 | .await | ||
| 41 | .unwrap(); | ||
| 42 | offset += chunk.len(); | 36 | offset += chunk.len(); |
| 43 | } | 37 | } |
| 44 | updater.update(&mut nvmc).await.unwrap(); | 38 | updater.update(&mut nvmc).await.unwrap(); |
diff --git a/examples/boot/nrf/src/bin/b.rs b/examples/boot/nrf/src/bin/b.rs index 18bb6330c..a06c20f8b 100644 --- a/examples/boot/nrf/src/bin/b.rs +++ b/examples/boot/nrf/src/bin/b.rs | |||
| @@ -5,11 +5,8 @@ | |||
| 5 | #![feature(type_alias_impl_trait)] | 5 | #![feature(type_alias_impl_trait)] |
| 6 | 6 | ||
| 7 | use embassy::time::{Duration, Timer}; | 7 | use embassy::time::{Duration, Timer}; |
| 8 | use embassy_nrf::{ | 8 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 9 | gpio::{Level, Output, OutputDrive}, | 9 | use embassy_nrf::Peripherals; |
| 10 | Peripherals, | ||
| 11 | }; | ||
| 12 | |||
| 13 | use panic_reset as _; | 10 | use panic_reset as _; |
| 14 | 11 | ||
| 15 | #[embassy::main] | 12 | #[embassy::main] |
diff --git a/examples/boot/stm32f3/src/bin/a.rs b/examples/boot/stm32f3/src/bin/a.rs index 9ad798389..4ff18d7c7 100644 --- a/examples/boot/stm32f3/src/bin/a.rs +++ b/examples/boot/stm32f3/src/bin/a.rs | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy_boot_stm32::FirmwareUpdater; | 7 | use embassy_boot_stm32::FirmwareUpdater; |
| 6 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 7 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | |||
| 10 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 13 | use panic_reset as _; |
| 12 | 14 | ||
| 13 | #[cfg(feature = "defmt-rtt")] | ||
| 14 | use defmt_rtt::*; | ||
| 15 | |||
| 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 17 | 16 | ||
| 18 | #[embassy::main] | 17 | #[embassy::main] |
| @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 32 | for chunk in APP_B.chunks(2048) { | 31 | for chunk in APP_B.chunks(2048) { |
| 33 | let mut buf: [u8; 2048] = [0; 2048]; | 32 | let mut buf: [u8; 2048] = [0; 2048]; |
| 34 | buf[..chunk.len()].copy_from_slice(chunk); | 33 | buf[..chunk.len()].copy_from_slice(chunk); |
| 35 | updater | 34 | updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); |
| 36 | .write_firmware(offset, &buf, &mut flash, 2048) | ||
| 37 | .await | ||
| 38 | .unwrap(); | ||
| 39 | offset += chunk.len(); | 35 | offset += chunk.len(); |
| 40 | } | 36 | } |
| 41 | updater.update(&mut flash).await.unwrap(); | 37 | updater.update(&mut flash).await.unwrap(); |
diff --git a/examples/boot/stm32f3/src/bin/b.rs b/examples/boot/stm32f3/src/bin/b.rs index 814275988..4487e586e 100644 --- a/examples/boot/stm32f3/src/bin/b.rs +++ b/examples/boot/stm32f3/src/bin/b.rs | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 9 | use panic_reset as _; | 11 | use panic_reset as _; |
| 10 | 12 | ||
| 11 | #[cfg(feature = "defmt-rtt")] | ||
| 12 | use defmt_rtt::*; | ||
| 13 | |||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); |
diff --git a/examples/boot/stm32f7/src/bin/a.rs b/examples/boot/stm32f7/src/bin/a.rs index b4f49d579..9c7921a1a 100644 --- a/examples/boot/stm32f7/src/bin/a.rs +++ b/examples/boot/stm32f7/src/bin/a.rs | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy_boot_stm32::FirmwareUpdater; | 7 | use embassy_boot_stm32::FirmwareUpdater; |
| 6 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 7 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | |||
| 10 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 13 | use panic_reset as _; |
| 12 | 14 | ||
| 13 | #[cfg(feature = "defmt-rtt")] | ||
| 14 | use defmt_rtt::*; | ||
| 15 | |||
| 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 17 | 16 | ||
| 18 | #[embassy::main] | 17 | #[embassy::main] |
| @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 32 | let mut buf: [u8; 256 * 1024] = [0; 256 * 1024]; | 31 | let mut buf: [u8; 256 * 1024] = [0; 256 * 1024]; |
| 33 | for chunk in APP_B.chunks(256 * 1024) { | 32 | for chunk in APP_B.chunks(256 * 1024) { |
| 34 | buf[..chunk.len()].copy_from_slice(chunk); | 33 | buf[..chunk.len()].copy_from_slice(chunk); |
| 35 | updater | 34 | updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); |
| 36 | .write_firmware(offset, &buf, &mut flash, 2048) | ||
| 37 | .await | ||
| 38 | .unwrap(); | ||
| 39 | offset += chunk.len(); | 35 | offset += chunk.len(); |
| 40 | } | 36 | } |
| 41 | updater.update(&mut flash).await.unwrap(); | 37 | updater.update(&mut flash).await.unwrap(); |
diff --git a/examples/boot/stm32f7/src/bin/b.rs b/examples/boot/stm32f7/src/bin/b.rs index ed37137f5..aa05bbcdd 100644 --- a/examples/boot/stm32f7/src/bin/b.rs +++ b/examples/boot/stm32f7/src/bin/b.rs | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 9 | use panic_reset as _; | 11 | use panic_reset as _; |
| 10 | 12 | ||
| 11 | #[cfg(feature = "defmt-rtt")] | ||
| 12 | use defmt_rtt::*; | ||
| 13 | |||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | Timer::after(Duration::from_millis(300)).await; | 15 | Timer::after(Duration::from_millis(300)).await; |
diff --git a/examples/boot/stm32h7/src/bin/a.rs b/examples/boot/stm32h7/src/bin/a.rs index 1d196e8a5..704979dba 100644 --- a/examples/boot/stm32h7/src/bin/a.rs +++ b/examples/boot/stm32h7/src/bin/a.rs | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy_boot_stm32::FirmwareUpdater; | 7 | use embassy_boot_stm32::FirmwareUpdater; |
| 6 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 7 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | |||
| 10 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 13 | use panic_reset as _; |
| 12 | 14 | ||
| 13 | #[cfg(feature = "defmt-rtt")] | ||
| 14 | use defmt_rtt::*; | ||
| 15 | |||
| 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 17 | 16 | ||
| 18 | #[embassy::main] | 17 | #[embassy::main] |
| @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 32 | let mut buf: [u8; 128 * 1024] = [0; 128 * 1024]; | 31 | let mut buf: [u8; 128 * 1024] = [0; 128 * 1024]; |
| 33 | for chunk in APP_B.chunks(128 * 1024) { | 32 | for chunk in APP_B.chunks(128 * 1024) { |
| 34 | buf[..chunk.len()].copy_from_slice(chunk); | 33 | buf[..chunk.len()].copy_from_slice(chunk); |
| 35 | updater | 34 | updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); |
| 36 | .write_firmware(offset, &buf, &mut flash, 2048) | ||
| 37 | .await | ||
| 38 | .unwrap(); | ||
| 39 | offset += chunk.len(); | 35 | offset += chunk.len(); |
| 40 | } | 36 | } |
| 41 | updater.update(&mut flash).await.unwrap(); | 37 | updater.update(&mut flash).await.unwrap(); |
diff --git a/examples/boot/stm32h7/src/bin/b.rs b/examples/boot/stm32h7/src/bin/b.rs index 233b93e1a..ea0140253 100644 --- a/examples/boot/stm32h7/src/bin/b.rs +++ b/examples/boot/stm32h7/src/bin/b.rs | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 9 | use panic_reset as _; | 11 | use panic_reset as _; |
| 10 | 12 | ||
| 11 | #[cfg(feature = "defmt-rtt")] | ||
| 12 | use defmt_rtt::*; | ||
| 13 | |||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | Timer::after(Duration::from_millis(300)).await; | 15 | Timer::after(Duration::from_millis(300)).await; |
diff --git a/examples/boot/stm32l0/src/bin/a.rs b/examples/boot/stm32l0/src/bin/a.rs index d4b252bf0..ce620347b 100644 --- a/examples/boot/stm32l0/src/bin/a.rs +++ b/examples/boot/stm32l0/src/bin/a.rs | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::time::{Duration, Timer}; | 7 | use embassy::time::{Duration, Timer}; |
| 6 | use embassy_boot_stm32::FirmwareUpdater; | 8 | use embassy_boot_stm32::FirmwareUpdater; |
| 7 | use embassy_embedded_hal::adapter::BlockingAsync; | 9 | use embassy_embedded_hal::adapter::BlockingAsync; |
| @@ -11,9 +13,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | |||
| 11 | use embassy_stm32::Peripherals; | 13 | use embassy_stm32::Peripherals; |
| 12 | use panic_reset as _; | 14 | use panic_reset as _; |
| 13 | 15 | ||
| 14 | #[cfg(feature = "defmt-rtt")] | ||
| 15 | use defmt_rtt::*; | ||
| 16 | |||
| 17 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 18 | 17 | ||
| 19 | #[embassy::main] | 18 | #[embassy::main] |
| @@ -34,10 +33,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 34 | for chunk in APP_B.chunks(128) { | 33 | for chunk in APP_B.chunks(128) { |
| 35 | let mut buf: [u8; 128] = [0; 128]; | 34 | let mut buf: [u8; 128] = [0; 128]; |
| 36 | buf[..chunk.len()].copy_from_slice(chunk); | 35 | buf[..chunk.len()].copy_from_slice(chunk); |
| 37 | updater | 36 | updater.write_firmware(offset, &buf, &mut flash, 128).await.unwrap(); |
| 38 | .write_firmware(offset, &buf, &mut flash, 128) | ||
| 39 | .await | ||
| 40 | .unwrap(); | ||
| 41 | offset += chunk.len(); | 37 | offset += chunk.len(); |
| 42 | } | 38 | } |
| 43 | 39 | ||
diff --git a/examples/boot/stm32l0/src/bin/b.rs b/examples/boot/stm32l0/src/bin/b.rs index ed774fd70..0b585a14c 100644 --- a/examples/boot/stm32l0/src/bin/b.rs +++ b/examples/boot/stm32l0/src/bin/b.rs | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 9 | use panic_reset as _; | 11 | use panic_reset as _; |
| 10 | 12 | ||
| 11 | #[cfg(feature = "defmt-rtt")] | ||
| 12 | use defmt_rtt::*; | ||
| 13 | |||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); |
diff --git a/examples/boot/stm32l1/src/bin/a.rs b/examples/boot/stm32l1/src/bin/a.rs index d4b252bf0..ce620347b 100644 --- a/examples/boot/stm32l1/src/bin/a.rs +++ b/examples/boot/stm32l1/src/bin/a.rs | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::time::{Duration, Timer}; | 7 | use embassy::time::{Duration, Timer}; |
| 6 | use embassy_boot_stm32::FirmwareUpdater; | 8 | use embassy_boot_stm32::FirmwareUpdater; |
| 7 | use embassy_embedded_hal::adapter::BlockingAsync; | 9 | use embassy_embedded_hal::adapter::BlockingAsync; |
| @@ -11,9 +13,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | |||
| 11 | use embassy_stm32::Peripherals; | 13 | use embassy_stm32::Peripherals; |
| 12 | use panic_reset as _; | 14 | use panic_reset as _; |
| 13 | 15 | ||
| 14 | #[cfg(feature = "defmt-rtt")] | ||
| 15 | use defmt_rtt::*; | ||
| 16 | |||
| 17 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 18 | 17 | ||
| 19 | #[embassy::main] | 18 | #[embassy::main] |
| @@ -34,10 +33,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 34 | for chunk in APP_B.chunks(128) { | 33 | for chunk in APP_B.chunks(128) { |
| 35 | let mut buf: [u8; 128] = [0; 128]; | 34 | let mut buf: [u8; 128] = [0; 128]; |
| 36 | buf[..chunk.len()].copy_from_slice(chunk); | 35 | buf[..chunk.len()].copy_from_slice(chunk); |
| 37 | updater | 36 | updater.write_firmware(offset, &buf, &mut flash, 128).await.unwrap(); |
| 38 | .write_firmware(offset, &buf, &mut flash, 128) | ||
| 39 | .await | ||
| 40 | .unwrap(); | ||
| 41 | offset += chunk.len(); | 37 | offset += chunk.len(); |
| 42 | } | 38 | } |
| 43 | 39 | ||
diff --git a/examples/boot/stm32l1/src/bin/b.rs b/examples/boot/stm32l1/src/bin/b.rs index ed774fd70..0b585a14c 100644 --- a/examples/boot/stm32l1/src/bin/b.rs +++ b/examples/boot/stm32l1/src/bin/b.rs | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 9 | use panic_reset as _; | 11 | use panic_reset as _; |
| 10 | 12 | ||
| 11 | #[cfg(feature = "defmt-rtt")] | ||
| 12 | use defmt_rtt::*; | ||
| 13 | |||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PB6, Level::High, Speed::Low); |
diff --git a/examples/boot/stm32l4/src/bin/a.rs b/examples/boot/stm32l4/src/bin/a.rs index 23b1d98bb..bf6099355 100644 --- a/examples/boot/stm32l4/src/bin/a.rs +++ b/examples/boot/stm32l4/src/bin/a.rs | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy_boot_stm32::FirmwareUpdater; | 7 | use embassy_boot_stm32::FirmwareUpdater; |
| 6 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 7 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | |||
| 10 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 13 | use panic_reset as _; |
| 12 | 14 | ||
| 13 | #[cfg(feature = "defmt-rtt")] | ||
| 14 | use defmt_rtt::*; | ||
| 15 | |||
| 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 17 | 16 | ||
| 18 | #[embassy::main] | 17 | #[embassy::main] |
| @@ -32,10 +31,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 32 | for chunk in APP_B.chunks(2048) { | 31 | for chunk in APP_B.chunks(2048) { |
| 33 | let mut buf: [u8; 2048] = [0; 2048]; | 32 | let mut buf: [u8; 2048] = [0; 2048]; |
| 34 | buf[..chunk.len()].copy_from_slice(chunk); | 33 | buf[..chunk.len()].copy_from_slice(chunk); |
| 35 | updater | 34 | updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); |
| 36 | .write_firmware(offset, &buf, &mut flash, 2048) | ||
| 37 | .await | ||
| 38 | .unwrap(); | ||
| 39 | offset += chunk.len(); | 35 | offset += chunk.len(); |
| 40 | } | 36 | } |
| 41 | updater.update(&mut flash).await.unwrap(); | 37 | updater.update(&mut flash).await.unwrap(); |
diff --git a/examples/boot/stm32l4/src/bin/b.rs b/examples/boot/stm32l4/src/bin/b.rs index 814275988..4487e586e 100644 --- a/examples/boot/stm32l4/src/bin/b.rs +++ b/examples/boot/stm32l4/src/bin/b.rs | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 9 | use panic_reset as _; | 11 | use panic_reset as _; |
| 10 | 12 | ||
| 11 | #[cfg(feature = "defmt-rtt")] | ||
| 12 | use defmt_rtt::*; | ||
| 13 | |||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PA5, Level::High, Speed::Low); |
diff --git a/examples/boot/stm32wl/src/bin/a.rs b/examples/boot/stm32wl/src/bin/a.rs index 1089eff1e..dc1eb9bed 100644 --- a/examples/boot/stm32wl/src/bin/a.rs +++ b/examples/boot/stm32wl/src/bin/a.rs | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy_boot_stm32::FirmwareUpdater; | 7 | use embassy_boot_stm32::FirmwareUpdater; |
| 6 | use embassy_embedded_hal::adapter::BlockingAsync; | 8 | use embassy_embedded_hal::adapter::BlockingAsync; |
| 7 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| @@ -10,9 +12,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | |||
| 10 | use embassy_stm32::Peripherals; | 12 | use embassy_stm32::Peripherals; |
| 11 | use panic_reset as _; | 13 | use panic_reset as _; |
| 12 | 14 | ||
| 13 | #[cfg(feature = "defmt-rtt")] | ||
| 14 | use defmt_rtt::*; | ||
| 15 | |||
| 16 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 15 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| 17 | 16 | ||
| 18 | #[embassy::main] | 17 | #[embassy::main] |
| @@ -34,10 +33,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 34 | let mut buf: [u8; 2048] = [0; 2048]; | 33 | let mut buf: [u8; 2048] = [0; 2048]; |
| 35 | buf[..chunk.len()].copy_from_slice(chunk); | 34 | buf[..chunk.len()].copy_from_slice(chunk); |
| 36 | // defmt::info!("Writing chunk at 0x{:x}", offset); | 35 | // defmt::info!("Writing chunk at 0x{:x}", offset); |
| 37 | updater | 36 | updater.write_firmware(offset, &buf, &mut flash, 2048).await.unwrap(); |
| 38 | .write_firmware(offset, &buf, &mut flash, 2048) | ||
| 39 | .await | ||
| 40 | .unwrap(); | ||
| 41 | offset += chunk.len(); | 37 | offset += chunk.len(); |
| 42 | } | 38 | } |
| 43 | updater.update(&mut flash).await.unwrap(); | 39 | updater.update(&mut flash).await.unwrap(); |
diff --git a/examples/boot/stm32wl/src/bin/b.rs b/examples/boot/stm32wl/src/bin/b.rs index ffe15b661..f2344bd53 100644 --- a/examples/boot/stm32wl/src/bin/b.rs +++ b/examples/boot/stm32wl/src/bin/b.rs | |||
| @@ -2,15 +2,14 @@ | |||
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | #![feature(type_alias_impl_trait)] | 3 | #![feature(type_alias_impl_trait)] |
| 4 | 4 | ||
| 5 | #[cfg(feature = "defmt-rtt")] | ||
| 6 | use defmt_rtt::*; | ||
| 5 | use embassy::executor::Spawner; | 7 | use embassy::executor::Spawner; |
| 6 | use embassy::time::{Duration, Timer}; | 8 | use embassy::time::{Duration, Timer}; |
| 7 | use embassy_stm32::gpio::{Level, Output, Speed}; | 9 | use embassy_stm32::gpio::{Level, Output, Speed}; |
| 8 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 9 | use panic_reset as _; | 11 | use panic_reset as _; |
| 10 | 12 | ||
| 11 | #[cfg(feature = "defmt-rtt")] | ||
| 12 | use defmt_rtt::*; | ||
| 13 | |||
| 14 | #[embassy::main] | 13 | #[embassy::main] |
| 15 | async fn main(_spawner: Spawner, p: Peripherals) { | 14 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 16 | let mut led = Output::new(p.PB15, Level::High, Speed::Low); | 15 | let mut led = Output::new(p.PB15, Level::High, Speed::Low); |
