feat: compile bootloader examples for nRF91
* Add nRF91 as target in CI builds * Add example linker scripts for nrf91 * Make less nRF52 assumptions example config * Add llvm-tools-preview required for cargo objcopy example
This commit is contained in:
@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
|
||||
embassy-sync = { version = "0.1.0", path = "../../../../embassy-sync" }
|
||||
embassy-executor = { version = "0.1.0", path = "../../../../embassy-executor", features = ["nightly", "integrated-timers"] }
|
||||
embassy-time = { version = "0.1.0", path = "../../../../embassy-time", features = ["nightly"] }
|
||||
embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly", "nrf52840"] }
|
||||
embassy-nrf = { version = "0.1.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly"] }
|
||||
embassy-boot-nrf = { version = "0.1.0", path = "../../../../embassy-boot/nrf" }
|
||||
embassy-embedded-hal = { version = "0.1.0", path = "../../../../embassy-embedded-hal" }
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Examples using bootloader
|
||||
|
||||
Example for nRF52 demonstrating the bootloader. The example consists of application binaries, 'a'
|
||||
Example for nRF demonstrating the bootloader. The example consists of application binaries, 'a'
|
||||
which allows you to press a button to start the DFU process, and 'b' which is the updated
|
||||
application.
|
||||
|
||||
@ -20,19 +20,19 @@ application.
|
||||
cp memory-bl.x ../../bootloader/nrf/memory.x
|
||||
|
||||
# Flash bootloader
|
||||
cargo flash --manifest-path ../../bootloader/nrf/Cargo.toml --features embassy-nrf/nrf52840 --release --chip nRF52840_xxAA
|
||||
cargo flash --manifest-path ../../bootloader/nrf/Cargo.toml --features embassy-nrf/nrf52840 --target thumbv7em-none-eabi --release --chip nRF52840_xxAA
|
||||
# Build 'b'
|
||||
cargo build --release --bin b
|
||||
# Generate binary for 'b'
|
||||
cargo objcopy --release --bin b -- -O binary b.bin
|
||||
cargo objcopy --release --bin b --features embassy-nrf/nrf52840 --target thumbv7em-none-eabi -- -O binary b.bin
|
||||
```
|
||||
|
||||
# Flash `a` (which includes b.bin)
|
||||
|
||||
```
|
||||
cargo flash --release --bin a --chip nRF52840_xxAA
|
||||
cargo flash --release --bin a --features embassy-nrf/nrf52840 --target thumbv7em-none-eabi --chip nRF52840_xxAA
|
||||
```
|
||||
|
||||
You should then see a solid LED. Pressing button 1 will cause the DFU to be loaded by the bootloader. Upon
|
||||
successfully loading, you'll see the LED flash. After 5 seconds, because there is no petting of the watchdog,
|
||||
you'll see the LED go solid again. This indicates that the bootloader has reverted the update.
|
||||
you'll see the LED go solid again. This indicates that the bootloader has reverted the update.
|
||||
|
19
examples/boot/application/nrf/memory-bl-nrf91.x
Normal file
19
examples/boot/application/nrf/memory-bl-nrf91.x
Normal file
@ -0,0 +1,19 @@
|
||||
MEMORY
|
||||
{
|
||||
/* NOTE 1 K = 1 KiBi = 1024 bytes */
|
||||
/* Assumes Secure Partition Manager (SPM) flashed at the start */
|
||||
FLASH : ORIGIN = 0x00050000, LENGTH = 24K
|
||||
BOOTLOADER_STATE : ORIGIN = 0x00056000, LENGTH = 4K
|
||||
ACTIVE : ORIGIN = 0x00057000, LENGTH = 64K
|
||||
DFU : ORIGIN = 0x00067000, LENGTH = 68K
|
||||
RAM (rwx) : ORIGIN = 0x20018000, 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);
|
16
examples/boot/application/nrf/memory-nrf91.x
Normal file
16
examples/boot/application/nrf/memory-nrf91.x
Normal file
@ -0,0 +1,16 @@
|
||||
MEMORY
|
||||
{
|
||||
/* NOTE 1 K = 1 KiBi = 1024 bytes */
|
||||
/* Assumes Secure Partition Manager (SPM) flashed at the start */
|
||||
BOOTLOADER : ORIGIN = 0x00050000, LENGTH = 24K
|
||||
BOOTLOADER_STATE : ORIGIN = 0x00056000, LENGTH = 4K
|
||||
FLASH : ORIGIN = 0x00057000, LENGTH = 64K
|
||||
DFU : ORIGIN = 0x00067000, LENGTH = 68K
|
||||
RAM (rwx) : ORIGIN = 0x20018000, LENGTH = 32K
|
||||
}
|
||||
|
||||
__bootloader_state_start = ORIGIN(BOOTLOADER_STATE);
|
||||
__bootloader_state_end = ORIGIN(BOOTLOADER_STATE) + LENGTH(BOOTLOADER_STATE);
|
||||
|
||||
__bootloader_dfu_start = ORIGIN(DFU);
|
||||
__bootloader_dfu_end = ORIGIN(DFU) + LENGTH(DFU);
|
@ -16,11 +16,17 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
let p = embassy_nrf::init(Default::default());
|
||||
|
||||
let mut button = Input::new(p.P0_11, Pull::Up);
|
||||
let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);
|
||||
|
||||
//let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard);
|
||||
//let mut button = Input::new(p.P1_02, Pull::Up);
|
||||
|
||||
// nRF91 DK
|
||||
// let mut led = Output::new(p.P0_02, Level::Low, OutputDrive::Standard);
|
||||
// let mut button = Input::new(p.P0_06, Pull::Up);
|
||||
|
||||
// The following code block illustrates how to obtain a watchdog that is configured
|
||||
// as per the existing watchdog. Ordinarily, we'd use the handle returned to "pet" the
|
||||
// watchdog periodically. If we don't, and we're not going to for this example, then
|
||||
|
@ -12,7 +12,10 @@ use panic_reset as _;
|
||||
async fn main(_spawner: Spawner) {
|
||||
let p = embassy_nrf::init(Default::default());
|
||||
let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard);
|
||||
//let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard);
|
||||
// let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard);
|
||||
|
||||
// nRF91 DK
|
||||
// let mut led = Output::new(p.P0_02, Level::Low, OutputDrive::Standard);
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
|
Reference in New Issue
Block a user