Skip to content

Add agent CLI commands and chunked write support#12

Merged
widgetii merged 1 commit intomasterfrom
feature/agent-integration
Mar 31, 2026
Merged

Add agent CLI commands and chunked write support#12
widgetii merged 1 commit intomasterfrom
feature/agent-integration

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

Wire the flash agent into the defib CLI with defib agent subcommands.

  • defib agent upload -c hi3516ev300 -p /dev/ttyUSB0 — upload agent via boot protocol
  • defib agent info -p /dev/ttyUSB0 — query running agent
  • defib agent read -a 0x41000000 -s 4KB -o dump.bin -p /dev/ttyUSB0 — read memory with CRC32
  • defib agent write -a 0x40200000 -i data.bin -p /dev/ttyUSB0 — write memory with CRC32

Client rewrite: FlashAgentClient.write_memory() uses 16KB chunked transfers with 512B packets to work within PL011 FIFO limits on uncached DDR. Added read_memory, dump_memory, selfupdate, verify methods.

Covers roadmap items 1 (WRITE chunking) and 2 (defib integration) from #11.

Test plan

  • All CI checks pass locally (ruff, mypy, pytest, agent C tests)
  • Real hardware: defib agent info — shows RAM base, flash size
  • Real hardware: defib agent read — 4KB read with CRC32 OK
  • Real hardware: defib agent write — 4KB write with CRC32 OK
  • CI on PR

🤖 Generated with Claude Code

CLI: `defib agent upload/info/read/write` commands with human+json output.
- upload: boot protocol upload with SPL from OpenIPC U-Boot
- info: query running agent
- read: dump memory to file with CRC32 verification
- write: write file to memory with CRC32 verification

Client: rewrite FlashAgentClient with chunked write_memory (16KB blocks
of 512B packets) to work within PL011 FIFO limits. Added read_memory,
dump_memory, selfupdate, verify methods. Uses recv_response to skip
stale READY packets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit da96494 into master Mar 31, 2026
13 checks passed
@widgetii widgetii deleted the feature/agent-integration branch March 31, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant