Align with new bind_interrupt
This commit is contained in:
parent
15636f05f5
commit
7371eefa86
25 changed files with 71 additions and 40 deletions
|
@ -12,15 +12,18 @@ pub(super) static REGION_ACCESS: Mutex<CriticalSectionRawMutex, ()> = Mutex::new
|
||||||
|
|
||||||
impl<'d> Flash<'d> {
|
impl<'d> Flash<'d> {
|
||||||
pub fn into_regions(self) -> FlashLayout<'d, Async> {
|
pub fn into_regions(self) -> FlashLayout<'d, Async> {
|
||||||
|
assert!(!self.blocking_only);
|
||||||
family::set_default_layout();
|
family::set_default_layout();
|
||||||
FlashLayout::new(self.inner)
|
FlashLayout::new(self.inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error> {
|
pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error> {
|
||||||
|
assert!(!self.blocking_only);
|
||||||
unsafe { write_chunked(FLASH_BASE as u32, FLASH_SIZE as u32, offset, bytes).await }
|
unsafe { write_chunked(FLASH_BASE as u32, FLASH_SIZE as u32, offset, bytes).await }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn erase(&mut self, from: u32, to: u32) -> Result<(), Error> {
|
pub async fn erase(&mut self, from: u32, to: u32) -> Result<(), Error> {
|
||||||
|
assert!(!self.blocking_only);
|
||||||
unsafe { erase_sectored(FLASH_BASE as u32, from, to).await }
|
unsafe { erase_sectored(FLASH_BASE as u32, from, to).await }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use atomic_polyfill::{fence, Ordering};
|
use atomic_polyfill::{fence, Ordering};
|
||||||
use embassy_cortex_m::interrupt::InterruptExt;
|
use embassy_cortex_m::interrupt::{Interrupt, InterruptExt};
|
||||||
use embassy_hal_common::drop::OnDrop;
|
use embassy_hal_common::drop::OnDrop;
|
||||||
use embassy_hal_common::{into_ref, PeripheralRef};
|
use embassy_hal_common::{into_ref, PeripheralRef};
|
||||||
use stm32_metapac::FLASH_BASE;
|
use stm32_metapac::FLASH_BASE;
|
||||||
|
@ -9,21 +9,37 @@ use super::{
|
||||||
WRITE_SIZE,
|
WRITE_SIZE,
|
||||||
};
|
};
|
||||||
use crate::peripherals::FLASH;
|
use crate::peripherals::FLASH;
|
||||||
use crate::Peripheral;
|
use crate::{interrupt, Peripheral};
|
||||||
|
|
||||||
pub struct Flash<'d> {
|
pub struct Flash<'d> {
|
||||||
pub(crate) inner: PeripheralRef<'d, FLASH>,
|
pub(crate) inner: PeripheralRef<'d, FLASH>,
|
||||||
|
pub(crate) blocking_only: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d> Flash<'d> {
|
impl<'d> Flash<'d> {
|
||||||
pub fn new(p: impl Peripheral<P = FLASH> + 'd, irq: impl Peripheral<P = crate::interrupt::FLASH> + 'd) -> Self {
|
pub fn new(
|
||||||
into_ref!(p, irq);
|
p: impl Peripheral<P = FLASH> + 'd,
|
||||||
|
_irq: impl interrupt::Binding<crate::interrupt::FLASH, InterruptHandler> + 'd,
|
||||||
|
) -> Self {
|
||||||
|
into_ref!(p);
|
||||||
|
|
||||||
irq.set_handler(family::on_interrupt);
|
let flash_irq = unsafe { crate::interrupt::FLASH::steal() };
|
||||||
irq.unpend();
|
flash_irq.unpend();
|
||||||
irq.enable();
|
flash_irq.enable();
|
||||||
|
|
||||||
Self { inner: p }
|
Self {
|
||||||
|
inner: p,
|
||||||
|
blocking_only: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_blocking_only(p: impl Peripheral<P = FLASH> + 'd) -> Self {
|
||||||
|
into_ref!(p);
|
||||||
|
|
||||||
|
Self {
|
||||||
|
inner: p,
|
||||||
|
blocking_only: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_blocking_regions(self) -> FlashLayout<'d, Blocking> {
|
pub fn into_blocking_regions(self) -> FlashLayout<'d, Blocking> {
|
||||||
|
@ -52,6 +68,15 @@ impl<'d> Flash<'d> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Interrupt handler
|
||||||
|
pub struct InterruptHandler;
|
||||||
|
|
||||||
|
impl interrupt::Handler<crate::interrupt::FLASH> for InterruptHandler {
|
||||||
|
unsafe fn on_interrupt() {
|
||||||
|
family::on_interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn read_blocking(base: u32, size: u32, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
|
pub(super) fn read_blocking(base: u32, size: u32, offset: u32, bytes: &mut [u8]) -> Result<(), Error> {
|
||||||
if offset + bytes.len() as u32 > size {
|
if offset + bytes.len() as u32 > size {
|
||||||
return Err(Error::Size);
|
return Err(Error::Size);
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||||
&FLASH_REGIONS
|
&FLASH_REGIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn on_interrupt(_: *mut ()) {
|
pub(crate) unsafe fn on_interrupt() {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||||
&FLASH_REGIONS
|
&FLASH_REGIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn on_interrupt(_: *mut ()) {
|
pub(crate) unsafe fn on_interrupt() {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ pub const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||||
&FLASH_REGIONS
|
&FLASH_REGIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn on_interrupt(_: *mut ()) {
|
pub(crate) unsafe fn on_interrupt() {
|
||||||
// Clear IRQ flags
|
// Clear IRQ flags
|
||||||
pac::FLASH.sr().write(|w| {
|
pac::FLASH.sr().write(|w| {
|
||||||
w.set_operr(true);
|
w.set_operr(true);
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||||
&FLASH_REGIONS
|
&FLASH_REGIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn on_interrupt(_: *mut ()) {
|
pub(crate) unsafe fn on_interrupt() {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||||
&FLASH_REGIONS
|
&FLASH_REGIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn on_interrupt(_: *mut ()) {
|
pub(crate) unsafe fn on_interrupt() {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||||
&FLASH_REGIONS
|
&FLASH_REGIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn on_interrupt(_: *mut ()) {
|
pub(crate) unsafe fn on_interrupt() {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub const fn get_flash_regions() -> &'static [&'static FlashRegion] {
|
||||||
&FLASH_REGIONS
|
&FLASH_REGIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) unsafe fn on_interrupt(_: *mut ()) {
|
pub(crate) unsafe fn on_interrupt() {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ async fn main(_s: Spawner) {
|
||||||
let mut watchdog = Watchdog::new(p.WATCHDOG);
|
let mut watchdog = Watchdog::new(p.WATCHDOG);
|
||||||
watchdog.start(Duration::from_secs(8));
|
watchdog.start(Duration::from_secs(8));
|
||||||
|
|
||||||
let mut flash: Flash<_, FLASH_SIZE> = Flash::new(p.FLASH);
|
let mut flash: Flash<_, FLASH_SIZE> = Flash::new_blocking_only(p.FLASH);
|
||||||
|
|
||||||
let mut updater = FirmwareUpdater::default();
|
let mut updater = FirmwareUpdater::default();
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::new(p.FLASH);
|
let flash = Flash::new_blocking_only(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Up);
|
let button = Input::new(p.PC13, Pull::Up);
|
||||||
|
|
|
@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let mut flash = Flash::new(p.FLASH);
|
let mut flash = Flash::new_blocking_only(p.FLASH);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Down);
|
let button = Input::new(p.PC13, Pull::Down);
|
||||||
let mut button = ExtiInput::new(button, p.EXTI13);
|
let mut button = ExtiInput::new(button, p.EXTI13);
|
||||||
|
|
|
@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let mut flash = Flash::new(p.FLASH);
|
let mut flash = Flash::new_blocking_only(p.FLASH);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Down);
|
let button = Input::new(p.PC13, Pull::Down);
|
||||||
let mut button = ExtiInput::new(button, p.EXTI13);
|
let mut button = ExtiInput::new(button, p.EXTI13);
|
||||||
|
|
|
@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::new(p.FLASH);
|
let flash = Flash::new_blocking_only(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PB2, Pull::Up);
|
let button = Input::new(p.PB2, Pull::Up);
|
||||||
|
|
|
@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::new(p.FLASH);
|
let flash = Flash::new_blocking_only(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PB2, Pull::Up);
|
let button = Input::new(p.PB2, Pull::Up);
|
||||||
|
|
|
@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::new(p.FLASH);
|
let flash = Flash::new_blocking_only(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PC13, Pull::Up);
|
let button = Input::new(p.PC13, Pull::Up);
|
||||||
|
|
|
@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
let flash = Flash::new(p.FLASH);
|
let flash = Flash::new_blocking_only(p.FLASH);
|
||||||
let mut flash = BlockingAsync::new(flash);
|
let mut flash = BlockingAsync::new(flash);
|
||||||
|
|
||||||
let button = Input::new(p.PA0, Pull::Up);
|
let button = Input::new(p.PA0, Pull::Up);
|
||||||
|
|
|
@ -20,8 +20,7 @@ fn main() -> ! {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let mut bl: BootLoader<2048> = BootLoader::default();
|
let mut bl: BootLoader<2048> = BootLoader::default();
|
||||||
let flash = Flash::new(p.FLASH);
|
let layout = Flash::new_blocking_only(p.FLASH).into_blocking_regions();
|
||||||
let layout = flash.into_regions();
|
|
||||||
let mut flash = BootFlash::new(layout.bank1_region);
|
let mut flash = BootFlash::new(layout.bank1_region);
|
||||||
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);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use defmt::{info, unwrap};
|
use defmt::{info, unwrap};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::{flash::Flash, interrupt};
|
use embassy_stm32::flash::Flash;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
|
@ -14,7 +14,7 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
let mut f = Flash::new_blocking_only(p.FLASH).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use defmt::{info, unwrap};
|
use defmt::{info, unwrap};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::{flash::Flash, interrupt};
|
use embassy_stm32::flash::Flash;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
|
@ -14,7 +14,7 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
// Once can also call `into_regions()` to get access to NorFlash implementations
|
// Once can also call `into_regions()` to get access to NorFlash implementations
|
||||||
// for each of the unique characteristics.
|
// for each of the unique characteristics.
|
||||||
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH));
|
let mut f = Flash::new_blocking_only(p.FLASH);
|
||||||
|
|
||||||
// Sector 5
|
// Sector 5
|
||||||
test_flash(&mut f, 128 * 1024, 128 * 1024);
|
test_flash(&mut f, 128 * 1024, 128 * 1024);
|
||||||
|
|
|
@ -5,17 +5,21 @@
|
||||||
use defmt::{info, unwrap};
|
use defmt::{info, unwrap};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_time::{Timer, Duration};
|
use embassy_time::{Timer, Duration};
|
||||||
use embassy_stm32::flash::Flash;
|
use embassy_stm32::flash::{Flash, InterruptHandler};
|
||||||
use embassy_stm32::gpio::{AnyPin, Level, Output, Pin, Speed};
|
use embassy_stm32::gpio::{AnyPin, Level, Output, Pin, Speed};
|
||||||
use embassy_stm32::{interrupt};
|
use embassy_stm32::bind_interrupts;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
bind_interrupts!(struct Irqs {
|
||||||
|
FLASH => InterruptHandler;
|
||||||
|
});
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(spawner: Spawner) {
|
async fn main(spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
info!("Hello Flash!");
|
info!("Hello Flash!");
|
||||||
|
|
||||||
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH));
|
let mut f = Flash::new(p.FLASH, Irqs);
|
||||||
|
|
||||||
// Led should blink uninterrupted during ~2sec erase operation
|
// Led should blink uninterrupted during ~2sec erase operation
|
||||||
spawner.spawn(blinky(p.PB7.degrade())).unwrap();
|
spawner.spawn(blinky(p.PB7.degrade())).unwrap();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use defmt::{info, unwrap};
|
use defmt::{info, unwrap};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::{flash::Flash, interrupt};
|
use embassy_stm32::flash::Flash;
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ async fn main(_spawner: Spawner) {
|
||||||
// wait a bit before accessing the flash
|
// wait a bit before accessing the flash
|
||||||
Timer::after(Duration::from_millis(300)).await;
|
Timer::after(Duration::from_millis(300)).await;
|
||||||
|
|
||||||
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank2_region;
|
let mut f = Flash::new_blocking_only(p.FLASH).into_blocking_regions().bank2_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use defmt::{info, unwrap};
|
use defmt::{info, unwrap};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::{flash::Flash, interrupt};
|
use embassy_stm32::flash::Flash;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
|
@ -14,7 +14,7 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
let mut f = Flash::new_blocking_only(p.FLASH).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use defmt::{info, unwrap};
|
use defmt::{info, unwrap};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::{flash::Flash, interrupt};
|
use embassy_stm32::flash::Flash;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
|
@ -14,7 +14,7 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
let mut f = Flash::new_blocking_only(p.FLASH).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use defmt::{info, unwrap};
|
use defmt::{info, unwrap};
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::{flash::Flash, interrupt};
|
use embassy_stm32::flash::Flash;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
|
@ -14,7 +14,7 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
const ADDR: u32 = 0x36000;
|
const ADDR: u32 = 0x36000;
|
||||||
|
|
||||||
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
let mut f = Flash::new_blocking_only(p.FLASH).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
|
|
Loading…
Reference in a new issue