pub enum FlashPrefetch {
Off,
On,
IfCodeInOneBank,
IfSingleBank,
}Expand description
Flash prefetch (FLASH_ACR.PRFTEN).
On the STM32G0B0/G0B1/G0C1 in dual-bank mode a code prefetch can fail on a branch or function call across the flash banks (“Prefetch failure when branching across flash memory banks”: ES0547 2.2.8, ES0548 2.2.10, ES0549 2.2.10; not fixed in silicon revisions A, Z and Y; the only workaround is prefetch off).
Variants§
Off
Prefetch off.
On
Prefetch on. On a dual-bank device the caller vouches that no code branches across the flash banks.
When code must sit in both banks with prefetch on, keep the cross-bank calls to a few known entry points
and route each through a function in RAM that clears PRFTEN, makes the call and sets PRFTEN again.
The errata list no workaround; a trampoline that keeps prefetch on during the crossing is not covered.
IfCodeInOneBank
Prefetch on, unless the device runs in dual-bank mode and the program’s code (__stext..__etext of
cortex-m-rt) reaches into bank 2; without the rt feature, off on a device in dual-bank mode.
For applications that want the prefetch on a dual-bank device. Only the program’s own code is checked, so not for a bootloader that jumps into an application in the other bank: that jump branches across the banks.
IfSingleBank
Prefetch on, unless the device runs in dual-bank mode (the default).
Safe for any program, bootloaders included. An application on a dual-bank device gets the prefetch back
with FlashPrefetch::IfCodeInOneBank; it then sets it from its own code when it initializes the clocks.
Trait Implementations§
Source§impl Clone for FlashPrefetch
impl Clone for FlashPrefetch
Source§fn clone(&self) -> FlashPrefetch
fn clone(&self) -> FlashPrefetch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more