profiles: cap hi3518ev200's SPL upload at its 16 KB SRAM ceiling - #126
Merged
Conversation
OpenIPC/firmware#2299 reported `defib burn -c hi3518ev200` dying at 78% with "Failed to send SPL", reproducibly, on both attempts of the same run. u-boot-hi3518ev200-universal.bin (135452 B, `latest`) carries its LZMA payload at file offset 0x4BB0, so _detect_spl_size returns 0x4800 — 18 chunks. ev200's SPL window starts at 0x04010500 and its SRAM ends at 0x04014000, so chunks 1-14 land inside SRAM (up to 0x04013D00) and chunk 15 crosses the ceiling: 14/18 is the 78% the reporter saw. Past the ceiling the bootrom's own stack/state is overwritten, it answers 0x20 instead of 0xAA and re-enters boot mode, which is why the retry stalls at exactly the same place rather than somewhere random. Identical signature to the hi3520dv200 fault fixed in #78 — same spl_address, same chunk, same 0x04014000 boundary — and that chip already carries SRAMLIMIT for it. ev200 was simply never given the field. 0x3B00 is not a guess: 0x04010500 + 0x3B00 lands exactly on 0x04014000, and it is also what this chip's HiTool FILELEN uploads, so the capped transfer is byte-for-byte what the vendor tool sends. Deliberately scoped to ev200. SRAMLIMIT is not "FILELEN as a ceiling" — hi3516av200 (detected 0x6800 vs FILELEN 0x4F00) and hi3516cv300 (0x5400 vs 0x4F00) both overshoot their FILELEN and pass on real hardware, so their SRAM is genuinely larger. Only chips with a measured ceiling get the field. Not yet confirmed on ev200 hardware — there is no ev200 in the lab. The reporter has the board and can test the capped path.
PR Summary by QodoCap Hi3518EV200 SPL upload at 16KB SRAM ceiling via SRAMLIMIT
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can switch off images and animations for a plain-text comment |
This was referenced Aug 24, 2026
openipc-ai
added a commit
that referenced
this pull request
Aug 24, 2026
Follow-up to #126, which fixed the same defect on hi3518ev200. ## Why cv200 has it too The two profiles are the same silicon window — only `PRESTEP0` differs: | | hi3518ev200 | hi3516cv200 | |---|---|---| | `ADDRESS` | `0x04013000` / `0x04010500` / `0x81000000` | identical | | `FILELEN` | `0x0040` / `0x3b00` | identical | | SRAM ceiling | `0x04010500 + 0x3B00 = 0x04014000` | identical | | shipped image | 135452 B, LZMA at `0x4BB0` → detects `0x4800` | 135432 B, LZMA at `0x4BB0` → detects `0x4800` | | overrun | 3328 B | 3328 B | Both are built by the same `build.sh` in OpenIPC/u-boot-hi3516cv200 (`SOCS="hi3518ev200 hi3516cv200"`). ## Evidence The ev200 half was confirmed on real hardware in OpenIPC/firmware#2299 — chunks 1-14 ACK on attempt 1/32, chunk 15 targets `0x04013D00..0x04014100`, the bootrom stops answering and all 32 retries time out. With #126's cap the same board completes both stages with no retries at all. cv200 puts identical numbers through the identical code path. I have no cv200 to burn, so that inference plus the profile diff is the evidence here. ## What this does and doesn't fix Does: stops defib writing past the bootrom's stack mid-upload. Doesn't: make cv200 recoverable. The prelude these builds produce is 19376 B against a 15104 B window, so even a correctly-capped SPL is missing 4272 bytes of live code and won't execute — tracked upstream as OpenIPC/u-boot-hi3516cv200#5. This is the difference between a clean failure and a wedged chip. ## Test plan - [x] `pytest` — 734 passed, 2 skipped - [x] Regression test asserting `spl_sram_limit == 0x3B00` and `spl_address + limit == 0x04014000` - [ ] cv200 hardware — none available; ev200 sibling verified in firmware#2299
openipc-ai
added a commit
that referenced
this pull request
Aug 24, 2026
…128) ## The problem Two places tell users to install from PyPI: - `README.md` — `uv tool install defib` / `pipx install defib` - `web/index.html:621` — the fallback shown when the browser build refuses a frame-blast SoC ```console $ curl -s -o /dev/null -w '%{http_code}\n' https://pypi.org/pypi/defib/json 404 ``` There is no `defib` package on PyPI, so both commands fail. ## Why it matters OpenIPC/firmware#2299 is a user recovering a bricked hi3518ev200 over UART. hi3518ev200 is a frame-blast chip, so the web UI showed them precisely the broken line. They got there in the end, but when #126 landed and they were asked to reinstall and retry, the new copy went somewhere other than the `defib` on their `PATH` — an active virtualenv shadowed `~/.local/bin` — and they reported two more rounds of results from the old build against a bug that was already fixed. ## The change ```bash uv tool install git+https://github.com/OpenIPC/defib # or pipx install git+https://github.com/OpenIPC/defib ``` plus a `uvx` one-liner in both places, which needs no install and cannot be shadowed by an active virtualenv: ```bash uvx --from git+https://github.com/OpenIPC/defib defib burn -c <chip> -p /dev/ttyUSB0 -t ``` ## Not in scope Publishing to PyPI would also fix this and is probably worth doing — it needs a maintainer with the account, so the docs fix goes first. ## Test plan - [x] `uv tool install git+https://github.com/OpenIPC/defib` — installs, `defib list-chips` prints 123 chips - [x] `uvx --from git+https://github.com/OpenIPC/defib defib list-chips` — works with nothing installed - [x] `node --check` over all three `<script>` blocks in `web/index.html` — parses - [x] Evaluated the edited template literal; renders as ``` uvx --from git+https://github.com/OpenIPC/defib \ defib burn -c hi3518ev200 -p /dev/ttyUSB0 -t ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
Reported in OpenIPC/firmware#2299 — a user recovering a blank-NOR Hi3518EV200 gets:
Handshake and DDR init are fine; SPL dies at 78%, and the retry dies at the same 78%.
Cause
u-boot-hi3518ev200-universal.bin(135452 B,latest) has its LZMA payload at file offset0x4BB0, so_detect_spl_sizereturns0x4800— 18 chunks of 1 KB.spl_address0x040105000x040140000x3B00(15104 B, 15 chunks)0x4800(18432 B, 18 chunks)Chunks 1–14 fit (last byte at
0x04013D00). Chunk 15 writes0x04013D00..0x04014100and crossesthe ceiling into the bootrom's own stack/state. 14/18 = 77.8% — the reported 78%. The bootrom
then answers
0x20instead of0xAAand re-enters boot mode, which is why the retry stops atexactly the same place instead of somewhere random.
This is the same fault as hi3520dv200 in #78: same
spl_address, same chunk, same0x04014000boundary. That chip got
SRAMLIMIT; ev200 was never given the field.Ruled out: no
>=12-byte0xFFruns anywhere below0x4800in this binary, so thecv500-family
_zero_long_ff_runsquirk is not involved.Fix
Add
"SRAMLIMIT": "0x3B00"tohi3518ev200.json.0x04010500 + 0x3B00 == 0x04014000exactly, and0x3B00is also this chip's HiToolFILELEN,so the capped upload is byte-for-byte what the vendor tool sends for an ev200.
Scope
Only ev200.
SRAMLIMITis not "FILELEN as a ceiling" — FILELEN is HiTool's reference SPLsize, which on several chips is well below the real SRAM ceiling:
0x68000x4F000x54000x4F000x44000x60000x44000x60000x48000x3B00Setting
SRAMLIMIT = FILELENfleet-wide would truncate av200 and cv300, which are known-good.Only chips with a measured ceiling get the field.
Test plan
pytest— 733 passed, 2 skippedspl_sram_limit == 0x3B00;spl_address + limit == 0x04014000; the real0x4BB0layout detects0x4800uncapped and0x3B00cappedoffered to test; this should not merge until that comes back.