openpilot v0.11.1 release
date: 2026-06-04T09:49:56 master commit: c0ab3550eca2e9daf197c46b7e4b24aa9637cf2e
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import os
|
||||
import enum
|
||||
import hashlib
|
||||
from typing import NamedTuple
|
||||
|
||||
BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")
|
||||
FW_PATH = os.path.join(BASEDIR, "board/obj/")
|
||||
|
||||
def compute_version_hash(filepath):
|
||||
with open(filepath, "rb") as f:
|
||||
# Normalize line endings on Windows
|
||||
return int.from_bytes(hashlib.sha256(f.read().replace(b'\r', b'')).digest()[:4], 'little')
|
||||
|
||||
USBPACKET_MAX_SIZE = 0x40
|
||||
|
||||
class McuConfig(NamedTuple):
|
||||
mcu: str
|
||||
mcu_idcode: int
|
||||
sector_sizes: list[int]
|
||||
sector_count: int # total sector count, used for MCU identification in DFU mode
|
||||
uid_address: int
|
||||
block_size: int
|
||||
serial_number_address: int
|
||||
app_address: int
|
||||
app_fn: str
|
||||
bootstub_address: int
|
||||
bootstub_fn: str
|
||||
|
||||
def sector_address(self, i):
|
||||
# assume bootstub is in sector 0
|
||||
return self.bootstub_address + sum(self.sector_sizes[:i])
|
||||
|
||||
|
||||
H7Config = McuConfig(
|
||||
"STM32H7",
|
||||
0x483,
|
||||
[0x20000 for _ in range(7)],
|
||||
8,
|
||||
0x1FF1E800,
|
||||
0x400,
|
||||
# there is an 8th sector, but we use that for the provisioning chunk, so don't program over that!
|
||||
0x080FFFC0,
|
||||
0x8020000,
|
||||
"panda_h7.bin.signed",
|
||||
0x8000000,
|
||||
"bootstub.panda_h7.bin",
|
||||
)
|
||||
|
||||
@enum.unique
|
||||
class McuType(enum.Enum):
|
||||
H7 = H7Config
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
return self.value
|
||||
|
||||
MCU_TYPE_BY_IDCODE = {m.config.mcu_idcode: m for m in McuType}
|
||||
Reference in New Issue
Block a user