From c60105960afac6486c6045c5b99b59e515316398 Mon Sep 17 00:00:00 2001 From: ppannuto-claude Date: Tue, 1 Sep 2026 11:23:27 -0700 Subject: [PATCH 1/2] tockloader: fix crash reshuffling apps with no kernel present _reshuffle_apps() logged the RAM start address with a `{:#02x}` format spec before the None-guard that immediately follows it, even though _get_memory_start_address() can legitimately return None (e.g. an empty flash image, or a TBF with a fixed flash address but no fixed RAM address). That raised: TypeError: unsupported format string passed to NoneType.__format__ any time `install`/`update` ran against a board with no kernel written yet (e.g. a freshly registered `local-board` with a zero flash base). The line was also redundant: the very next debug line already prints the same value via the pre-guarded ram_start_address_hex, so it is simply removed. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01KTQ6pWrckM3jp9vfBo4bhk --- tockloader/tockloader.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tockloader/tockloader.py b/tockloader/tockloader.py index 5c1a946..bc9fc89 100644 --- a/tockloader/tockloader.py +++ b/tockloader/tockloader.py @@ -1324,7 +1324,6 @@ def _reshuffle_apps(self, apps, preserve_order=False): # Get where app memory might start. ram_start_address = self._get_memory_start_address() - logging.debug(f"Using RAM start address {ram_start_address:#02x}") # elf2tab can produce TBFs which have a fixed flash start # address, but not a fixed RAM start address, in which case From 5829feb91a10b838af7a854d92d48f277773f756 Mon Sep 17 00:00:00 2001 From: autoblack Date: Tue, 1 Sep 2026 19:04:42 +0000 Subject: [PATCH 2/2] fixup: Format Python code with Black --- tockloader/app_padding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tockloader/app_padding.py b/tockloader/app_padding.py index 5606d9a..07b0da9 100644 --- a/tockloader/app_padding.py +++ b/tockloader/app_padding.py @@ -73,7 +73,7 @@ def get_binary(self, address=None): tbfh_binary = self.tbfh.get_binary() # Calculate the padding length. padding_binary_size = self.get_size() - len(tbfh_binary) - return tbfh_binary + b"\xFF" * padding_binary_size + return tbfh_binary + b"\xff" * padding_binary_size def info(self, verbose=False): """