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, SmartEERPOM 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 commmands. 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

Struct representing a SmartEEPROM instance.

A type representing an immutable iterator over SmartEEPROM address space

A type representing a mutable iterator over SmartEEPROM address space

Enums

Type-level enum variant representing a locked state of SmartEEPROM. In that state, only read operations are permitted

Enum encapsulating different modes SmartEEPROM can be in.

Enum representing possible failure modes of SmartEEPROM while its state is being retrieved from HW registers.

Type-level enum variant representing an unlocked state of SmartEEPROM. In that state, both read and write operations are permitted

Traits

Trait generalizing over primitive types that are permitted to be used as slice backing types

Trait generalizing over a state of an SmartEEPROM

Type Definitions

Type alias for locally used Result type.