Skip to content

qemu_arm_mps2: load apps with tockloader local-board - #19

Open
ppannuto-claude wants to merge 1 commit into
ppannuto:qemu-arm-mps2from
ppannuto-claude:mps2-tockloader-local-board
Open

qemu_arm_mps2: load apps with tockloader local-board#19
ppannuto-claude wants to merge 1 commit into
ppannuto:qemu-arm-mps2from
ppannuto-claude:mps2-tockloader-local-board

Conversation

@ppannuto-claude

@ppannuto-claude ppannuto-claude commented Sep 1, 2026

Copy link
Copy Markdown

Rebased onto qemu-arm-mps2 at d6b4825 (all of #21 and #22 are now integrated), and reworked per Brad's comment on 5125: the kernel stays on QEMU's -kernel and tockloader manages 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, tockloader never has to know about the kernel, and the install target that wrote a kernel into the image is gone.

run and qemu are still untouched — I re-ran make qemu to 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_apps formats a None RAM start address when writing to an image that has no kernel in it, which is exactly this layout, so tockloader install raises TypeError. 1.18.1 fixes that, and also stores a flash address of 0x0 instead of dropping it as falsy. The README says 1.18.1.

Verified end to end on both boards, against tockloader 1.18.1

  • make init reports the flash address it was given (Using flash_address 0x40000) — the 1.18.1 fix visible.
  • tockloader install writes into a kernel-less image without crashing.
  • make run-app boots the kernel with the app: "Hello World!" on an385 and an386.
  • Installing c_hello (4K) then blink (16K) reordered them automatically — blink flashed first, c_hello after — and the kernel found both (list shows blink Yielded, c_hello Terminated). No manual largest-first packing.
  • make qemu still boots normally; format-check, licensecheck and check-boards-readme.py pass.

The generated *_apps.bin is covered by the top-level *.bin gitignore rule.

Note for anyone testing: tockloader local-board set writes to tockloader's global user data directory, not to the tree, so make init repoints whatever local board you already had and records an absolute path. I unset mine afterwards; the README says this.

`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
ppannuto-claude force-pushed the mps2-tockloader-local-board branch from 98c3bb3 to d7f2753 Compare September 2, 2026 19:31
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