summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <lulf@redhat.com>2022-04-28 14:08:33 +0200
committerUlf Lilleengen <lulf@redhat.com>2022-04-28 14:11:01 +0200
commitb7e7211a204d40afaf98e0c1ed405a898f8fc689 (patch)
tree9ccced17282dcf960f38611e33965c504db4dc07
parentbd488ef0d55a82d58d54284d52d0c35b0925a38a (diff)
downloadembassy-b7e7211a204d40afaf98e0c1ed405a898f8fc689.zip
Fix linker script for nrf bootloader example
-rw-r--r--embassy-boot/nrf/memory-bm.x2
-rw-r--r--embassy-boot/nrf/memory.x2
-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
6 files changed, 26 insertions, 3 deletions
diff --git a/embassy-boot/nrf/memory-bm.x b/embassy-boot/nrf/memory-bm.x
index 257d6564..8a32b905 100644
--- a/embassy-boot/nrf/memory-bm.x
+++ b/embassy-boot/nrf/memory-bm.x
@@ -5,7 +5,7 @@ MEMORY
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K
DFU : ORIGIN = 0x00017000, LENGTH = 68K
- RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+ RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K
}
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
diff --git a/embassy-boot/nrf/memory.x b/embassy-boot/nrf/memory.x
index 257d6564..8a32b905 100644
--- a/embassy-boot/nrf/memory.x
+++ b/embassy-boot/nrf/memory.x
@@ -5,7 +5,7 @@ MEMORY
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K
DFU : ORIGIN = 0x00017000, LENGTH = 68K
- RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+ RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K
}
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
diff --git a/examples/boot/nrf/README.md b/examples/boot/nrf/README.md
index 453df7f3..1f25ffc0 100644
--- a/examples/boot/nrf/README.md
+++ b/examples/boot/nrf/README.md
@@ -16,6 +16,9 @@ application.
```
+# Use bare metal linker script
+cp memory-bl.x ../../../embassy-boot/nrf/memory.x
+
# Flash bootloader
cargo flash --manifest-path ../../../embassy-boot/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA
# Build 'b'
diff --git a/examples/boot/nrf/memory-bl.x b/examples/boot/nrf/memory-bl.x
new file mode 100644
index 00000000..8a32b905
--- /dev/null
+++ b/examples/boot/nrf/memory-bl.x
@@ -0,0 +1,18 @@
+MEMORY
+{
+ /* NOTE 1 K = 1 KiBi = 1024 bytes */
+ FLASH : ORIGIN = 0x00000000, LENGTH = 24K
+ BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
+ ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K
+ DFU : ORIGIN = 0x00017000, LENGTH = 68K
+ RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K
+}
+
+__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
+__bootloader_state_end = ORIGIN(BOOTLOADER_STATE) + LENGTH(BOOTLOADER_STATE);
+
+__bootloader_active_start = ORIGIN(ACTIVE);
+__bootloader_active_end = ORIGIN(ACTIVE) + LENGTH(ACTIVE);
+
+__bootloader_dfu_start = ORIGIN(DFU);
+__bootloader_dfu_end = ORIGIN(DFU) + LENGTH(DFU);
diff --git a/examples/boot/nrf/memory.x b/examples/boot/nrf/memory.x
index dfb72103..3a54ca46 100644
--- a/examples/boot/nrf/memory.x
+++ b/examples/boot/nrf/memory.x
@@ -1,10 +1,11 @@
MEMORY
{
/* NOTE 1 K = 1 KiBi = 1024 bytes */
+ BOOTLOADER : ORIGIN = 0x00000000, LENGTH = 24K
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
FLASH : ORIGIN = 0x00007000, LENGTH = 64K
DFU : ORIGIN = 0x00017000, LENGTH = 68K
- RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
+ RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K
}
__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 2f05c817..7368e36c 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) {
let mut updater = FirmwareUpdater::default();
loop {
+ led.set_low();
button.wait_for_any_edge().await;
if button.is_low() {
let mut offset = 0;