Repository navigation
cv6xx: say what the SPL made of the DDR table, not "Failed to send U-Boot" - #165
Conversation
…Boot" The DDR-training stage slept a fixed 1.5 s and sent U-Boot whatever had happened, so the two ways a table goes wrong both surfaced four seconds later as "Failed to send U-Boot": - the SPL accepts the table and never finishes training: it prints the table header and goes silent, with no "DDR size" (#148); - the SPL refuses it ("The table is incorrect"), trains from the boot table in flash and starts the U-Boot there, so nothing takes the upload. The stage now keeps what the SPL prints and reads it. A refusal fails at once, naming it. A header with no "DDR size" gets up to 10 s more and then fails as a table that does not train this board's memory. A board that trains, or an SPL that prints nothing, goes on to the upload as before.
PR Summary by QodoReport CV6xx DDR training failures before uploading U-Boot
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
A CV6xx SPL checks the uploaded table against the chip, so a refusal is the same after any power cycle, but it reached the session as an early failure and was retried: the board was cycled and sent the same image a second time. RecoveryResult grows a retryable flag, the refusal clears it, and the session's early-failure retry honours it. A table that never trains stays retryable; one more attempt is cheap and a marginal training could pass.
|
Rejected tables still trigger power cycles: valid, and the hardware run in the PR description showed it (
The "never trains" result deliberately stays retryable: a marginal training could pass on another power-up, and one more attempt is cheap. |
Refs #148.
Problem
HiSiliconCV6xx.send_firmware()waited a fixedDDR_TRAINING_WAIT(1.5 s) after the DDR table and then sent U-Boot regardless. Two quite different outcomes therefore both appeared asFailed to send U-Boot, once the HEAD frame's ACK timed out:DDR size. This is what hi3516cv610:20s — bootrom upload fails after DDR training ("Failed to send U-Boot"), stock boot prints "DDR size" but burn never does #148 reports from a CV610 module.The table is incorrect., then trains from the boot table in flash and starts the U-Boot there (flash…DDR size…System startup), so the upload has nowhere to land.Change
The stage now keeps the SPL's UART text from the training window and acts on it:
The table is incorrect: fail immediately with a message saying the boot image is for another chip or variant and the SPL fell back to flash.DDR size: keep waiting up toDDR_TRAINING_TIMEOUT(10 s) past the usual window, stopping as soon as a verdict appears, then fail with "DDR training did not finish … this table does not train this board's memory".DDR size, or no SPL output at all: unchanged. U-Boot is sent after the same 1.5 s window. Silence on its own proves nothing, so it isn't treated as a failure.Tested
On a Hi3516CV608 (DDR2 64 MB), through a vectis UART bridge with power cycling. Every run loaded into RAM only.
-c hi3516cv608,boot-hi3516cv608-nor.binDDR size: 0x00000040, U-Boot console ready-c hi3516cv610:20s,boot-hi3516cv610-20s-nor.bin(DDR3 128 MB table)The table is incorrect.and booted from flash; defib reportedFailed to send U-BootThe SPL rejected the DDR table ("The table is incorrect"): this boot image is for another chip or variant…The "silent after the header" case from #148 can't be produced on this board: its only accepted table trains. It's covered by a unit test built from the reporter's log.
Unit tests: new
TestCV6xxDdrTrainingVerdictcovering trained, rejected, never-trains and quiet SPL. Against the old code, the rejected and never-trains scenarios both returnFailed to send U-Boot.Suite:
pytest tests/ --ignore=tests/fuzzgives 1091 passed, 3 skipped.ruff checkandmypyare clean.