Skip to content

Flash agent roadmap: SPI flash, high-speed UART, defib integration #11

@widgetii

Description

@widgetii

Flash Agent Feature Roadmap

Done

PR #10 — Bare-metal agent with COBS protocol

  • ARM32 bare-metal agent, self-update, disconnect survival

PR #12 — Agent CLI

  • defib agent upload/info/read/write commands

PR #13 — High-speed UART

  • CMD_SET_BAUD up to 921600 with triple fallback

PR #14 — SPI flash read

  • FMC init, JEDEC ID, memory-mapped flash reads, 16MB dump verified

PR #15 — Flash dump reliability

  • sf probe fix, sanity check, transport retry + resume

PR #19 — Flash erase + write

  • CMD_ERASE, CMD_WRITE to flash, sector unlock, FMC mode switching

PR #20 — MMU/D-cache + COBS fix

  • ARMv7 MMU with D-cache
  • Critical: COBS decode trailing zero strip bug (root cause of all write failures)
  • Fixed _recv_packet_sync partial frame stashing

PR #34 — Flash program pipeline + reboot

  • CMD_FLASH_PROGRAM: RAM → erase + program locally
  • Sysctrl reboot (0x12020004 = 0xdeadbeef)
  • End-to-end: agent → flash OpenIPC → reboot → login prompt

PR #35 — Streaming write

  • Removed per-packet backpressure (no longer needed with COBS fix + D-cache)
  • 3x faster: 30 → 77 KB/s

PR #36 — Windowed ACK

  • Send W=16 blocks (256KB) back-to-back, read ACKs after
  • 88 KB/s write — 96% of line speed at 921600 baud

PR #37 — CMD_FLASH_STREAM + FMC read fix

  • CMD_FLASH_STREAM (0x0B): streaming flash write with double-buffer pipeline
  • Receive into buffer A while erasing+programming buffer B — 189s at 87 KB/s for 16MB
  • 72KB soft_rx FIFO + UART drain during flash ops for reliable buffering
  • Fix: FMC boot mode memory window wraps at 1MB — switched to register-based SPI READ
  • Verified: 16MB random data → write → power cycle → CRC32 readback: byte-perfect

PR #38 — Skip 0xFF sectors and pages

  • 32-byte sector bitmap in CMD_FLASH_STREAM payload — host marks all-0xFF sectors
  • Agent erases 0xFF sectors but skips data transfer + page programming
  • Page-level 0xFF detection: skip programming all-0xFF pages within data sectors
  • 41% faster for typical firmware: 112s vs 189s (148/256 sectors skipped for 8MB OpenIPC in 16MB image)

Performance Summary

Operation Speed 16MB Time
Flash READ (921600) 87 KB/s 3.1 min
Flash STREAM (double-buffer) 87 KB/s 3.1 min
Flash STREAM (0xFF skip, 8MB fw) 150 KB/s 112s
Flash erase + program (hidden) overlapped
Boot protocol upload 9.6 KB/s 24.5s / 230KB
Full recovery (dead → OpenIPC login) ~3 min

Remaining

Defib app integration

Multi-SoC testing

  • hi3516ev200 / gk7205v200 (same V4 generation)
  • hi3516cv300 (V3, UART 0x12100000)
  • hi3516cv610 (V5, UART 0x11040000)

Protocol enhancements

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions