diff options
| author | Karun Koppula <[email protected]> | 2024-03-07 15:20:29 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-07 15:20:29 -0500 |
| commit | 54751b7a5093b7960e42cee1bc9a850f9c4b7a8f (patch) | |
| tree | df08df503f2b441c5b62306d50532403fe4c19c9 /examples/boot/application | |
| parent | 3b1d87050e2a30b598e92979b6f202b67664a29c (diff) | |
| parent | b2d236ee390081ec6aeef1a27da06098f9febbf9 (diff) | |
Merge branch 'main' into karun/main_octospi_implementation
Diffstat (limited to 'examples/boot/application')
| -rw-r--r-- | examples/boot/application/nrf/src/bin/a.rs | 2 | ||||
| -rw-r--r-- | examples/boot/application/rp/.cargo/config.toml | 4 | ||||
| -rw-r--r-- | examples/boot/application/rp/src/bin/a.rs | 2 | ||||
| -rw-r--r-- | examples/boot/application/stm32f3/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32f3/src/bin/a.rs | 7 | ||||
| -rw-r--r-- | examples/boot/application/stm32f7/src/bin/a.rs | 7 | ||||
| -rw-r--r-- | examples/boot/application/stm32h7/src/bin/a.rs | 7 | ||||
| -rw-r--r-- | examples/boot/application/stm32l0/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32l0/src/bin/a.rs | 7 | ||||
| -rw-r--r-- | examples/boot/application/stm32l1/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32l1/src/bin/a.rs | 7 | ||||
| -rw-r--r-- | examples/boot/application/stm32l4/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32l4/src/bin/a.rs | 7 | ||||
| -rw-r--r-- | examples/boot/application/stm32wb-dfu/README.md | 24 | ||||
| -rw-r--r-- | examples/boot/application/stm32wb-dfu/src/main.rs | 2 | ||||
| -rw-r--r-- | examples/boot/application/stm32wl/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32wl/src/bin/a.rs | 7 |
17 files changed, 38 insertions, 65 deletions
diff --git a/examples/boot/application/nrf/src/bin/a.rs b/examples/boot/application/nrf/src/bin/a.rs index f3abfddbc..851a3d721 100644 --- a/examples/boot/application/nrf/src/bin/a.rs +++ b/examples/boot/application/nrf/src/bin/a.rs | |||
| @@ -50,7 +50,7 @@ async fn main(_spawner: Spawner) { | |||
| 50 | let nvmc = Nvmc::new(p.NVMC); | 50 | let nvmc = Nvmc::new(p.NVMC); |
| 51 | let nvmc = Mutex::new(BlockingAsync::new(nvmc)); | 51 | let nvmc = Mutex::new(BlockingAsync::new(nvmc)); |
| 52 | 52 | ||
| 53 | let config = FirmwareUpdaterConfig::from_linkerfile(&nvmc); | 53 | let config = FirmwareUpdaterConfig::from_linkerfile(&nvmc, &nvmc); |
| 54 | let mut magic = [0; 4]; | 54 | let mut magic = [0; 4]; |
| 55 | let mut updater = FirmwareUpdater::new(config, &mut magic); | 55 | let mut updater = FirmwareUpdater::new(config, &mut magic); |
| 56 | loop { | 56 | loop { |
diff --git a/examples/boot/application/rp/.cargo/config.toml b/examples/boot/application/rp/.cargo/config.toml index cd8d1ef02..22ab3a5c1 100644 --- a/examples/boot/application/rp/.cargo/config.toml +++ b/examples/boot/application/rp/.cargo/config.toml | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | [unstable] | 1 | [unstable] |
| 2 | build-std = ["core"] | 2 | #build-std = ["core"] |
| 3 | build-std-features = ["panic_immediate_abort"] | 3 | #build-std-features = ["panic_immediate_abort"] |
| 4 | 4 | ||
| 5 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | 5 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] |
| 6 | runner = "probe-rs run --chip RP2040" | 6 | runner = "probe-rs run --chip RP2040" |
diff --git a/examples/boot/application/rp/src/bin/a.rs b/examples/boot/application/rp/src/bin/a.rs index 3f0bf90e2..ede0c07da 100644 --- a/examples/boot/application/rp/src/bin/a.rs +++ b/examples/boot/application/rp/src/bin/a.rs | |||
| @@ -36,7 +36,7 @@ async fn main(_s: Spawner) { | |||
| 36 | let flash = Flash::<_, _, FLASH_SIZE>::new_blocking(p.FLASH); | 36 | let flash = Flash::<_, _, FLASH_SIZE>::new_blocking(p.FLASH); |
| 37 | let flash = Mutex::new(RefCell::new(flash)); | 37 | let flash = Mutex::new(RefCell::new(flash)); |
| 38 | 38 | ||
| 39 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash); | 39 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash, &flash); |
| 40 | let mut aligned = AlignedBuffer([0; 1]); | 40 | let mut aligned = AlignedBuffer([0; 1]); |
| 41 | let mut updater = BlockingFirmwareUpdater::new(config, &mut aligned.0); | 41 | let mut updater = BlockingFirmwareUpdater::new(config, &mut aligned.0); |
| 42 | 42 | ||
diff --git a/examples/boot/application/stm32f3/memory.x b/examples/boot/application/stm32f3/memory.x index f51875766..02ebe3ecf 100644 --- a/examples/boot/application/stm32f3/memory.x +++ b/examples/boot/application/stm32f3/memory.x | |||
| @@ -3,8 +3,8 @@ MEMORY | |||
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ |
| 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K | 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K |
| 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K |
| 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 32K | 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 64K |
| 7 | DFU : ORIGIN = 0x08010000, LENGTH = 36K | 7 | DFU : ORIGIN = 0x08018000, LENGTH = 66K |
| 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K | 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K |
| 9 | } | 9 | } |
| 10 | 10 | ||
diff --git a/examples/boot/application/stm32f3/src/bin/a.rs b/examples/boot/application/stm32f3/src/bin/a.rs index 96ae5c47b..8858ae3da 100644 --- a/examples/boot/application/stm32f3/src/bin/a.rs +++ b/examples/boot/application/stm32f3/src/bin/a.rs | |||
| @@ -8,7 +8,7 @@ use embassy_embedded_hal::adapter::BlockingAsync; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; | 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; |
| 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 11 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 12 | use embassy_sync::mutex::Mutex; | 12 | use embassy_sync::mutex::Mutex; |
| 13 | use panic_reset as _; | 13 | use panic_reset as _; |
| 14 | 14 | ||
| @@ -23,13 +23,12 @@ async fn main(_spawner: Spawner) { | |||
| 23 | let flash = Flash::new_blocking(p.FLASH); | 23 | let flash = Flash::new_blocking(p.FLASH); |
| 24 | let flash = Mutex::new(BlockingAsync::new(flash)); | 24 | let flash = Mutex::new(BlockingAsync::new(flash)); |
| 25 | 25 | ||
| 26 | let button = Input::new(p.PC13, Pull::Up); | 26 | let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Up); |
| 27 | let mut button = ExtiInput::new(button, p.EXTI13); | ||
| 28 | 27 | ||
| 29 | let mut led = Output::new(p.PA5, Level::Low, Speed::Low); | 28 | let mut led = Output::new(p.PA5, Level::Low, Speed::Low); |
| 30 | led.set_high(); | 29 | led.set_high(); |
| 31 | 30 | ||
| 32 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 33 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 34 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 35 | button.wait_for_falling_edge().await; | 34 | button.wait_for_falling_edge().await; |
diff --git a/examples/boot/application/stm32f7/src/bin/a.rs b/examples/boot/application/stm32f7/src/bin/a.rs index a6107386a..d3df11fe4 100644 --- a/examples/boot/application/stm32f7/src/bin/a.rs +++ b/examples/boot/application/stm32f7/src/bin/a.rs | |||
| @@ -9,7 +9,7 @@ use embassy_boot_stm32::{AlignedBuffer, BlockingFirmwareUpdater, FirmwareUpdater | |||
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::ExtiInput; |
| 11 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; | 11 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; |
| 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 13 | use embassy_sync::blocking_mutex::Mutex; | 13 | use embassy_sync::blocking_mutex::Mutex; |
| 14 | use embedded_storage::nor_flash::NorFlash; | 14 | use embedded_storage::nor_flash::NorFlash; |
| 15 | use panic_reset as _; | 15 | use panic_reset as _; |
| @@ -25,13 +25,12 @@ async fn main(_spawner: Spawner) { | |||
| 25 | let flash = Flash::new_blocking(p.FLASH); | 25 | let flash = Flash::new_blocking(p.FLASH); |
| 26 | let flash = Mutex::new(RefCell::new(flash)); | 26 | let flash = Mutex::new(RefCell::new(flash)); |
| 27 | 27 | ||
| 28 | let button = Input::new(p.PC13, Pull::Down); | 28 | let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Down); |
| 29 | let mut button = ExtiInput::new(button, p.EXTI13); | ||
| 30 | 29 | ||
| 31 | let mut led = Output::new(p.PB7, Level::Low, Speed::Low); | 30 | let mut led = Output::new(p.PB7, Level::Low, Speed::Low); |
| 32 | led.set_high(); | 31 | led.set_high(); |
| 33 | 32 | ||
| 34 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash, &flash); |
| 35 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 36 | let mut updater = BlockingFirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = BlockingFirmwareUpdater::new(config, &mut magic.0); |
| 37 | let writer = updater.prepare_update().unwrap(); | 36 | let writer = updater.prepare_update().unwrap(); |
diff --git a/examples/boot/application/stm32h7/src/bin/a.rs b/examples/boot/application/stm32h7/src/bin/a.rs index b73506cf3..f61ac1f71 100644 --- a/examples/boot/application/stm32h7/src/bin/a.rs +++ b/examples/boot/application/stm32h7/src/bin/a.rs | |||
| @@ -9,7 +9,7 @@ use embassy_boot_stm32::{AlignedBuffer, BlockingFirmwareUpdater, FirmwareUpdater | |||
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::exti::ExtiInput; | 10 | use embassy_stm32::exti::ExtiInput; |
| 11 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; | 11 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; |
| 12 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 13 | use embassy_sync::blocking_mutex::Mutex; | 13 | use embassy_sync::blocking_mutex::Mutex; |
| 14 | use embedded_storage::nor_flash::NorFlash; | 14 | use embedded_storage::nor_flash::NorFlash; |
| 15 | use panic_reset as _; | 15 | use panic_reset as _; |
| @@ -25,13 +25,12 @@ async fn main(_spawner: Spawner) { | |||
| 25 | let flash = Flash::new_blocking(p.FLASH); | 25 | let flash = Flash::new_blocking(p.FLASH); |
| 26 | let flash = Mutex::new(RefCell::new(flash)); | 26 | let flash = Mutex::new(RefCell::new(flash)); |
| 27 | 27 | ||
| 28 | let button = Input::new(p.PC13, Pull::Down); | 28 | let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Down); |
| 29 | let mut button = ExtiInput::new(button, p.EXTI13); | ||
| 30 | 29 | ||
| 31 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); | 30 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); |
| 32 | led.set_high(); | 31 | led.set_high(); |
| 33 | 32 | ||
| 34 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash, &flash); |
| 35 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 36 | let mut updater = BlockingFirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = BlockingFirmwareUpdater::new(config, &mut magic.0); |
| 37 | let writer = updater.prepare_update().unwrap(); | 36 | let writer = updater.prepare_update().unwrap(); |
diff --git a/examples/boot/application/stm32l0/memory.x b/examples/boot/application/stm32l0/memory.x index a99330145..8866506a8 100644 --- a/examples/boot/application/stm32l0/memory.x +++ b/examples/boot/application/stm32l0/memory.x | |||
| @@ -3,8 +3,8 @@ MEMORY | |||
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ |
| 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K | 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K |
| 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K |
| 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 32K | 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 64K |
| 7 | DFU : ORIGIN = 0x08010000, LENGTH = 36K | 7 | DFU : ORIGIN = 0x08018000, LENGTH = 66K |
| 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16K | 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16K |
| 9 | } | 9 | } |
| 10 | 10 | ||
diff --git a/examples/boot/application/stm32l0/src/bin/a.rs b/examples/boot/application/stm32l0/src/bin/a.rs index 02f74bdef..f066c1139 100644 --- a/examples/boot/application/stm32l0/src/bin/a.rs +++ b/examples/boot/application/stm32l0/src/bin/a.rs | |||
| @@ -8,7 +8,7 @@ use embassy_embedded_hal::adapter::BlockingAsync; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; | 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; |
| 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 11 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 12 | use embassy_sync::mutex::Mutex; | 12 | use embassy_sync::mutex::Mutex; |
| 13 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 14 | use panic_reset as _; | 14 | use panic_reset as _; |
| @@ -24,14 +24,13 @@ async fn main(_spawner: Spawner) { | |||
| 24 | let flash = Flash::new_blocking(p.FLASH); | 24 | let flash = Flash::new_blocking(p.FLASH); |
| 25 | let flash = Mutex::new(BlockingAsync::new(flash)); | 25 | let flash = Mutex::new(BlockingAsync::new(flash)); |
| 26 | 26 | ||
| 27 | let button = Input::new(p.PB2, Pull::Up); | 27 | let mut button = ExtiInput::new(p.PB2, p.EXTI2, Pull::Up); |
| 28 | let mut button = ExtiInput::new(button, p.EXTI2); | ||
| 29 | 28 | ||
| 30 | let mut led = Output::new(p.PB5, Level::Low, Speed::Low); | 29 | let mut led = Output::new(p.PB5, Level::Low, Speed::Low); |
| 31 | 30 | ||
| 32 | led.set_high(); | 31 | led.set_high(); |
| 33 | 32 | ||
| 34 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 35 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 36 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 37 | button.wait_for_falling_edge().await; | 36 | button.wait_for_falling_edge().await; |
diff --git a/examples/boot/application/stm32l1/memory.x b/examples/boot/application/stm32l1/memory.x index a99330145..caa525278 100644 --- a/examples/boot/application/stm32l1/memory.x +++ b/examples/boot/application/stm32l1/memory.x | |||
| @@ -3,8 +3,8 @@ MEMORY | |||
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ |
| 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K | 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K |
| 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K |
| 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 32K | 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 46K |
| 7 | DFU : ORIGIN = 0x08010000, LENGTH = 36K | 7 | DFU : ORIGIN = 0x08013800, LENGTH = 54K |
| 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16K | 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16K |
| 9 | } | 9 | } |
| 10 | 10 | ||
diff --git a/examples/boot/application/stm32l1/src/bin/a.rs b/examples/boot/application/stm32l1/src/bin/a.rs index 02f74bdef..f066c1139 100644 --- a/examples/boot/application/stm32l1/src/bin/a.rs +++ b/examples/boot/application/stm32l1/src/bin/a.rs | |||
| @@ -8,7 +8,7 @@ use embassy_embedded_hal::adapter::BlockingAsync; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; | 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; |
| 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 11 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 12 | use embassy_sync::mutex::Mutex; | 12 | use embassy_sync::mutex::Mutex; |
| 13 | use embassy_time::Timer; | 13 | use embassy_time::Timer; |
| 14 | use panic_reset as _; | 14 | use panic_reset as _; |
| @@ -24,14 +24,13 @@ async fn main(_spawner: Spawner) { | |||
| 24 | let flash = Flash::new_blocking(p.FLASH); | 24 | let flash = Flash::new_blocking(p.FLASH); |
| 25 | let flash = Mutex::new(BlockingAsync::new(flash)); | 25 | let flash = Mutex::new(BlockingAsync::new(flash)); |
| 26 | 26 | ||
| 27 | let button = Input::new(p.PB2, Pull::Up); | 27 | let mut button = ExtiInput::new(p.PB2, p.EXTI2, Pull::Up); |
| 28 | let mut button = ExtiInput::new(button, p.EXTI2); | ||
| 29 | 28 | ||
| 30 | let mut led = Output::new(p.PB5, Level::Low, Speed::Low); | 29 | let mut led = Output::new(p.PB5, Level::Low, Speed::Low); |
| 31 | 30 | ||
| 32 | led.set_high(); | 31 | led.set_high(); |
| 33 | 32 | ||
| 34 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 35 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 36 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 37 | button.wait_for_falling_edge().await; | 36 | button.wait_for_falling_edge().await; |
diff --git a/examples/boot/application/stm32l4/memory.x b/examples/boot/application/stm32l4/memory.x index f51875766..e1d4e7fa8 100644 --- a/examples/boot/application/stm32l4/memory.x +++ b/examples/boot/application/stm32l4/memory.x | |||
| @@ -3,8 +3,8 @@ MEMORY | |||
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ |
| 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K | 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K |
| 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K |
| 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 32K | 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 64K |
| 7 | DFU : ORIGIN = 0x08010000, LENGTH = 36K | 7 | DFU : ORIGIN = 0x08018000, LENGTH = 68K |
| 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K | 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K |
| 9 | } | 9 | } |
| 10 | 10 | ||
diff --git a/examples/boot/application/stm32l4/src/bin/a.rs b/examples/boot/application/stm32l4/src/bin/a.rs index 892446968..a0079ee33 100644 --- a/examples/boot/application/stm32l4/src/bin/a.rs +++ b/examples/boot/application/stm32l4/src/bin/a.rs | |||
| @@ -8,7 +8,7 @@ use embassy_embedded_hal::adapter::BlockingAsync; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; | 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; |
| 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 11 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 12 | use embassy_sync::mutex::Mutex; | 12 | use embassy_sync::mutex::Mutex; |
| 13 | use panic_reset as _; | 13 | use panic_reset as _; |
| 14 | 14 | ||
| @@ -23,13 +23,12 @@ async fn main(_spawner: Spawner) { | |||
| 23 | let flash = Flash::new_blocking(p.FLASH); | 23 | let flash = Flash::new_blocking(p.FLASH); |
| 24 | let flash = Mutex::new(BlockingAsync::new(flash)); | 24 | let flash = Mutex::new(BlockingAsync::new(flash)); |
| 25 | 25 | ||
| 26 | let button = Input::new(p.PC13, Pull::Up); | 26 | let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Up); |
| 27 | let mut button = ExtiInput::new(button, p.EXTI13); | ||
| 28 | 27 | ||
| 29 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); | 28 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); |
| 30 | led.set_high(); | 29 | led.set_high(); |
| 31 | 30 | ||
| 32 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 33 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 34 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 35 | button.wait_for_falling_edge().await; | 34 | button.wait_for_falling_edge().await; |
diff --git a/examples/boot/application/stm32wb-dfu/README.md b/examples/boot/application/stm32wb-dfu/README.md index c8dce0387..7f656cde6 100644 --- a/examples/boot/application/stm32wb-dfu/README.md +++ b/examples/boot/application/stm32wb-dfu/README.md | |||
| @@ -1,29 +1,9 @@ | |||
| 1 | # Examples using bootloader | 1 | # Examples using bootloader |
| 2 | 2 | ||
| 3 | Example for STM32WL demonstrating the bootloader. The example consists of application binaries, 'a' | 3 | Example for STM32WB demonstrating the USB DFU application. |
| 4 | which allows you to press a button to start the DFU process, and 'b' which is the updated | ||
| 5 | application. | ||
| 6 | |||
| 7 | |||
| 8 | ## Prerequisites | ||
| 9 | |||
| 10 | * `cargo-binutils` | ||
| 11 | * `cargo-flash` | ||
| 12 | * `embassy-boot-stm32` | ||
| 13 | 4 | ||
| 14 | ## Usage | 5 | ## Usage |
| 15 | 6 | ||
| 16 | ``` | 7 | ``` |
| 17 | # Flash bootloader | 8 | cargo flash --release --chip STM32WB55RGVx |
| 18 | cargo flash --manifest-path ../../bootloader/stm32/Cargo.toml --release --features embassy-stm32/stm32wl55jc-cm4 --chip STM32WLE5JCIx | ||
| 19 | # Build 'b' | ||
| 20 | cargo build --release --bin b | ||
| 21 | # Generate binary for 'b' | ||
| 22 | cargo objcopy --release --bin b -- -O binary b.bin | ||
| 23 | ``` | ||
| 24 | |||
| 25 | # Flash `a` (which includes b.bin) | ||
| 26 | |||
| 27 | ``` | ||
| 28 | cargo flash --release --bin a --chip STM32WLE5JCIx | ||
| 29 | ``` | 9 | ``` |
diff --git a/examples/boot/application/stm32wb-dfu/src/main.rs b/examples/boot/application/stm32wb-dfu/src/main.rs index b2ccb9e1a..37c3d7d90 100644 --- a/examples/boot/application/stm32wb-dfu/src/main.rs +++ b/examples/boot/application/stm32wb-dfu/src/main.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | let flash = Flash::new_blocking(p.FLASH); | 30 | let flash = Flash::new_blocking(p.FLASH); |
| 31 | let flash = Mutex::new(RefCell::new(flash)); | 31 | let flash = Mutex::new(RefCell::new(flash)); |
| 32 | 32 | ||
| 33 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile_blocking(&flash, &flash); |
| 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 35 | let mut firmware_state = BlockingFirmwareState::from_config(config, &mut magic.0); | 35 | let mut firmware_state = BlockingFirmwareState::from_config(config, &mut magic.0); |
| 36 | firmware_state.mark_booted().expect("Failed to mark booted"); | 36 | firmware_state.mark_booted().expect("Failed to mark booted"); |
diff --git a/examples/boot/application/stm32wl/memory.x b/examples/boot/application/stm32wl/memory.x index f51875766..e1d4e7fa8 100644 --- a/examples/boot/application/stm32wl/memory.x +++ b/examples/boot/application/stm32wl/memory.x | |||
| @@ -3,8 +3,8 @@ MEMORY | |||
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ |
| 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K | 4 | BOOTLOADER : ORIGIN = 0x08000000, LENGTH = 24K |
| 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x08006000, LENGTH = 4K |
| 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 32K | 6 | FLASH : ORIGIN = 0x08008000, LENGTH = 64K |
| 7 | DFU : ORIGIN = 0x08010000, LENGTH = 36K | 7 | DFU : ORIGIN = 0x08018000, LENGTH = 68K |
| 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K | 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K |
| 9 | } | 9 | } |
| 10 | 10 | ||
diff --git a/examples/boot/application/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs index d9665e6ee..2fb16bdc4 100644 --- a/examples/boot/application/stm32wl/src/bin/a.rs +++ b/examples/boot/application/stm32wl/src/bin/a.rs | |||
| @@ -8,7 +8,7 @@ use embassy_embedded_hal::adapter::BlockingAsync; | |||
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::exti::ExtiInput; | 9 | use embassy_stm32::exti::ExtiInput; |
| 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; | 10 | use embassy_stm32::flash::{Flash, WRITE_SIZE}; |
| 11 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 11 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 12 | use embassy_sync::mutex::Mutex; | 12 | use embassy_sync::mutex::Mutex; |
| 13 | use panic_reset as _; | 13 | use panic_reset as _; |
| 14 | 14 | ||
| @@ -23,13 +23,12 @@ async fn main(_spawner: Spawner) { | |||
| 23 | let flash = Flash::new_blocking(p.FLASH); | 23 | let flash = Flash::new_blocking(p.FLASH); |
| 24 | let flash = Mutex::new(BlockingAsync::new(flash)); | 24 | let flash = Mutex::new(BlockingAsync::new(flash)); |
| 25 | 25 | ||
| 26 | let button = Input::new(p.PA0, Pull::Up); | 26 | let mut button = ExtiInput::new(p.PA0, p.EXTI0, Pull::Up); |
| 27 | let mut button = ExtiInput::new(button, p.EXTI0); | ||
| 28 | 27 | ||
| 29 | let mut led = Output::new(p.PB9, Level::Low, Speed::Low); | 28 | let mut led = Output::new(p.PB9, Level::Low, Speed::Low); |
| 30 | led.set_high(); | 29 | led.set_high(); |
| 31 | 30 | ||
| 32 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 33 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 34 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 35 | button.wait_for_falling_edge().await; | 34 | button.wait_for_falling_edge().await; |
