Skip to content

Add PRESTEP0 DDR pre-init step to boot protocol#44

Merged
widgetii merged 1 commit intomasterfrom
feature/prestep0-ddr-init
Apr 19, 2026
Merged

Add PRESTEP0 DDR pre-init step to boot protocol#44
widgetii merged 1 commit intomasterfrom
feature/prestep0-ddr-init

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

  • Fix hi3516av200/av300 boot failure: HiTool sends a PRESTEP0 step (writes "NOWD" to DDR controller register) before DDRSTEP0 for all SoCs. Without it, DDR init fails silently on av200/av300 and SPL transfer hangs at ~20KB.
  • Fix power-cycle timing: Start handshake (flooding 0xAA) before power-on so fast-boot devices with <100ms bootrom windows are caught reliably.
  • Add packet tracing: logger.debug() calls throughout the protocol for diagnosing boot issues with -d flag.

Changes

  • src/defib/profiles/schema.py — Add optional PRESTEP0 field to SoCProfile
  • src/defib/protocol/hisilicon_standard.py — Send PRESTEP0 before DDRSTEP0 when present; add debug tracing
  • src/defib/recovery/session.py — Split power cycle: off → start handshake → on (catches fast bootrom)
  • 66 chip profiles — Add PRESTEP0 data extracted from HiTool 5.0.61 via LoTool decryption
  • src/defib/profiles/data/hi3516av300.json — New profile
  • tests/test_protocol_robustness.py — Update ACK counts for PRESTEP0

Test plan

  • uv run pytest tests/ -x -v --ignore=tests/fuzz — 326 passed
  • Tested on hi3516av300 hardware with PoE power-cycle — full boot success
  • Test on hi3516av200 hardware
  • Test on hi3516ev300 hardware (should still work, PRESTEP0 is additive)

🤖 Generated with Claude Code

HiTool sends PRESTEP0 (a 64-byte DDR controller pre-init) before
DDRSTEP0 for all SoCs. Without it, chips like hi3516av200/av300 fail
during SPL transfer because DDR init doesn't complete properly.

- Add optional PRESTEP0 field to SoCProfile schema
- Send PRESTEP0 HEAD+DATA+TAIL before DDRSTEP0 when present
- Add PRESTEP0 data to 66 chip profiles (extracted from HiTool 5.0.61)
- Add hi3516av300 profile
- Fix power-cycle timing: start handshake before power-on to catch
  fast-boot devices with <100ms bootrom windows
- Add packet-level debug tracing to protocol (logger.debug)

Tested on hi3516av300 hardware: full DDR→SPL→U-Boot transfer succeeds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 5dc6ab7 into master Apr 19, 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