Skip to content

Add PRESTEP1 DDR training step and fix boot timing#47

Merged
widgetii merged 1 commit intomasterfrom
feature/prestep1-and-timing-fixes
Apr 20, 2026
Merged

Add PRESTEP1 DDR training step and fix boot timing#47
widgetii merged 1 commit intomasterfrom
feature/prestep1-and-timing-fixes

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

  • PRESTEP1: Add DDR training verification step (sent after DDRSTEP0). hi3516av200 requires this 128-byte bytecode to complete DDR initialization — without it, U-Boot crashes silently.
  • Non-fatal TAIL: PRESTEP0/DDRSTEP0/PRESTEP1 TAIL frames are now non-fatal (av200 bootrom doesn't ACK them).
  • Rehandshake after PRESTEP0: av200 bootrom goes silent after executing PRESTEP0 code, needs rehandshake before accepting DDRSTEP0.
  • HEAD timeout: Increased from 30ms to 150ms — av200 needs ~100ms after handshake before accepting frames.
  • Power-cycle timing: Flush serial buffer 1s after power-cycle API call to discard warm-reboot markers that cause false handshake triggers.

Test plan

  • uv run pytest tests/ -x -v --ignore=tests/fuzz — 326 passed
  • hi3516av200 hardware: full PRESTEP0→DDRSTEP0→PRESTEP1→SPL→U-Boot transfer, U-Boot boots
  • hi3516av300 hardware: full install with --power-cycle (previous PR)

🤖 Generated with Claude Code

- Add PRESTEP1 support: DDR training verification bytecode sent after
  DDRSTEP0. Required by hi3516av200 (and likely others) for DDR to
  actually initialize.
- Make PRESTEP0/DDRSTEP0/PRESTEP1 TAIL frames non-fatal (av200 bootrom
  doesn't ACK them).
- Add rehandshake after PRESTEP0 (av200 bootrom goes silent after
  executing PRESTEP0 code).
- Increase HEAD frame timeout from 30ms to 150ms (av200 needs ~100ms
  after handshake before accepting frames).
- Fix power-cycle session: flush serial buffer 1s after power-cycle
  to discard warm-reboot markers, preventing false handshake triggers.

Tested on hi3516av200 hardware: full PRESTEP0→DDRSTEP0→PRESTEP1→SPL→
U-Boot transfer succeeds, U-Boot boots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 375c061 into master Apr 20, 2026
13 checks passed
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