Skip to content

Commit

Permalink
Revert "cleanup fw filename conventions (commaai#1434)"
Browse files Browse the repository at this point in the history
This reverts commit 4dd2735.
  • Loading branch information
martinl committed Jun 4, 2023
1 parent 86e8d32 commit 5aae671
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
7 changes: 3 additions & 4 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down
14 changes: 7 additions & 7 deletions python/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -13,19 +13,19 @@ 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,
0x800,
[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)
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions python/dfu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import usb1
import struct
import binascii
Expand All @@ -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:
Expand Down Expand Up @@ -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()
5 changes: 4 additions & 1 deletion release/make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5aae671

Please sign in to comment.