Skip to content

SPI NOR layout and backup

The onboard NOR Flash is 16 MiB in total (addresses 0x000000–0xFFFFFF) and is a system resource: the bootloader, firmware, and applications all live in it. Before writing, take a look at what is in the range you intend to overwrite, and back it up first.

After entering FEL:

Terminal window
xfel spinor read 0x0 0x1000000 neko-backup.bin
# or
rfel spinor read 0x0 0x1000000 neko-backup.bin

Keep the backup file and its SHA-256 safely, and do not overwrite the previous backup.

Restore:

Terminal window
xfel spinor write 0x0 neko-backup.bin

Read it back to verify after writing, then reset.

You should check the SHA-256 both before and after writing.

PlatformCommand
Windows PowerShellGet-FileHash -Algorithm SHA256 <file>
Linuxsha256sum <file>; against the checksum list: sha256sum -c SHA256SUMS
macOSshasum -a 256 <file>; against the checksum list: shasum -a 256 -c SHA256SUMS

How Flash is divided depends on which software set you have installed. The same board can have one of the following layouts; they are mutually incompatible, and switching between them requires rewriting the boot part.

ComponentNOR offsetReserved in this layoutLoad RAM address
SyterKit0x00000064 KiB0x00020000
Devicetree0x010000256 KiB0x40f40000
RustSBI0x050000512 KiB0x40f80000
Asterinas0x0d00005 MiB (up to before initramfs)0x40000000
initramfs0x5d00001 MiB0x40500000

The complete image is written to 0x000000..0x6d0000; 0x6d0000..0x1000000 is left untouched. See RustSBI + Asterinas for details.

ComponentNOR offsetReserved in this layoutLoad RAM address
SyterKit0x00000064 KiB0x00020000
Devicetree0x010000256 KiB0x40f40000
OpenSBI fw_jump0x050000512 KiB0x40f80000
Linux Image0x0d00006 MiB0x40000000
SquashFS root filesystem0x6d0000up to 0xf00000 (about 8.2 MiB)Mounted from MTD
JFFS2 overlay0xf000001 MiBMounted from MTD

The complete image covers the entire 16 MiB, including the overlay partition, so writing it discards the changes already persisted on the board. See Prebuilt images for details.

ContentNOR offset
SyterKit loader (three copies)0x000000 / 0x010000 / 0x020000
Saved Flash sampling-point parameters0x02f000
System program header page (UF2 downloader)0x030000
Application header page (Zephyr application)0x200000 (at most about 0x4CF000 bytes)

See UF2 drag-and-drop flashing for details.

  1. The whole Flash has been backed up, and the backup file’s SHA-256 has been recorded.
  2. The address range to be written does not overwrite data you want to keep.
  3. After writing, read back and compare the SHA-256, and reset only once they match.
  4. On failure (a command error or a checksum mismatch), resolve the problem before booting; do not force a reset.