aboutsummaryrefslogtreecommitdiff
path: root/examples/boot
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2022-04-28 14:08:33 +0200
committerUlf Lilleengen <[email protected]>2022-04-28 14:11:01 +0200
commitb7e7211a204d40afaf98e0c1ed405a898f8fc689 (patch)
tree9ccced17282dcf960f38611e33965c504db4dc07 /examples/boot
parentbd488ef0d55a82d58d54284d52d0c35b0925a38a (diff)
Fix linker script for nrf bootloader example
Diffstat (limited to 'examples/boot')
-rw-r--r--examples/boot/nrf/README.md3
-rw-r--r--examples/boot/nrf/memory-bl.x18
-rw-r--r--examples/boot/nrf/memory.x3
-rw-r--r--examples/boot/nrf/src/bin/a.rs1
4 files changed, 24 insertions, 1 deletions
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
20cp memory-bl.x ../../../embassy-boot/nrf/memory.x
21
19# Flash bootloader 22# Flash bootloader
20cargo flash --manifest-path ../../../embassy-boot/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA 23cargo 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 @@
1MEMORY
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 @@
1MEMORY 1MEMORY
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;