diff --git a/embassy-stm32/src/flash/f0.rs b/embassy-stm32/src/flash/f0.rs index 22e08e91a..bf601f05c 100644 --- a/embassy-stm32/src/flash/f0.rs +++ b/embassy-stm32/src/flash/f0.rs @@ -49,7 +49,7 @@ pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) wait_ready_blocking() } -pub(crate) unsafe fn erase_sector_blocking(sector: &FlashSector) -> Result<(), Error> { +pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), Error> { pac::FLASH.cr().modify(|w| { w.set_per(true); }); diff --git a/embassy-stm32/src/flash/f3.rs b/embassy-stm32/src/flash/f3.rs index e05734703..5b566a62f 100644 --- a/embassy-stm32/src/flash/f3.rs +++ b/embassy-stm32/src/flash/f3.rs @@ -49,7 +49,7 @@ pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) wait_ready_blocking() } -pub(crate) unsafe fn erase_sector_blocking(sector: &FlashSector) -> Result<(), Error> { +pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), Error> { pac::FLASH.cr().modify(|w| { w.set_per(true); }); diff --git a/embassy-stm32/src/flash/f4.rs b/embassy-stm32/src/flash/f4.rs index 8a0e2001b..a9ebaa355 100644 --- a/embassy-stm32/src/flash/f4.rs +++ b/embassy-stm32/src/flash/f4.rs @@ -320,6 +320,8 @@ unsafe fn write_start(start_address: u32, buf: &[u8; WRITE_SIZE]) { pub(crate) async unsafe fn erase_sector(sector: &FlashSector) -> Result<(), Error> { save_data_cache_state(); + trace!("Erasing sector number {}", sector.snb()); + pac::FLASH.cr().modify(|w| { w.set_ser(true); w.set_snb(sector.snb()); @@ -344,6 +346,8 @@ pub(crate) async unsafe fn erase_sector(sector: &FlashSector) -> Result<(), Erro pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), Error> { save_data_cache_state(); + trace!("Blocking erasing sector number {}", sector.snb()); + pac::FLASH.cr().modify(|w| { w.set_ser(true); w.set_snb(sector.snb()) diff --git a/embassy-stm32/src/flash/l.rs b/embassy-stm32/src/flash/l.rs index e27accb01..0a5b6301e 100644 --- a/embassy-stm32/src/flash/l.rs +++ b/embassy-stm32/src/flash/l.rs @@ -70,7 +70,7 @@ pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) wait_ready_blocking() } -pub(crate) unsafe fn erase_sector_blocking(sector: &FlashSector) -> Result<(), Error> { +pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), Error> { #[cfg(any(flash_l0, flash_l1))] { pac::FLASH.pecr().modify(|w| { diff --git a/embassy-stm32/src/flash/other.rs b/embassy-stm32/src/flash/other.rs index 73266177f..c007f1178 100644 --- a/embassy-stm32/src/flash/other.rs +++ b/embassy-stm32/src/flash/other.rs @@ -27,7 +27,7 @@ pub(crate) unsafe fn disable_blocking_write() { pub(crate) unsafe fn blocking_write(_start_address: u32, _buf: &[u8; WRITE_SIZE]) -> Result<(), Error> { unimplemented!(); } -pub(crate) unsafe fn erase_sector_blocking(_sector: &FlashSector) -> Result<(), Error> { +pub(crate) unsafe fn blocking_erase_sector(_sector: &FlashSector) -> Result<(), Error> { unimplemented!(); } pub(crate) unsafe fn clear_all_err() {