mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 14:53:03 +00:00
Align examples with bootloader changes
This commit is contained in:
parent
a77ce1088d
commit
84bfe9b8c9
@ -16,7 +16,7 @@ pub struct BootLoader<const BUFFER_SIZE: usize = PAGE_SIZE> {
|
|||||||
aligned_buf: AlignedBuffer<BUFFER_SIZE>,
|
aligned_buf: AlignedBuffer<BUFFER_SIZE>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> {
|
impl Default for BootLoader<PAGE_SIZE> {
|
||||||
/// Create a new bootloader instance using parameters from linker script
|
/// Create a new bootloader instance using parameters from linker script
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -52,7 +52,7 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> {
|
impl Default for BootLoader<ERASE_SIZE> {
|
||||||
/// Create a new bootloader instance using parameters from linker script
|
/// Create a new bootloader instance using parameters from linker script
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -27,9 +27,11 @@ fn main() -> ! {
|
|||||||
wdt_config.run_during_sleep = true;
|
wdt_config.run_during_sleep = true;
|
||||||
wdt_config.run_during_debug_halt = false;
|
wdt_config.run_during_debug_halt = false;
|
||||||
|
|
||||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::<_, 4096>::new(
|
let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::new(WatchdogFlash::start(
|
||||||
WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config),
|
Nvmc::new(p.NVMC),
|
||||||
)));
|
p.WDT,
|
||||||
|
wdt_config,
|
||||||
|
))));
|
||||||
unsafe { bl.load(start) }
|
unsafe { bl.load(start) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ use cortex_m_rt::{entry, exception};
|
|||||||
#[cfg(feature = "defmt")]
|
#[cfg(feature = "defmt")]
|
||||||
use defmt_rtt as _;
|
use defmt_rtt as _;
|
||||||
use embassy_boot_rp::*;
|
use embassy_boot_rp::*;
|
||||||
use embassy_rp::flash::ERASE_SIZE;
|
|
||||||
use embassy_time::Duration;
|
use embassy_time::Duration;
|
||||||
|
|
||||||
const FLASH_SIZE: usize = 2 * 1024 * 1024;
|
const FLASH_SIZE: usize = 2 * 1024 * 1024;
|
||||||
@ -24,7 +23,7 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let mut bl: BootLoader = BootLoader::default();
|
let mut bl: BootLoader = BootLoader::default();
|
||||||
let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8));
|
let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8));
|
||||||
let mut flash = BootFlash::<_, ERASE_SIZE>::new(flash);
|
let mut flash = BootFlash::new(flash);
|
||||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
||||||
core::mem::drop(flash);
|
core::mem::drop(flash);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use cortex_m_rt::{entry, exception};
|
|||||||
#[cfg(feature = "defmt")]
|
#[cfg(feature = "defmt")]
|
||||||
use defmt_rtt as _;
|
use defmt_rtt as _;
|
||||||
use embassy_boot_stm32::*;
|
use embassy_boot_stm32::*;
|
||||||
use embassy_stm32::flash::{Flash, ERASE_SIZE, ERASE_VALUE, WRITE_SIZE};
|
use embassy_stm32::flash::{Flash, ERASE_SIZE};
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
@ -19,9 +19,9 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default();
|
let mut bl: BootLoader<ERASE_SIZE> = BootLoader::default();
|
||||||
let flash = Flash::new(p.FLASH);
|
let flash = Flash::new(p.FLASH);
|
||||||
let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash);
|
let mut flash = BootFlash::new(flash);
|
||||||
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
|
||||||
core::mem::drop(flash);
|
core::mem::drop(flash);
|
||||||
unsafe { bl.load(start) }
|
unsafe { bl.load(start) }
|
||||||
|
Loading…
Reference in New Issue
Block a user