Expand description
§SmartEEPROM
SmartEEPROM is a feature of NVM controller that simulates a RAM-like memory within a flash. As bits in flash cannot switch from 0 to 1 because of its properties (whole page of memory has to erased and data has to be recopied), SmartEEPROM introduces an indirection mechanism that handles this issue via notion of virtual pages and it handles physical page reallocation and erasing automatically underneath.
From a user perspective, SmartEEPROM behaves just like a piece of memory in RAM but it is non-volatile. Data does not get lost between resets/power cycles.
From technical standpoint, NVM controller sacrifices last
2*8192*Nvmctrl.SEESTAT.SBLK
bytes of flash (in an inactive bank). Memory
access through flash address space will cause HardFault. All accesses has to
be conducted through SmartEEPROM specific address space.
Prerequisites:
Both Nvmctrl.SEESTAT.{SBLK,PSZ}
(block size, virtual page size) are being
populated from proper bits in NVM controller user page on power-on-reset. By
default, SBLK
property is set to 0
, effectively disabling SmartEEPROM.
One of possible safe ways to change user page content is to use OpenOCD
custom commands. atsame5x
’s OpenOCD
driver supports atsame5 userpage
command. To access it from GDB, it has to be preceded with a monitor
clause.
To access SmartEeprom
struct, call Nvm::smart_eeprom
method to
retrieve its instance.
Structs§
- Smart
Eeprom - Struct representing a SmartEEPROM instance.
- Smart
Eeprom Iter - A type representing an immutable iterator over SmartEEPROM address space
- Smart
Eeprom Iter Mut - A type representing a mutable iterator over SmartEEPROM address space
Enums§
- Locked
- Type-level enum variant representing a locked state of SmartEEPROM. In that state, only read operations are permitted
- Smart
Eeprom Mode - Enum encapsulating different modes SmartEEPROM can be in.
- Smart
Eeprom Retrieval Failure - Enum representing possible failure modes of SmartEEPROM while its state is being retrieved from HW registers.
- Unlocked
- Type-level enum variant representing an unlocked state of SmartEEPROM. In that state, both read and write operations are permitted
Traits§
- Smart
Eeprom Pointable Size - Trait generalizing over primitive types that are permitted to be used as slice backing types
- Smart
Eeprom State - Trait generalizing over a state of an SmartEEPROM