Align examples
This commit is contained in:
@ -12,6 +12,7 @@ defmt-rtt = { version = "0.4", optional = true }
|
||||
embassy-nrf = { path = "../../../../embassy-nrf", features = ["nightly"] }
|
||||
embassy-boot-nrf = { path = "../../../../embassy-boot/nrf" }
|
||||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
embassy-sync = { path = "../../../../embassy-sync" }
|
||||
cortex-m-rt = { version = "0.7" }
|
||||
cfg-if = "1.0.0"
|
||||
|
||||
|
@ -1,12 +1,15 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::cell::RefCell;
|
||||
|
||||
use cortex_m_rt::{entry, exception};
|
||||
#[cfg(feature = "defmt")]
|
||||
use defmt_rtt as _;
|
||||
use embassy_boot_nrf::*;
|
||||
use embassy_nrf::nvmc::Nvmc;
|
||||
use embassy_nrf::wdt;
|
||||
use embassy_sync::blocking_mutex::Mutex;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
@ -20,19 +23,21 @@ fn main() -> ! {
|
||||
}
|
||||
*/
|
||||
|
||||
let mut bl = BootLoader::default();
|
||||
|
||||
let mut wdt_config = wdt::Config::default();
|
||||
wdt_config.timeout_ticks = 32768 * 5; // timeout seconds
|
||||
wdt_config.run_during_sleep = true;
|
||||
wdt_config.run_during_debug_halt = false;
|
||||
|
||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::new(WatchdogFlash::start(
|
||||
Nvmc::new(p.NVMC),
|
||||
p.WDT,
|
||||
wdt_config,
|
||||
))));
|
||||
unsafe { bl.load(start) }
|
||||
let flash = WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config);
|
||||
let flash = Mutex::new(RefCell::new(flash));
|
||||
|
||||
let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
|
||||
let active_offset = config.active.offset();
|
||||
let mut bl: BootLoader<_, _, _> = BootLoader::new(config);
|
||||
|
||||
bl.prepare();
|
||||
|
||||
unsafe { bl.load(active_offset) }
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -11,6 +11,7 @@ defmt-rtt = { version = "0.4", optional = true }
|
||||
|
||||
embassy-rp = { path = "../../../../embassy-rp", features = ["nightly"] }
|
||||
embassy-boot-rp = { path = "../../../../embassy-boot/rp" }
|
||||
embassy-sync = { path = "../../../../embassy-sync" }
|
||||
embassy-time = { path = "../../../../embassy-time", features = ["nightly"] }
|
||||
|
||||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
|
@ -1,10 +1,13 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::cell::RefCell;
|
||||
|
||||
use cortex_m_rt::{entry, exception};
|
||||
#[cfg(feature = "defmt")]
|
||||
use defmt_rtt as _;
|
||||
use embassy_boot_rp::*;
|
||||
use embassy_sync::blocking_mutex::Mutex;
|
||||
use embassy_time::Duration;
|
||||
|
||||
const FLASH_SIZE: usize = 2 * 1024 * 1024;
|
||||
@ -21,13 +24,16 @@ fn main() -> ! {
|
||||
}
|
||||
*/
|
||||
|
||||
let mut bl: BootLoader = BootLoader::default();
|
||||
let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8));
|
||||
let mut flash = BootFlash::new(flash);
|
||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
||||
core::mem::drop(flash);
|
||||
let flash = Mutex::new(RefCell::new(flash));
|
||||
|
||||
unsafe { bl.load(start) }
|
||||
let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
|
||||
let active_offset = config.active.offset();
|
||||
let mut bl: BootLoader<_, _, _> = BootLoader::new(config);
|
||||
|
||||
bl.prepare();
|
||||
|
||||
unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) }
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -12,6 +12,7 @@ defmt-rtt = { version = "0.4", optional = true }
|
||||
embassy-stm32 = { path = "../../../../embassy-stm32", features = ["nightly"] }
|
||||
embassy-boot-stm32 = { path = "../../../../embassy-boot/stm32" }
|
||||
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
|
||||
embassy-sync = { path = "../../../../embassy-sync" }
|
||||
cortex-m-rt = { version = "0.7" }
|
||||
embedded-storage = "0.3.0"
|
||||
embedded-storage-async = "0.4.0"
|
||||
|
@ -1,11 +1,14 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::cell::RefCell;
|
||||
|
||||
use cortex_m_rt::{entry, exception};
|
||||
#[cfg(feature = "defmt")]
|
||||
use defmt_rtt as _;
|
||||
use embassy_boot_stm32::*;
|
||||
use embassy_stm32::flash::Flash;
|
||||
use embassy_stm32::flash::{Flash, BANK1_REGION};
|
||||
use embassy_sync::blocking_mutex::Mutex;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
@ -19,12 +22,16 @@ fn main() -> ! {
|
||||
}
|
||||
*/
|
||||
|
||||
let mut bl: BootLoader<2048> = BootLoader::default();
|
||||
let layout = Flash::new_blocking(p.FLASH).into_blocking_regions();
|
||||
let mut flash = BootFlash::new(layout.bank1_region);
|
||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
||||
core::mem::drop(flash);
|
||||
unsafe { bl.load(start) }
|
||||
let flash = Mutex::new(RefCell::new(layout.bank1_region));
|
||||
|
||||
let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
|
||||
let active_offset = config.active.offset();
|
||||
let mut bl: BootLoader<_, _, _, 2048> = BootLoader::new(config);
|
||||
|
||||
bl.prepare();
|
||||
|
||||
unsafe { bl.load(BANK1_REGION.base + active_offset) }
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
Reference in New Issue
Block a user