jungle HITL tests setup (#1665)

* setup new zoo

* run

* fix

---------

Co-authored-by: Bruce Wayne <batman@comma.ai>
This commit is contained in:
Adeeb Shihadeh
2023-09-30 23:19:06 -07:00
committed by GitHub
parent b6e37f25b6
commit 43bed1aa47
6 changed files with 64 additions and 72 deletions

View File

@@ -11,6 +11,7 @@ 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
@@ -32,13 +33,14 @@ Fx = (
0x8000000,
"bootstub.panda.bin",
)
F2Config = McuConfig("STM32F2", 0x411, [0x4000 for _ in range(4)] + [0x10000] + [0x20000 for _ in range(7)], *Fx)
F4Config = McuConfig("STM32F4", 0x463, [0x4000 for _ in range(4)] + [0x10000] + [0x20000 for _ in range(11)], *Fx)
F2Config = McuConfig("STM32F2", 0x411, [0x4000 for _ in range(4)] + [0x10000] + [0x20000 for _ in range(7)], 12, *Fx)
F4Config = McuConfig("STM32F4", 0x463, [0x4000 for _ in range(4)] + [0x10000] + [0x20000 for _ in range(11)], 16, *Fx)
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!

View File

@@ -34,13 +34,14 @@ class STBootloaderUSBHandle(BaseSTBootloaderHandle):
def __init__(self, libusb_device, libusb_handle):
self._libusb_handle = libusb_handle
# lsusb -v | grep Flash
# example from F4: lsusb -v | grep Flash
# iInterface 4 @Internal Flash /0x08000000/04*016Kg,01*064Kg,011*128Kg
out = libusb_handle.controlRead(0x80, 0x06, 0x0300 | 4, 0, 255)
flash_desc = bytes(out[2:]).decode('utf-16le')
sector_count = sum([int(s.split('*')[0]) for s in flash_desc.split('/')[-1].split(',')])
mcu_by_sector_count = {len(m.config.sector_sizes): m for m in McuType}
for i in range(20):
desc = libusb_handle.getStringDescriptor(i, 0)
if desc is not None and desc.startswith("@Internal Flash"):
sector_count = sum([int(s.split('*')[0]) for s in desc.split('/')[-1].split(',')])
break
mcu_by_sector_count = {m.config.sector_count: m for m in McuType}
assert sector_count in mcu_by_sector_count, f"Unkown MCU: {sector_count=}"
self._mcu_type = mcu_by_sector_count[sector_count]