Fix linker script for nrf bootloader example
This commit is contained in:
parent
bd488ef0d5
commit
b7e7211a20
6 changed files with 26 additions and 3 deletions
|
@ -5,7 +5,7 @@ MEMORY
|
||||||
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
|
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
|
||||||
ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K
|
ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K
|
||||||
DFU : ORIGIN = 0x00017000, LENGTH = 68K
|
DFU : ORIGIN = 0x00017000, LENGTH = 68K
|
||||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
|
RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K
|
||||||
}
|
}
|
||||||
|
|
||||||
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
|
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
|
||||||
|
|
|
@ -5,7 +5,7 @@ MEMORY
|
||||||
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
|
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
|
||||||
ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K
|
ACTIVE : ORIGIN = 0x00007000, LENGTH = 64K
|
||||||
DFU : ORIGIN = 0x00017000, LENGTH = 68K
|
DFU : ORIGIN = 0x00017000, LENGTH = 68K
|
||||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
|
RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K
|
||||||
}
|
}
|
||||||
|
|
||||||
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
|
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
|
||||||
|
|
|
@ -16,6 +16,9 @@ application.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# Use bare metal linker script
|
||||||
|
cp memory-bl.x ../../../embassy-boot/nrf/memory.x
|
||||||
|
|
||||||
# Flash bootloader
|
# Flash bootloader
|
||||||
cargo flash --manifest-path ../../../embassy-boot/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA
|
cargo flash --manifest-path ../../../embassy-boot/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA
|
||||||
# Build 'b'
|
# Build 'b'
|
||||||
|
|
18
examples/boot/nrf/memory-bl.x
Normal file
18
examples/boot/nrf/memory-bl.x
Normal file
|
@ -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);
|
|
@ -1,10 +1,11 @@
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
/* NOTE 1 K = 1 KiBi = 1024 bytes */
|
/* NOTE 1 K = 1 KiBi = 1024 bytes */
|
||||||
|
BOOTLOADER : ORIGIN = 0x00000000, LENGTH = 24K
|
||||||
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
|
BOOTLOADER_STATE : ORIGIN = 0x00006000, LENGTH = 4K
|
||||||
FLASH : ORIGIN = 0x00007000, LENGTH = 64K
|
FLASH : ORIGIN = 0x00007000, LENGTH = 64K
|
||||||
DFU : ORIGIN = 0x00017000, LENGTH = 68K
|
DFU : ORIGIN = 0x00017000, LENGTH = 68K
|
||||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
|
RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 32K
|
||||||
}
|
}
|
||||||
|
|
||||||
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
|
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
|
||||||
|
|
|
@ -28,6 +28,7 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) {
|
||||||
|
|
||||||
let mut updater = FirmwareUpdater::default();
|
let mut updater = FirmwareUpdater::default();
|
||||||
loop {
|
loop {
|
||||||
|
led.set_low();
|
||||||
button.wait_for_any_edge().await;
|
button.wait_for_any_edge().await;
|
||||||
if button.is_low() {
|
if button.is_low() {
|
||||||
let mut offset = 0;
|
let mut offset = 0;
|
||||||
|
|
Loading…
Reference in a new issue