pureboot: artifact roles, wrong-chip refusal, and misplaced-loader re-homing
The README's deployment section now says what each build artifact is for: the .hex is the programmer artifact (self-addressed into the top slot), the .bin the self-update image — bare slot bytes a programmer would put at address 0, where a boot-sectioned mega cannot even heal itself (SPM only runs from the boot section) but a patched-vector chip runs the position-independent copy and re-homes a build through the ordinary --update-loader flow: the staging install and the word-0 redirect both execute outside page 0's slot, so the running-slot guard never blocks it. pbrehome.py is the acceptance test (misplaced at 0, guard intact, re-home, app flash over the stale copy, banner); the staging slot is the one position that cannot re-home itself, documented. The preflight's wrong-chip refusal and loader_image's handling of padded images (peeled to the slot content by the embedded base) are documented and the padded case pinned in the planner. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -155,6 +155,21 @@ def main():
|
||||
if pb.image_info(bytes((0xAA,)) * 40) is not None:
|
||||
fail("image_info invents a block")
|
||||
|
||||
# loader_image must peel a padded image down to the slot content: a raw
|
||||
# .bin padded from address 0 (or a whole-flash read-back with the loader
|
||||
# resident at base) yields the same bytes as the bare slot image.
|
||||
import tempfile
|
||||
slot_image = bytes((0xAA,)) * 10 + tiny.raw + bytes((0xCC,)) * 40
|
||||
padded = bytes((0xFF,)) * tiny.base + slot_image
|
||||
with tempfile.NamedTemporaryFile(suffix=".bin", delete=False) as f:
|
||||
f.write(padded)
|
||||
padded_path = f.name
|
||||
try:
|
||||
if pb.loader_image(padded_path) != slot_image:
|
||||
fail("loader_image does not peel a padded image to the slot content")
|
||||
finally:
|
||||
os.unlink(padded_path)
|
||||
|
||||
# Update preflight: the full fuse matrix, plus target mismatch.
|
||||
other = info_of(pb, 0x1E00, 32, True, 0x2000)
|
||||
expect_error("wrong-target image", lambda: pb.update_preflight(binary, other, None), "another target")
|
||||
|
||||
Reference in New Issue
Block a user