diff --git a/pyproject.toml b/pyproject.toml index a2ba3ab..cdbdaba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ectf" -version = "2026.0.10" +version = "2026.0.11" description = "Tools for eCTF competitors" readme = "README.md" authors = [ diff --git a/src/ectf/hw/cli.py b/src/ectf/hw/cli.py index 35ba8ad..c2b1535 100644 --- a/src/ectf/hw/cli.py +++ b/src/ectf/hw/cli.py @@ -48,7 +48,9 @@ def status_ti() -> None: sys.exit(-1) success("Successfully got bootloader status:") - success(f" - Version: {status.year}.{status.major_version}.{status.minor_version}") + success( + f" - Version: [cyan]{status.year}.{status.major_version}.{status.minor_version}" + ) success(f" - Secure bootloader: {bool(status.secure)}") if status.installed is not None: success( @@ -86,15 +88,15 @@ def flash_ti( ] = None, ) -> None: """Flash a design onto the MSPM0L2228""" - if ".elf" in str(infile): - err_msg = ( + with (infile / "hsm.bin" if infile.is_dir() else infile).open("rb") as f: + data = f.read() + if data.startswith(b"\x7fELF"): + error( "Do not flash the .elf file. It's likely you are looking for the .bin file" ) - error(err_msg) sys.exit(-1) - with infile.open("rb") as f: - image = Image.deserialize(f.read(), name) + image = Image.deserialize(data, name) info(f"Flashing design {image.name}") board = MSPM0L2228.from_port(CONFIG["PORT"], timeout=3) @@ -146,8 +148,15 @@ def reflash_ti( ] = None, ) -> None: """Shortcut for erase, flash, then start""" - with (infile / "hsm.bin").open("rb") as f: - image = Image.deserialize(f.read(), name) + with (infile / "hsm.bin" if infile.is_dir() else infile).open("rb") as f: + data = f.read() + if data.startswith(b"\x7fELF"): + error( + "Do not flash the .elf file. It's likely you are looking for the .bin file" + ) + sys.exit(-1) + + image = Image.deserialize(data, name) info("Reflashing design") board = MSPM0L2228.from_port(CONFIG["PORT"], timeout=3) diff --git a/uv.lock b/uv.lock index c037806..8773981 100644 --- a/uv.lock +++ b/uv.lock @@ -116,7 +116,7 @@ wheels = [ [[package]] name = "ectf" -version = "2026.0.10" +version = "2026.0.11" source = { editable = "." } dependencies = [ { name = "arrow" },