Skip to main content

clear_l4_pempty

Function clear_l4_pempty 

Source
pub(crate) fn clear_l4_pempty(core: &mut Core<'_>) -> Result<(), String>
Expand description

On an STM32L4, clears FLASH_SR.PEMPTY if it is set. Writing 1 toggles the bit, so it is written only when found set, then read back; the rule of embedded/tools/flash_release.py. Does nothing on other parts.

The part is recognised by reading the L4 DBGMCU_IDCODE address; a read that fails (as it may on a U3) counts as “not an L4”.

§Errors

A message if FLASH_SR cannot be read or written, or if PEMPTY is still set after the write, in which case the tag would boot its ROM bootloader.