Skip to content

Improve payload read diagnostics#19

Open
ericlewis wants to merge 3 commits into
add-release-workflow-docsfrom
payload-read-diagnostics
Open

Improve payload read diagnostics#19
ericlewis wants to merge 3 commits into
add-release-workflow-docsfrom
payload-read-diagnostics

Conversation

@ericlewis

Copy link
Copy Markdown
Collaborator

Summary

  • retries short payload reads until the requested header or body bytes are loaded
  • logs the failed payload section, byte progress, last sd_read result, decoded header, load address, and entry address
  • validates entry offsets more clearly, including Thumb alignment and enough remaining bytes for one instruction

Why

If /payload.bin fails to load, the old message only said the payload could not be read. This makes the loader say what went wrong in plain terms, so debugging is closer to seeing which page is missing instead of only knowing the whole book failed.

Verification

  • python3 -m unittest discover -s tests
  • python3 -m py_compile combine.py generate_start.py firmware_addresses.py tests/test_combine.py
  • cmake -S . -B /tmp/playbrew-payload-read-build -G Ninja && cmake --build /tmp/playbrew-payload-read-build
  • git diff --check

ericlewis added 2 commits May 10, 2026 01:20
When the loader cannot read /payload.bin, it now says which part failed and how many bytes it got. That makes the error easier to understand, like knowing which page of a book is missing instead of only knowing the book failed.

Short reads are retried until the full header or body is read. The header is decoded as little-endian on purpose, and bad entry offsets now explain the exact problem before the loader stops.
This adds a small way to build a real payload.bin instead of guessing the file by hand. The helper puts the right 8-byte header in front of the raw payload, like putting a label on a package so the loader knows how big it is and where to start.

CMake now builds hello-payload.bin as an example payload, CI runs the Python tests, releases include the example payload, and the README explains how to build and package custom payloads.
@ericlewis ericlewis added bug Something isn't working firmware Firmware hooks, patching, and version-specific code labels May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working firmware Firmware hooks, patching, and version-specific code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants