diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-04-28 12:38:03 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-28 12:38:03 +0000 |
| commit | 0ed4d294de1a159d0717072da2605fadbbb59e7c (patch) | |
| tree | 9ccced17282dcf960f38611e33965c504db4dc07 | |
| parent | bd488ef0d55a82d58d54284d52d0c35b0925a38a (diff) | |
| parent | b7e7211a204d40afaf98e0c1ed405a898f8fc689 (diff) | |
Merge #741
741: Fix linker script for nrf bootloader example r=lulf a=lulf
Co-authored-by: Ulf Lilleengen <[email protected]>
| -rw-r--r-- | embassy-boot/nrf/memory-bm.x | 2 | ||||
| -rw-r--r-- | embassy-boot/nrf/memory.x | 2 | ||||
| -rw-r--r-- | examples/boot/nrf/README.md | 3 | ||||
| -rw-r--r-- | examples/boot/nrf/memory-bl.x | 18 | ||||
| -rw-r--r-- | examples/boot/nrf/memory.x | 3 | ||||
| -rw-r--r-- | examples/boot/nrf/src/bin/a.rs | 1 |
6 files changed, 26 insertions, 3 deletions
diff --git a/embassy-boot/nrf/memory-bm.x b/embassy-boot/nrf/memory-bm.x index 257d65644..8a32b905f 100644 --- a/embassy-boot/nrf/memory-bm.x +++ b/embassy-boot/nrf/memory-bm.x | |||
| @@ -5,7 +5,7 @@ MEMORY | |||
| 5 | BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K |
| 6 | ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K | 6 | ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K |
| 7 | DFU : ORIGIN = 0x00017000, LENGTH = 68K | 7 | DFU : ORIGIN = 0x00017000, LENGTH = 68K |
| 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K | 8 | RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE); | 11 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE); |
diff --git a/embassy-boot/nrf/memory.x b/embassy-boot/nrf/memory.x index 257d65644..8a32b905f 100644 --- a/embassy-boot/nrf/memory.x +++ b/embassy-boot/nrf/memory.x | |||
| @@ -5,7 +5,7 @@ MEMORY | |||
| 5 | BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K |
| 6 | ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K | 6 | ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K |
| 7 | DFU : ORIGIN = 0x00017000, LENGTH = 68K | 7 | DFU : ORIGIN = 0x00017000, LENGTH = 68K |
| 8 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K | 8 | RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE); | 11 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE); |
diff --git a/examples/boot/nrf/README.md b/examples/boot/nrf/README.md index 453df7f31..1f25ffc05 100644 --- a/examples/boot/nrf/README.md +++ b/examples/boot/nrf/README.md | |||
| @@ -16,6 +16,9 @@ application. | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | ``` | 18 | ``` |
| 19 | # Use bare metal linker script | ||
| 20 | cp memory-bl.x ../../../embassy-boot/nrf/memory.x | ||
| 21 | |||
| 19 | # Flash bootloader | 22 | # Flash bootloader |
| 20 | cargo flash --manifest-path ../../../embassy-boot/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA | 23 | cargo flash --manifest-path ../../../embassy-boot/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA |
| 21 | # Build 'b' | 24 | # Build 'b' |
diff --git a/examples/boot/nrf/memory-bl.x b/examples/boot/nrf/memory-bl.x new file mode 100644 index 000000000..8a32b905f --- /dev/null +++ b/examples/boot/nrf/memory-bl.x | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | MEMORY | ||
| 2 | { | ||
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | ||
| 4 | FLASH : ORIGIN = 0x00000000, LENGTH = 24K | ||
| 5 | BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K | ||
| 6 | ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K | ||
| 7 | DFU : ORIGIN = 0x00017000, LENGTH = 68K | ||
| 8 | RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K | ||
| 9 | } | ||
| 10 | |||
| 11 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE); | ||
| 12 | __bootloader_state_end = ORIGIN(BOOTLOADER_STATE) + LENGTH(BOOTLOADER_STATE); | ||
| 13 | |||
| 14 | __bootloader_active_start = ORIGIN(ACTIVE); | ||
| 15 | __bootloader_active_end = ORIGIN(ACTIVE) + LENGTH(ACTIVE); | ||
| 16 | |||
| 17 | __bootloader_dfu_start = ORIGIN(DFU); | ||
| 18 | __bootloader_dfu_end = ORIGIN(DFU) + LENGTH(DFU); | ||
diff --git a/examples/boot/nrf/memory.x b/examples/boot/nrf/memory.x index dfb72103f..3a54ca460 100644 --- a/examples/boot/nrf/memory.x +++ b/examples/boot/nrf/memory.x | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | MEMORY | 1 | MEMORY |
| 2 | { | 2 | { |
| 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ | 3 | /* NOTE 1 K = 1 KiBi = 1024 bytes */ |
| 4 | BOOTLOADER : ORIGIN = 0x00000000, LENGTH = 24K | ||
| 4 | BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K | 5 | BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K |
| 5 | FLASH : ORIGIN = 0x00007000, LENGTH = 64K | 6 | FLASH : ORIGIN = 0x00007000, LENGTH = 64K |
| 6 | DFU : ORIGIN = 0x00017000, LENGTH = 68K | 7 | DFU : ORIGIN = 0x00017000, LENGTH = 68K |
| 7 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K | 8 | RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K |
| 8 | } | 9 | } |
| 9 | 10 | ||
| 10 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE); | 11 | __bootloader_state_start = ORIGIN(BOOTLOADER_STATE); |
diff --git a/examples/boot/nrf/src/bin/a.rs b/examples/boot/nrf/src/bin/a.rs index 2f05c817b..7368e36ce 100644 --- a/examples/boot/nrf/src/bin/a.rs +++ b/examples/boot/nrf/src/bin/a.rs | |||
| @@ -28,6 +28,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 28 | 28 | ||
| 29 | let mut updater = FirmwareUpdater::default(); | 29 | let mut updater = FirmwareUpdater::default(); |
| 30 | loop { | 30 | loop { |
| 31 | led.set_low(); | ||
| 31 | button.wait_for_any_edge().await; | 32 | button.wait_for_any_edge().await; |
| 32 | if button.is_low() { | 33 | if button.is_low() { |
| 33 | let mut offset = 0; | 34 | let mut offset = 0; |
