Skip to content

RTC, NVS & Data Safety

Partitions

PartitionOffsetSizePurpose
nvs0x900024 KiBPrimary/backup saves
phy_init0xF0004 KiBPHY
factory0x100008 MiBProduction app
storage0x8100007 MiBFuture content reserve
coredump0xF10000512 KiBCrash diagnosis

Save envelope

Firmware stores magic PSTR, schema, state size, trusted-clock flag and FNV checksum. Read order is primary → backup. Corrupt and unknown formats are rejected rather than normalized from random bytes.

Schema evolution

StageEnvelope / StateChange
v6schema1 / v2Base settings and 240-byte state
early v7schema2 / v3Tilt level and other v7 state
2026-08-19schema3 / v4Ambient display and power-save closure

Host tests cover schema 1/2/3 migration, v4 round-trip, corrupt-primary fallback, checksum rejection, empty save and factory seal.

Write throttling

  • Ordinary dirty state writes at most every 60 seconds.
  • Purchase, settings, TEAM, Gift and launch write immediately.
  • Ambient entry, restart and power-off use a synchronous barrier.
  • Shutdown reads back and decodes; failure cancels software power-off.

RTC and offline rewards

PCF85063 keeps wall time through power loss. Invalid integrity seeds from firmware build time. Rewards require both current and saved time to be trustworthy, preventing uninitialized or rolled-back clocks from generating resources.

Rollback and coredump

All 16 MiB of Flash was backed up before migration. The coredump partition initializes correctly and validation found no crash dump. Restoring the original image overwrites all Flash and requires separate confirmation of port and image hash.