qemu_arm_mps2: load apps with tockloader local-board - #19
Open
ppannuto-claude wants to merge 1 commit into
Open
Conversation
ppannuto
force-pushed
the
qemu-arm-mps2
branch
from
September 1, 2026 17:56
6c59afb to
d17f49b
Compare
5 tasks
ppannuto-claude
force-pushed
the
mps2-tockloader-local-board
branch
from
September 1, 2026 18:02
84f0352 to
777f0ef
Compare
ppannuto
force-pushed
the
qemu-arm-mps2
branch
from
September 1, 2026 18:43
d17f49b to
d164be4
Compare
ppannuto-claude
force-pushed
the
mps2-tockloader-local-board
branch
2 times, most recently
from
September 1, 2026 18:46
e0d36c4 to
98c3bb3
Compare
`run-app` took a raw `.tbf` and handed it to QEMU as a second ROM blob at APP_ADDRESS. That worked, but pushed the flash layout onto the user: the README had to explain that loading more than one app meant concatenating the `.tbf` files by hand, largest-first, because `elf2tab` pads each one to a power-of-two size for MPU alignment and the loader assumes that ordering. Let `tockloader local-board` own that image instead. It does the packing itself, and brings `tockloader list`/`uninstall` along with it. QEMU keeps loading the kernel through `-kernel` and takes the apps image as a separate blob, so the image holds apps only and `tockloader` never has to know about the kernel. That also means the image is based at the start of the "prog" region rather than at 0x0, and there is no `install` target writing a kernel into it. `run` and `qemu` are untouched, so the CI runners that drive `make qemu` are unaffected. Needs tockloader 1.18.1. 1.18.0 formats a `None` RAM start address when writing to an image with no kernel in it, which is exactly this layout; 1.17.0 and earlier additionally drop a flash address of 0x0 rather than storing it. Noted as a version requirement in the README. Verified end to end on both boards against tockloader 1.18.1: `make init` now reports the flash address it was given, `tockloader install` writes into an image with no kernel without crashing, and `make run-app` boots the kernel with the app alongside it. Installing c_hello (4K) and then blink (16K) reordered them on its own -- blink written first, c_hello after -- and the kernel found both, so no manual largest-first packing is needed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L56it8rfV2vkZF9YRN5fa8
ppannuto-claude
force-pushed
the
mps2-tockloader-local-board
branch
from
September 2, 2026 19:31
98c3bb3 to
d7f2753
Compare
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.
Rebased onto
qemu-arm-mps2at d6b4825 (all of #21 and #22 are now integrated), and reworked per Brad's comment on 5125: the kernel stays on QEMU's-kernelandtockloadermanages only the apps, loaded as a separate blob.That is a better shape than what this PR originally did, and it simplifies things: the image holds apps only, so it is based at the start of the "prog" region rather than at 0x0,
tockloadernever has to know about the kernel, and theinstalltarget that wrote a kernel into the image is gone.runandqemuare still untouched — I re-ranmake qemuto confirm the CI path is unaffected.Version requirement is 1.18.1, not 1.18.0
Now that both are released I checked them rather than assuming. 1.18.0 is not sufficient:
_reshuffle_appsformats aNoneRAM start address when writing to an image that has no kernel in it, which is exactly this layout, sotockloader installraisesTypeError. 1.18.1 fixes that, and also stores a flash address of0x0instead of dropping it as falsy. The README says 1.18.1.Verified end to end on both boards, against tockloader 1.18.1
make initreports the flash address it was given (Using flash_address 0x40000) — the 1.18.1 fix visible.tockloader installwrites into a kernel-less image without crashing.make run-appboots the kernel with the app: "Hello World!" on an385 and an386.c_hello(4K) thenblink(16K) reordered them automatically — blink flashed first, c_hello after — and the kernel found both (listshows blink Yielded, c_hello Terminated). No manual largest-first packing.make qemustill boots normally;format-check,licensecheckandcheck-boards-readme.pypass.The generated
*_apps.binis covered by the top-level*.bingitignore rule.Note for anyone testing:
tockloader local-board setwrites to tockloader's global user data directory, not to the tree, somake initrepoints whatever local board you already had and records an absolute path. I unset mine afterwards; the README says this.