diff options
| author | Badr Bouslikhin <[email protected]> | 2024-02-07 12:50:48 +0100 |
|---|---|---|
| committer | Badr Bouslikhin <[email protected]> | 2024-02-07 12:50:48 +0100 |
| commit | cfc3e966331310b7210c94339cf8f111a65d9e53 (patch) | |
| tree | 4e4a0da75f13c09854f4b53f54ab7486ae840fc6 /examples/boot/application | |
| parent | 4a72f946e42dde3dbfbf46a676d5b40617e4c92f (diff) | |
fix(boot): update examples
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/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 | 2 | ||||
| -rw-r--r-- | examples/boot/application/stm32f7/src/bin/a.rs | 2 | ||||
| -rw-r--r-- | examples/boot/application/stm32h7/src/bin/a.rs | 2 | ||||
| -rw-r--r-- | examples/boot/application/stm32l0/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32l0/src/bin/a.rs | 2 | ||||
| -rw-r--r-- | examples/boot/application/stm32l1/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32l1/src/bin/a.rs | 2 | ||||
| -rw-r--r-- | examples/boot/application/stm32l4/memory.x | 4 | ||||
| -rw-r--r-- | examples/boot/application/stm32l4/src/bin/a.rs | 2 | ||||
| -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 | 2 |
16 files changed, 22 insertions, 42 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/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 3f9ebe5c8..8858ae3da 100644 --- a/examples/boot/application/stm32f3/src/bin/a.rs +++ b/examples/boot/application/stm32f3/src/bin/a.rs | |||
| @@ -28,7 +28,7 @@ async fn main(_spawner: Spawner) { | |||
| 28 | let mut led = Output::new(p.PA5, Level::Low, Speed::Low); | 28 | let mut led = Output::new(p.PA5, Level::Low, Speed::Low); |
| 29 | led.set_high(); | 29 | led.set_high(); |
| 30 | 30 | ||
| 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 34 | 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 c57c29263..d3df11fe4 100644 --- a/examples/boot/application/stm32f7/src/bin/a.rs +++ b/examples/boot/application/stm32f7/src/bin/a.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | let mut led = Output::new(p.PB7, Level::Low, Speed::Low); | 30 | let mut led = Output::new(p.PB7, Level::Low, Speed::Low); |
| 31 | led.set_high(); | 31 | led.set_high(); |
| 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 updater = BlockingFirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = BlockingFirmwareUpdater::new(config, &mut magic.0); |
| 36 | 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 a00d17408..f61ac1f71 100644 --- a/examples/boot/application/stm32h7/src/bin/a.rs +++ b/examples/boot/application/stm32h7/src/bin/a.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); | 30 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); |
| 31 | led.set_high(); | 31 | led.set_high(); |
| 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 updater = BlockingFirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = BlockingFirmwareUpdater::new(config, &mut magic.0); |
| 36 | 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 dbec49d44..f066c1139 100644 --- a/examples/boot/application/stm32l0/src/bin/a.rs +++ b/examples/boot/application/stm32l0/src/bin/a.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | 30 | ||
| 31 | led.set_high(); | 31 | led.set_high(); |
| 32 | 32 | ||
| 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 35 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 36 | 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 dbec49d44..f066c1139 100644 --- a/examples/boot/application/stm32l1/src/bin/a.rs +++ b/examples/boot/application/stm32l1/src/bin/a.rs | |||
| @@ -30,7 +30,7 @@ async fn main(_spawner: Spawner) { | |||
| 30 | 30 | ||
| 31 | led.set_high(); | 31 | led.set_high(); |
| 32 | 32 | ||
| 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 35 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 35 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 36 | 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 e946c3cdf..a0079ee33 100644 --- a/examples/boot/application/stm32l4/src/bin/a.rs +++ b/examples/boot/application/stm32l4/src/bin/a.rs | |||
| @@ -28,7 +28,7 @@ async fn main(_spawner: Spawner) { | |||
| 28 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); | 28 | let mut led = Output::new(p.PB14, Level::Low, Speed::Low); |
| 29 | led.set_high(); | 29 | led.set_high(); |
| 30 | 30 | ||
| 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 34 | 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 b582d8b25..2fb16bdc4 100644 --- a/examples/boot/application/stm32wl/src/bin/a.rs +++ b/examples/boot/application/stm32wl/src/bin/a.rs | |||
| @@ -28,7 +28,7 @@ async fn main(_spawner: Spawner) { | |||
| 28 | let mut led = Output::new(p.PB9, Level::Low, Speed::Low); | 28 | let mut led = Output::new(p.PB9, Level::Low, Speed::Low); |
| 29 | led.set_high(); | 29 | led.set_high(); |
| 30 | 30 | ||
| 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 31 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash, &flash); |
| 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | 32 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | 33 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); |
| 34 | button.wait_for_falling_edge().await; | 34 | button.wait_for_falling_edge().await; |
