From 5aae6716fa5506aac49dadd287229a45f0a3b94e Mon Sep 17 00:00:00 2001 From: Martin Lillepuu Date: Sun, 4 Jun 2023 17:21:14 +0300 Subject: [PATCH] Revert "cleanup fw filename conventions (#1434)" This reverts commit 4dd2735e38b63940ca1e1f42b4522ca4c1a0a1cc. --- python/__init__.py | 7 +++---- python/constants.py | 14 +++++++------- python/dfu.py | 6 ++---- release/make_release.sh | 5 ++++- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/python/__init__.py b/python/__init__.py index f92bf27df8..fb1d7784ed 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -14,7 +14,7 @@ from itertools import accumulate from .base import BaseHandle -from .constants import FW_PATH, McuType +from .constants import McuType from .dfu import PandaDFU from .isotp import isotp_send, isotp_recv from .spi import PandaSpiHandle, PandaSpiException @@ -486,7 +486,7 @@ def flash_static(handle, code, mcu_type): def flash(self, fn=None, code=None, reconnect=True): if not fn: - fn = os.path.join(FW_PATH, self._mcu_type.config.app_fn) + fn = self._mcu_type.config.app_path assert os.path.isfile(fn) logging.debug("flash: main version is %s", self.get_version()) if not self.bootstub: @@ -539,8 +539,7 @@ def wait_for_dfu(dfu_serial: Optional[str], timeout: Optional[int] = None) -> bo def up_to_date(self) -> bool: current = self.get_signature() - fn = os.path.join(FW_PATH, self.get_mcu_type().config.app_fn) - expected = Panda.get_signature_from_firmware(fn) + expected = Panda.get_signature_from_firmware(self.get_mcu_type().config.app_path) return (current == expected) def call_control_api(self, msg): diff --git a/python/constants.py b/python/constants.py index 4c3e778ad1..c55fd2c9b8 100644 --- a/python/constants.py +++ b/python/constants.py @@ -3,7 +3,7 @@ from typing import List, NamedTuple BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../") -FW_PATH = os.path.join(BASEDIR, "board/obj/") + class McuConfig(NamedTuple): mcu: str @@ -13,9 +13,9 @@ class McuConfig(NamedTuple): sector_sizes: List[int] serial_number_address: int app_address: int - app_fn: str + app_path: str bootstub_address: int - bootstub_fn: str + bootstub_path: str Fx = ( 0x1FFF7A10, @@ -23,9 +23,9 @@ class McuConfig(NamedTuple): [0x4000 for _ in range(4)] + [0x10000] + [0x20000 for _ in range(11)], 0x1FFF79C0, 0x8004000, - "panda.bin.signed", + os.path.join(BASEDIR, "board", "obj", "panda.bin.signed"), 0x8000000, - "bootstub.panda.bin", + os.path.join(BASEDIR, "board", "obj", "bootstub.panda.bin"), ) F2Config = McuConfig("STM32F2", 0x411, *Fx) F4Config = McuConfig("STM32F4", 0x463, *Fx) @@ -39,9 +39,9 @@ class McuConfig(NamedTuple): [0x20000 for _ in range(7)], 0x080FFFC0, 0x8020000, - "panda_h7.bin.signed", + os.path.join(BASEDIR, "board", "obj", "panda_h7.bin.signed"), 0x8000000, - "bootstub.panda_h7.bin", + os.path.join(BASEDIR, "board", "obj", "bootstub.panda_h7.bin"), ) @enum.unique diff --git a/python/dfu.py b/python/dfu.py index bebc243ced..f1d20842ba 100644 --- a/python/dfu.py +++ b/python/dfu.py @@ -1,4 +1,3 @@ -import os import usb1 import struct import binascii @@ -7,7 +6,7 @@ from .base import BaseSTBootloaderHandle from .spi import STBootloaderSPIHandle, PandaSpiException from .usb import STBootloaderUSBHandle -from .constants import FW_PATH, McuType +from .constants import McuType class PandaDFU: @@ -113,8 +112,7 @@ def program_bootstub(self, code_bootstub): self._handle.program(self._mcu_type.config.bootstub_address, code_bootstub) def recover(self): - fn = os.path.join(FW_PATH, self._mcu_type.config.bootstub_fn) - with open(fn, "rb") as f: + with open(self._mcu_type.config.bootstub_path, "rb") as f: code = f.read() self.program_bootstub(code) self.reset() diff --git a/release/make_release.sh b/release/make_release.sh index 5628c4998d..150c510736 100755 --- a/release/make_release.sh +++ b/release/make_release.sh @@ -19,4 +19,7 @@ rm obj/* scons -u cd obj RELEASE_NAME=$(awk '{print $1}' version) -zip -j ../../release/panda-$RELEASE_NAME.zip version panda.bin.signed bootstub.panda.bin panda_h7.bin.signed bootstub.panda_h7.bin +rm panda.bin panda_h7.bin +mv panda.bin.signed panda.bin +mv panda_h7.bin.signed panda_h7.bin +zip -j ../../release/panda-$RELEASE_NAME.zip version panda.bin bootstub.panda.bin panda_h7.bin bootstub.panda_h7.bin