Expand description
Flash memory (FLASH)
Flash gives access to the whole internal flash, addressed by offsets from FLASH_BASE.
Flash::into_regions and Flash::into_blocking_regions split it into one driver per
flash region (bank, or group of equally sized sectors), which can be handed to different
parts of the application.
The driver is shared by all families. Writes are done in units of WRITE_SIZE bytes,
which is the native program unit of the chip (a half-word on F0/F1/F3, a 256-bit flash
word on H7, …), and erases are done per sector/page.
§ECC
Many families protect each flash word with an error correction code:
- Single-bit errors are corrected transparently.
- Two (or more) bit errors can’t be corrected. The read fails with
Error::Ecc.
With the Cortex-M7 data cache enabled, a read also fails when another flash word of the same 32-byte cache line has an uncorrectable error.
§EDATA
On H5 and C5, part of the flash can be used as EDATA (“flash high-cycle data” on H5): flash
with 16-bit words and a higher endurance, meant for storing data. It is enabled in the option
bytes (EDATA_EN on C5, EDATA1_EN/EDATA1_STRT and EDATA2_EN/EDATA2_STRT on H5).
FlashLayout::edata_bank1 and FlashLayout::edata_bank2 are Edata drivers for the EDATA
area of each bank.
§EEPROM
L0 and L1 have a data EEPROM, which can be rewritten without erasing it first.
FlashLayout::eeprom is an Eeprom driver for it.
Structs§
- Bank1
Region - Bank2
Region - Config
- Flash driver configuration.
- Flash
- Internal flash memory driver.
- Flash
Layout - Flash
Region - Flash memory region
- Flash
Sector - Flash sector.
- Interrupt
Handler - Flash interrupt handler.
Enums§
- Erase
Parallelism - Parallelism used for flash erase operations.
- Error
- Flash error
- Flash
Bank - Flash bank.
Constants§
- BANK1_
REGION - BANK2_
REGION - FLASH_
BASE - FLASH_
REGIONS - FLASH_
SIZE - MAX_
ERASE_ SIZE - READ_
SIZE - Read size (always 1)
- WRITE_
SIZE
Functions§
- banks_
swapped - Returns whether flash banks 1 and 2 are currently swapped in the memory map.
- get_
flash_ regions - Get all flash regions.