pureboot: one position-independent binary — its own staging loader
The image now runs from any 512-byte slot with every command intact: control flow stays PC-relative, the write guard keys on the running slot (the return-address anchor, computed once), the info block is addressed from that same anchor as a byte pair (no absolute 16-bit address in the image), and the application jump is an indirect call through a noipa- laundered pointer to the absolute entry. 'J' — jump to a wire word address, the one transfer primitive — replaces 'G': the host knows the application entry from the info block, and moving between loader copies needs arbitrary targets. The activation window is a compile-time 8 s (PUREBOOT_TIMEOUT overrides), counted as a single calibrated poll loop. A refused page no longer poisons the write-once temporary buffer (a real silicon trap: the next write would program the drained data): every page write discards the buffer first — CTPB on the tinies, on the mega the same RWWSRE store that re-enables RWW after programming. The tinies' post-op busy-waits go with it: their CPU halts through page erase and write. 488 / 502 / 504 B on t13a / t85 / mega — under the tinies' 510-byte budget, whose last slot word is the host-managed trampoline: the resident's holds the application entry, a staging copy's the jump through which an abandoned update still times out into a loader. The host tool updates the loader with itself: --update-loader installs the identical image one slot below the resident, jumps into it, lets it rewrite the resident, and restores the staging region from a state file — each phase idempotent off the flash state, resumable after any interruption (t13a: the staging slot carries the reset vector, written last in and first out; t85: word 0 redirected around the resident rewrite; mega: fuse-matrix preflight with a hard BOOTSZ gate and --assume-fuses for simulators). Application flashing recovers by reset from any interruption: patched page 0 and trampoline first, erase descending, and a walk-region refusal behind --force on BOOTRST-below-loader megas. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,17 +3,25 @@
|
||||
|
||||
The device exposes primitives; this tool composes them: image loading (raw
|
||||
binary or Intel HEX), flash programming with read-back verification, erase as
|
||||
writing 0xff, EEPROM programming, fuse and info readout, activation-timeout
|
||||
configuration, and — on chips without a hardware boot section — the
|
||||
reset-vector surgery that re-homes the application's entry through the
|
||||
trampoline word below the loader, writing page 0 last so an interrupted
|
||||
flash still falls through to the loader.
|
||||
writing 0xff, EEPROM programming, fuse and info readout, the hand-over jump,
|
||||
and — on chips without a hardware boot section — the reset-vector surgery
|
||||
that re-homes the application's entry through the trampoline word below the
|
||||
loader. Page 0 and the trampoline are written first, so every interruption
|
||||
point of a flash leaves the chip reset-recoverable into the loader.
|
||||
|
||||
It also updates the loader itself (--update-loader): pureboot's image is
|
||||
position-independent, so the tool installs the identical binary one 512-byte
|
||||
slot below the resident loader, jumps into that staging copy, lets it rewrite
|
||||
the resident slot, and restores what the staging slot held — resumable at
|
||||
every phase from the flash state plus a host-side state file carrying the
|
||||
saved bytes.
|
||||
|
||||
Python standard library only; the serial port is driven with termios, so any
|
||||
tty works — a USB adapter as well as a simavr pty.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import select
|
||||
import sys
|
||||
@@ -22,6 +30,7 @@ import time
|
||||
|
||||
PROMPT = b"+"
|
||||
PROTOCOL_VERSION = 1
|
||||
SLOT = 512 # the loader slot size; also the self-update staging distance
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
@@ -88,12 +97,18 @@ class Info:
|
||||
raise Error(f"bad info block: {raw.hex()}")
|
||||
if raw[2] != PROTOCOL_VERSION:
|
||||
raise Error(f"protocol version {raw[2]}, tool speaks {PROTOCOL_VERSION}")
|
||||
self.raw = bytes(raw)
|
||||
self.signature = raw[3:6]
|
||||
self.page = raw[6]
|
||||
self.base = raw[7] | (raw[8] << 8)
|
||||
self.eeprom_size = raw[9] | (raw[10] << 8)
|
||||
self.patch_vector = bool(raw[11] & 1)
|
||||
self.flash_size = self.base + 512
|
||||
self.flash_size = self.base + SLOT
|
||||
self.stage = self.base - SLOT # where a staging copy of the loader goes
|
||||
# The hand-over target, as the word address 'J' takes: the trampoline
|
||||
# below the loader (tinies), or word 0 (mega — the application's own
|
||||
# reset vector; BOOTRST re-vectors a reset into the loader instead).
|
||||
self.app_entry_word = (self.base - 2) // 2 if self.patch_vector else 0
|
||||
|
||||
def describe(self):
|
||||
sig = " ".join(f"{b:02x}" for b in self.signature)
|
||||
@@ -107,7 +122,8 @@ class Info:
|
||||
|
||||
class Loader:
|
||||
"""A pureboot session. Between commands the loader has prompted `+` and
|
||||
awaits a command byte; every method restores that invariant."""
|
||||
awaits a command byte; every method restores that invariant — except
|
||||
jump(), after which the target must be knocked afresh."""
|
||||
|
||||
def __init__(self, port):
|
||||
self.port = port
|
||||
@@ -181,10 +197,23 @@ class Loader:
|
||||
def read_fuses(self):
|
||||
return self._command(b"F", 4, 2.0)
|
||||
|
||||
def run_application(self):
|
||||
self.port.write(b"G")
|
||||
def jump(self, word_address):
|
||||
"""'J': the device acks, then execution continues at the word
|
||||
address — a loader slot's base (whose copy must then be knocked
|
||||
afresh) or the application entry."""
|
||||
self.port.write(bytes((ord("J"), word_address & 0xFF, word_address >> 8)))
|
||||
self._expect_prompt()
|
||||
|
||||
def enter_copy(self, byte_address, wait):
|
||||
"""Jump into the loader copy at `byte_address` and knock it. Ending
|
||||
up in the copy addressed is guaranteed by construction: a jump to a
|
||||
slot base lands in that slot's entry stub."""
|
||||
self.jump(byte_address // 2)
|
||||
return self.connect(wait)
|
||||
|
||||
def run_application(self):
|
||||
self.jump(self.info.app_entry_word)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- images ---
|
||||
|
||||
@@ -237,8 +266,7 @@ def rjmp_to(word_address, destination, flash_words):
|
||||
|
||||
def plan_flash(image, info):
|
||||
"""The pages to program, as {page_address: bytes}, already carrying the
|
||||
reset-vector surgery where the chip needs it. Page 0 must go last —
|
||||
callers get it separated."""
|
||||
reset-vector surgery where the chip needs it."""
|
||||
page = info.page
|
||||
limit = info.base - (2 if info.patch_vector else 0)
|
||||
if len(image) > limit:
|
||||
@@ -272,25 +300,254 @@ def plan_flash(image, info):
|
||||
return pages
|
||||
|
||||
|
||||
def covered(pages, skip_blank):
|
||||
"""Pages in programming order: ascending, page 0 last; optionally
|
||||
dropping all-0xff pages (sound only over erased flash) — never the
|
||||
load-bearing page 0."""
|
||||
rest = [a for a in sorted(pages) if a != 0]
|
||||
def covered(pages, info, skip_blank):
|
||||
"""Pages in programming order; optionally dropping all-0xff pages (sound
|
||||
only over erased flash) — never a load-bearing one.
|
||||
|
||||
With a patched vector (tinies), the patched page 0 goes first and the
|
||||
trampoline page second: from the first write on, a reset lands in the
|
||||
loader and the loader's own fall-through lands on the application entry,
|
||||
so every interruption point of the flash is recoverable. With a hardware
|
||||
boot section a reset re-vectors to the loader regardless; ascending
|
||||
order, page 0 last, maximizes what an interrupted image retains."""
|
||||
trampoline_page = info.base - info.page if info.patch_vector else None
|
||||
first = [0, trampoline_page] if info.patch_vector else []
|
||||
rest = [a for a in sorted(pages) if a not in first]
|
||||
if skip_blank:
|
||||
rest = [a for a in rest if pages[a].count(0xFF) != len(pages[a])]
|
||||
return rest + [0]
|
||||
order = [a for a in first if a in pages] + rest
|
||||
if not info.patch_vector:
|
||||
order = [a for a in order if a != 0] + ([0] if 0 in pages else [])
|
||||
return order
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- fuses ---
|
||||
|
||||
|
||||
def mega_boot(high_fuse):
|
||||
"""Decode the ATmega328P high fuse's boot configuration (DS40002061B
|
||||
§27.3, Table 27-13/27-16): BOOTSZ1:0 in bits 2:1 select the boot-section
|
||||
words, BOOTRST in bit 0 (programmed = 0) re-vectors reset to its start.
|
||||
Returns (bootrst_programmed, boot_section_start_byte)."""
|
||||
bootsz = (high_fuse >> 1) & 0x03
|
||||
words = {0b11: 256, 0b10: 512, 0b01: 1024, 0b00: 2048}[bootsz]
|
||||
return (high_fuse & 1) == 0, 0x8000 - words * 2
|
||||
|
||||
|
||||
# ---------------------------------------------------------- loader update ---
|
||||
|
||||
|
||||
def image_info(image):
|
||||
"""The info block embedded in a pureboot binary, or None."""
|
||||
at = image.find(b"PB" + bytes((PROTOCOL_VERSION,)))
|
||||
return Info(image[at : at + 12]) if 0 <= at <= len(image) - 12 else None
|
||||
|
||||
|
||||
def staging_content(image, info):
|
||||
"""The 512-byte staging-slot content: the image, padding, and — on
|
||||
chips whose hand-over jumps through the word below the resident loader —
|
||||
that word, which for a staging copy is the slot's own last word: an rjmp
|
||||
to the resident base. The staging copy's fall-through and 'J'-free exit
|
||||
both land in a loader instead of garbage."""
|
||||
if len(image) > (SLOT - 2 if info.patch_vector else SLOT):
|
||||
raise Error(f"loader image is {len(image)} B, the slot holds {SLOT - 2 if info.patch_vector else SLOT}")
|
||||
content = bytearray(image) + bytearray([0xFF] * (SLOT - len(image)))
|
||||
if info.patch_vector:
|
||||
through = rjmp_to((info.base - 2) // 2, info.base // 2, info.flash_size // 2)
|
||||
content[SLOT - 2], content[SLOT - 1] = through & 0xFF, through >> 8
|
||||
return bytes(content)
|
||||
|
||||
|
||||
def update_preflight(image, info, fuse_bytes):
|
||||
"""Errors and warnings before any flash is touched. Returns warnings."""
|
||||
embedded = image_info(image)
|
||||
if embedded is None:
|
||||
raise Error("no pureboot info block in the update image — not a pureboot binary?")
|
||||
if embedded.raw[3:] != info.raw[3:]:
|
||||
raise Error(
|
||||
f"update image is for another target: it declares "
|
||||
f"[{embedded.describe()}], the device says [{info.describe()}]"
|
||||
)
|
||||
warnings = []
|
||||
if not info.patch_vector:
|
||||
if fuse_bytes is None:
|
||||
raise Error("a loader update on this chip needs its fuses — unreadable? pass --assume-fuses")
|
||||
high = fuse_bytes[3]
|
||||
bootrst, bls_start = mega_boot(high)
|
||||
if info.stage < bls_start:
|
||||
raise Error(
|
||||
f"cannot self-update: the staging slot {info.stage:#06x} lies below the "
|
||||
f"boot section ({bls_start:#06x}, high fuse {high:#04x}) where SPM is disabled "
|
||||
f"— a boot section of at least 1 KB (BOOTSZ) is required, and only an "
|
||||
f"external programmer can change fuses"
|
||||
)
|
||||
if not bootrst:
|
||||
warnings.append(
|
||||
"BOOTRST unprogrammed: reset boots the application throughout the update; "
|
||||
"an interruption is recovered by re-running this update"
|
||||
)
|
||||
elif bls_start == info.stage:
|
||||
warnings.append(
|
||||
"BOOTRST targets the staging slot: brief unrecoverable windows exist while "
|
||||
"the staging copy itself is being installed or retired (page-write scale)"
|
||||
)
|
||||
else:
|
||||
warnings.append(
|
||||
f"BOOTRST targets {bls_start:#06x}, inside application flash: reset reaches a "
|
||||
f"loader only across erased flash from there"
|
||||
)
|
||||
return warnings
|
||||
|
||||
|
||||
class UpdateState:
|
||||
"""The host-side memory of an update in flight: what the staging slot
|
||||
held (and page 0, where the update repoints it). Losing this file after
|
||||
the staging slot was overwritten loses those saved bytes — the update
|
||||
still completes, but the staging region can then only be restored by
|
||||
reflashing the application."""
|
||||
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
self.data = None
|
||||
|
||||
def load_or_save(self, loader):
|
||||
info = loader.info
|
||||
if os.path.exists(self.path):
|
||||
self.data = json.load(open(self.path))
|
||||
if bytes.fromhex(self.data["signature"]) != info.signature or self.data["base"] != info.base:
|
||||
raise Error(f"{self.path} belongs to a different device — remove it to start over")
|
||||
return
|
||||
self.data = {
|
||||
"signature": info.signature.hex(),
|
||||
"base": info.base,
|
||||
"staging": loader.read_flash(info.stage, SLOT).hex(),
|
||||
"page0": loader.read_flash(0, info.page).hex() if info.patch_vector else "",
|
||||
}
|
||||
with open(self.path, "w") as f:
|
||||
json.dump(self.data, f)
|
||||
|
||||
@property
|
||||
def staging(self):
|
||||
return bytes.fromhex(self.data["staging"])
|
||||
|
||||
@property
|
||||
def page0(self):
|
||||
return bytes.fromhex(self.data["page0"])
|
||||
|
||||
def discard(self):
|
||||
os.unlink(self.path)
|
||||
|
||||
|
||||
def write_differing(loader, base, content, order=None):
|
||||
"""Program the pages of `content` at `base` that differ from flash —
|
||||
idempotent, so a resumed phase redoes only what an interruption left."""
|
||||
page = loader.info.page
|
||||
offsets = order if order is not None else range(0, len(content), page)
|
||||
written = 0
|
||||
for offset in offsets:
|
||||
want = content[offset : offset + page]
|
||||
if loader.read_flash(base + offset, page) != want:
|
||||
loader.write_page(base + offset, want)
|
||||
written += 1
|
||||
for at in range(0, len(content), 256):
|
||||
if loader.read_flash(base + at, min(256, len(content) - at)) != content[at : at + 256]:
|
||||
raise Error(f"verify failed at {base + at:#06x} after programming")
|
||||
return written
|
||||
|
||||
|
||||
def patch_word0(loader, page0, target_base):
|
||||
"""Rewrite page 0 with its word 0 re-aimed at `target_base` — the
|
||||
resume insurance around rewriting a loader slot the reset path uses."""
|
||||
info = loader.info
|
||||
patched = bytearray(page0)
|
||||
word = rjmp_to(0, target_base // 2, info.flash_size // 2)
|
||||
patched[0], patched[1] = word & 0xFF, word >> 8
|
||||
write_differing(loader, 0, bytes(patched))
|
||||
return bytes(patched)
|
||||
|
||||
|
||||
def op_update_loader(loader, wait, path, state_path, fuse_bytes):
|
||||
"""Replace the resident loader with `path`, using the loader itself as
|
||||
its own staging loader. Every phase is idempotent and keyed off the
|
||||
actual flash state, so a re-run after any interruption resumes; the
|
||||
state file carries the bytes the staging slot held."""
|
||||
info = loader.info
|
||||
image = load_image(path)
|
||||
for warning in update_preflight(image, info, fuse_bytes):
|
||||
print(f"note: {warning}")
|
||||
staged = staging_content(image, info)
|
||||
resident = bytes(image) + bytes([0xFF] * (SLOT - len(image)))
|
||||
page = info.page
|
||||
|
||||
state = UpdateState(state_path)
|
||||
state.load_or_save(loader)
|
||||
|
||||
# Install the staging copy. On a chip whose staging slot starts at
|
||||
# address 0 (the 1 KB tiny13A), its first page carries the reset vector:
|
||||
# written last, so any earlier interruption still resets into the old
|
||||
# resident, and from then on resets enter the staging copy.
|
||||
order = list(range(0, SLOT, page))
|
||||
if info.stage == 0:
|
||||
order = order[1:] + [0]
|
||||
if write_differing(loader, info.stage, staged, order):
|
||||
print(f"staging copy installed at {info.stage:#06x}")
|
||||
|
||||
# Enter it and let it rewrite the resident slot. Where a patched reset
|
||||
# vector routes through the resident (a tiny with the staging slot away
|
||||
# from page 0), word 0 is re-aimed at the staging copy around the
|
||||
# rewrite, so a power failure mid-rewrite still resets into a loader.
|
||||
loader.enter_copy(info.stage, wait)
|
||||
redirect = info.patch_vector and info.stage != 0
|
||||
if redirect:
|
||||
patch_word0(loader, state.page0, info.stage)
|
||||
if write_differing(loader, info.base, resident):
|
||||
print(f"resident loader rewritten at {info.base:#06x}")
|
||||
|
||||
# Enter the new resident and put the staging region back: page 0 first
|
||||
# where it lives in that region (word 0 then points at the new resident
|
||||
# for the rest of the restore), the saved trampoline with the rest.
|
||||
loader.enter_copy(info.base, wait)
|
||||
if redirect:
|
||||
write_differing(loader, 0, state.page0)
|
||||
order = list(range(0, SLOT, page))
|
||||
if info.stage == 0:
|
||||
order = [0] + order[1:]
|
||||
write_differing(loader, info.stage, state.staging, order)
|
||||
|
||||
state.discard()
|
||||
print(f"loader updated: {len(image)} B at {info.base:#06x}, staging region restored")
|
||||
|
||||
|
||||
def check_walk_region(pages, info, fuse_bytes, force):
|
||||
"""With BOOTRST programmed but targeting below the loader, reset reaches
|
||||
the loader only by walking across erased flash from the boot-section
|
||||
start; application data in that span would divert reset into itself.
|
||||
Only checkable when the fuses are known (--fuses or --assume-fuses)."""
|
||||
if info.patch_vector or fuse_bytes is None:
|
||||
return
|
||||
bootrst, bls_start = mega_boot(fuse_bytes[3])
|
||||
if not bootrst or bls_start >= info.base:
|
||||
return
|
||||
overlap = [a for a in sorted(pages) if a >= bls_start and pages[a].count(0xFF) != len(pages[a])]
|
||||
if overlap and not force:
|
||||
raise Error(
|
||||
f"the image writes {overlap[0]:#06x}.. inside the reset walk region "
|
||||
f"[{bls_start:#06x}, {info.base:#06x}) (BOOTRST programmed): reset could no "
|
||||
f"longer reach the loader — --force to flash it anyway"
|
||||
)
|
||||
|
||||
|
||||
# ------------------------------------------------------------ operations ---
|
||||
|
||||
|
||||
def op_erase_flash(loader):
|
||||
"""0xff over the whole application area. Order does not matter here —
|
||||
every target byte is the same value — and a blank word 0 still falls
|
||||
through to the loader, so an interruption is harmless."""
|
||||
"""0xff over the whole application area. Descending on a patched-vector
|
||||
chip: page 0 — the patched reset vector — goes last, so an interrupted
|
||||
erase still resets into the loader, and once it is gone the whole area
|
||||
is erased and the reset walk reaches the loader anyway."""
|
||||
blank = bytes([0xFF] * loader.info.page)
|
||||
for address in range(0, loader.info.base, loader.info.page):
|
||||
addresses = range(0, loader.info.base, loader.info.page)
|
||||
for address in reversed(addresses) if loader.info.patch_vector else addresses:
|
||||
loader.write_page(address, blank)
|
||||
print(f"erase: {loader.info.base // loader.info.page} pages")
|
||||
|
||||
@@ -300,12 +557,13 @@ def op_erase_eeprom(loader):
|
||||
print(f"erase: {loader.info.eeprom_size} B of EEPROM")
|
||||
|
||||
|
||||
def op_flash(loader, path, erase, verify):
|
||||
def op_flash(loader, path, erase, verify, fuse_bytes=None, force=False):
|
||||
image = load_image(path)
|
||||
pages = plan_flash(image, loader.info)
|
||||
check_walk_region(pages, loader.info, fuse_bytes, force)
|
||||
if erase:
|
||||
op_erase_flash(loader)
|
||||
order = covered(pages, skip_blank=erase)
|
||||
order = covered(pages, loader.info, skip_blank=erase)
|
||||
for address in order:
|
||||
loader.write_page(address, pages[address])
|
||||
print(f"flash: {path}: {len(order)} pages")
|
||||
@@ -366,15 +624,10 @@ def op_read_eeprom(loader, path):
|
||||
print(f"read EEPROM: {len(data)} B -> {path}")
|
||||
|
||||
|
||||
def op_timeout(loader, seconds):
|
||||
loader.write_eeprom(loader.info.eeprom_size - 1, bytes((seconds,)))
|
||||
label = f"{seconds} s" if seconds else "the device default"
|
||||
print(f"activation timeout: {label}")
|
||||
|
||||
|
||||
def op_fuses(loader):
|
||||
low, lock, extended, high = loader.read_fuses()
|
||||
print(f"fuses: low {low:02x} high {high:02x} extended {extended:02x} lock {lock:02x}")
|
||||
return bytes((low, lock, extended, high))
|
||||
|
||||
|
||||
# -------------------------------------------------------------------- cli ---
|
||||
@@ -389,6 +642,10 @@ def main():
|
||||
parser.add_argument("--wait", type=float, default=30.0, help="seconds to keep knocking")
|
||||
parser.add_argument("--info", action="store_true", help="print the device info block")
|
||||
parser.add_argument("--fuses", action="store_true", help="read the fuse and lock bytes")
|
||||
parser.add_argument("--update-loader", metavar="FILE", help="replace the loader with this pureboot binary")
|
||||
parser.add_argument("--state", metavar="FILE", help="update state file (default: FILE.pbstate)")
|
||||
parser.add_argument("--assume-fuses", metavar="HEX8", help="fuse bytes low,lock,ext,high as 8 hex digits "
|
||||
"(overrides reading them — e.g. under a simulator that cannot)")
|
||||
parser.add_argument("--erase-flash", action="store_true", help="0xff over the application flash")
|
||||
parser.add_argument("--flash", metavar="FILE", help="program an application (bin or ihex)")
|
||||
parser.add_argument("--no-verify", action="store_true", help="skip read-back after writes")
|
||||
@@ -398,12 +655,19 @@ def main():
|
||||
parser.add_argument("--eeprom", metavar="FILE", help="program the EEPROM (bin or ihex)")
|
||||
parser.add_argument("--read-eeprom", metavar="FILE", help="dump the EEPROM")
|
||||
parser.add_argument("--verify-eeprom", metavar="FILE", help="compare EEPROM against an image")
|
||||
parser.add_argument("--timeout", type=int, metavar="S", help="activation window, 1-254 s (0: default)")
|
||||
parser.add_argument("--force", action="store_true", help="override refusable safety checks")
|
||||
parser.add_argument("--stay", action="store_true", help="leave the loader in its session")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.timeout is not None and not 0 <= args.timeout <= 254:
|
||||
parser.error("--timeout must be 0..254 (255 is the erased cell)")
|
||||
if args.update_loader and (args.flash or args.erase_flash):
|
||||
parser.error("--update-loader does not combine with application flash operations")
|
||||
fuse_override = None
|
||||
if args.assume_fuses:
|
||||
try:
|
||||
fuse_override = bytes.fromhex(args.assume_fuses)
|
||||
assert len(fuse_override) == 4
|
||||
except (ValueError, AssertionError):
|
||||
parser.error("--assume-fuses takes 8 hex digits: low,lock,extended,high")
|
||||
|
||||
port = Port(args.port, args.baud)
|
||||
try:
|
||||
@@ -411,10 +675,16 @@ def main():
|
||||
info = loader.connect(args.wait)
|
||||
if args.info:
|
||||
print(f"device: {info.describe()}")
|
||||
if args.fuses:
|
||||
op_fuses(loader)
|
||||
fuse_bytes = fuse_override
|
||||
if args.fuses or (args.update_loader and not info.patch_vector and fuse_bytes is None):
|
||||
read = op_fuses(loader)
|
||||
if fuse_bytes is None:
|
||||
fuse_bytes = read
|
||||
if args.update_loader:
|
||||
state = args.state or args.update_loader + ".pbstate"
|
||||
op_update_loader(loader, args.wait, args.update_loader, state, fuse_bytes)
|
||||
if args.flash:
|
||||
op_flash(loader, args.flash, args.erase_flash, not args.no_verify)
|
||||
op_flash(loader, args.flash, args.erase_flash, not args.no_verify, fuse_bytes, args.force)
|
||||
elif args.erase_flash:
|
||||
op_erase_flash(loader)
|
||||
if args.read_flash:
|
||||
@@ -429,8 +699,6 @@ def main():
|
||||
op_read_eeprom(loader, args.read_eeprom)
|
||||
if args.verify_eeprom:
|
||||
op_verify_eeprom(loader, args.verify_eeprom)
|
||||
if args.timeout is not None:
|
||||
op_timeout(loader, args.timeout)
|
||||
if args.stay:
|
||||
print("loader stays in its session (reset to leave)")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user