# Flash Agent Feature Roadmap ## Done ### PR #10 — Bare-metal agent with COBS protocol - [x] ARM32 bare-metal agent, self-update, disconnect survival ### PR #12 — Agent CLI - [x] `defib agent upload/info/read/write` commands ### PR #13 — High-speed UART - [x] CMD_SET_BAUD up to 921600 with triple fallback ### PR #14 — SPI flash read - [x] FMC init, JEDEC ID, memory-mapped flash reads, 16MB dump verified ### PR #15 — Flash dump reliability - [x] sf probe fix, sanity check, transport retry + resume ### PR #19 — Flash erase + write - [x] CMD_ERASE, CMD_WRITE to flash, sector unlock, FMC mode switching ### PR #20 — MMU/D-cache + COBS fix - [x] ARMv7 MMU with D-cache - [x] **Critical: COBS decode trailing zero strip bug** (root cause of all write failures) - [x] Fixed `_recv_packet_sync` partial frame stashing ### PR #34 — Flash program pipeline + reboot - [x] CMD_FLASH_PROGRAM: RAM → erase + program locally - [x] Sysctrl reboot (`0x12020004 = 0xdeadbeef`) - [x] **End-to-end: agent → flash OpenIPC → reboot → login prompt** ### PR #35 — Streaming write - [x] Removed per-packet backpressure (no longer needed with COBS fix + D-cache) - [x] 3x faster: 30 → 77 KB/s ### PR #36 — Windowed ACK - [x] Send W=16 blocks (256KB) back-to-back, read ACKs after - [x] **88 KB/s write — 96% of line speed at 921600 baud** ### PR #37 — CMD_FLASH_STREAM + FMC read fix - [x] CMD_FLASH_STREAM (0x0B): streaming flash write with double-buffer pipeline - [x] Receive into buffer A while erasing+programming buffer B — **189s at 87 KB/s for 16MB** - [x] 72KB soft_rx FIFO + UART drain during flash ops for reliable buffering - [x] **Fix: FMC boot mode memory window wraps at 1MB** — switched to register-based SPI READ - [x] **Verified: 16MB random data → write → power cycle → CRC32 readback: byte-perfect** ### PR #38 — Skip 0xFF sectors and pages - [x] 32-byte sector bitmap in CMD_FLASH_STREAM payload — host marks all-0xFF sectors - [x] Agent erases 0xFF sectors but skips data transfer + page programming - [x] Page-level 0xFF detection: skip programming all-0xFF pages within data sectors - [x] **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 - [x] ~~Wire agent flash pipeline into TUI (upload → flash → reboot)~~ (PR #41) - [x] ~~`defib agent flash` one-command firmware install~~ (PR #41) - [ ] WebUI: agent flash via WebSerial - [ ] Package pre-compiled agent binaries in wheel/sdist ### Multi-SoC testing - [ ] hi3516ev200 / gk7205v200 (same V4 generation) - [ ] hi3516cv300 (V3, UART 0x12100000) - [ ] hi3516cv610 (V5, UART 0x11040000) ### Protocol enhancements - [x] ~~Windowed ACK for higher write throughput~~ (PR #36) - [x] ~~Streaming flash write (upload + program in parallel)~~ (PR #37) - [x] ~~FMC memory window stale reads~~ (PR #37 — was 1MB boot mode limit, fixed with register reads) - [x] ~~0xFF sector/page skip~~ (PR #38) - [x] ~~Agent version/capabilities in INFO response~~ (PR #40)
Flash Agent Feature Roadmap
Done
PR #10 — Bare-metal agent with COBS protocol
PR #12 — Agent CLI
defib agent upload/info/read/writecommandsPR #13 — High-speed UART
PR #14 — SPI flash read
PR #15 — Flash dump reliability
PR #19 — Flash erase + write
PR #20 — MMU/D-cache + COBS fix
_recv_packet_syncpartial frame stashingPR #34 — Flash program pipeline + reboot
0x12020004 = 0xdeadbeef)PR #35 — Streaming write
PR #36 — Windowed ACK
PR #37 — CMD_FLASH_STREAM + FMC read fix
PR #38 — Skip 0xFF sectors and pages
Performance Summary
Remaining
Defib app integration
Wire agent flash pipeline into TUI (upload → flash → reboot)(PR Adddefib agent flashone-command firmware install #41)(PR Adddefib agent flashone-command firmware installdefib agent flashone-command firmware install #41)Multi-SoC testing
Protocol enhancements
Windowed ACK for higher write throughput(PR Windowed ACK: 88 KB/s write (96% line efficiency) #36)Streaming flash write (upload + program in parallel)(PR Add CMD_FLASH_STREAM with double-buffer pipeline and fix FMC read bug #37)FMC memory window stale reads(PR Add CMD_FLASH_STREAM with double-buffer pipeline and fix FMC read bug #37 — was 1MB boot mode limit, fixed with register reads)0xFF sector/page skip(PR Skip 0xFF sectors and pages in CMD_FLASH_STREAM #38)Agent version/capabilities in INFO response(PR Add agent version and capabilities to INFO response #40)