mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-10-01 03:43:51 +08:00
use scons to build panda fw (#20457)
* use scons to build panda fw
* add arm gcc to dockerfile
* install gcc on macOS
* pandad shutdown test is flaky and broken due to faster startup
* bump panda
old-commit-hash: 0e338d2b91
This commit is contained in:
@@ -13,7 +13,7 @@ os.environ['FAKEUPLOAD'] = "1"
|
||||
|
||||
# TODO: make eon fast
|
||||
MAX_STARTUP_TIME = 30 if EON else 15
|
||||
ALL_PROCESSES = [p.name for p in managed_processes.values() if type(p) is not DaemonProcess]
|
||||
ALL_PROCESSES = [p.name for p in managed_processes.values() if (type(p) is not DaemonProcess) and (p.name not in ['updated', 'pandad'])]
|
||||
|
||||
|
||||
class TestManager(unittest.TestCase):
|
||||
@@ -42,7 +42,7 @@ class TestManager(unittest.TestCase):
|
||||
for p in ALL_PROCESSES:
|
||||
managed_processes[p].start()
|
||||
|
||||
time.sleep(10)
|
||||
time.sleep(30)
|
||||
|
||||
for p in reversed(ALL_PROCESSES):
|
||||
exit_code = managed_processes[p].stop(retry=False)
|
||||
|
||||
+9
-21
@@ -3,13 +3,16 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from panda import BASEDIR as PANDA_BASEDIR, Panda, PandaDFU, build_st
|
||||
from panda import BASEDIR as PANDA_BASEDIR, Panda, PandaDFU
|
||||
from common.basedir import BASEDIR
|
||||
from common.gpio import gpio_init, gpio_set
|
||||
from selfdrive.hardware import TICI
|
||||
from selfdrive.hardware.tici.pins import GPIO_HUB_RST_N, GPIO_STM_BOOT0, GPIO_STM_RST_N
|
||||
from selfdrive.swaglog import cloudlog
|
||||
|
||||
PANDA_FW_FN = os.path.join(PANDA_BASEDIR, "board", "obj", "panda.bin.signed")
|
||||
|
||||
|
||||
def set_panda_power(power=True):
|
||||
if not TICI:
|
||||
return
|
||||
@@ -25,24 +28,9 @@ def set_panda_power(power=True):
|
||||
gpio_set(GPIO_STM_RST_N, not power)
|
||||
|
||||
|
||||
def get_firmware_fn():
|
||||
signed_fn = os.path.join(PANDA_BASEDIR, "board", "obj", "panda.bin.signed")
|
||||
if os.path.exists(signed_fn):
|
||||
cloudlog.info("Using prebuilt signed firmware")
|
||||
return signed_fn
|
||||
else:
|
||||
cloudlog.info("Building panda firmware")
|
||||
fn = "obj/panda.bin"
|
||||
build_st(fn, clean=False)
|
||||
return os.path.join(PANDA_BASEDIR, "board", fn)
|
||||
|
||||
|
||||
def get_expected_signature(fw_fn=None):
|
||||
if fw_fn is None:
|
||||
fw_fn = get_firmware_fn()
|
||||
|
||||
def get_expected_signature():
|
||||
try:
|
||||
return Panda.get_signature_from_firmware(fw_fn)
|
||||
return Panda.get_signature_from_firmware(PANDA_FW_FN)
|
||||
except Exception:
|
||||
cloudlog.exception("Error computing expected signature")
|
||||
return b""
|
||||
@@ -71,8 +59,7 @@ def update_panda():
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
fw_fn = get_firmware_fn()
|
||||
fw_signature = get_expected_signature(fw_fn)
|
||||
fw_signature = get_expected_signature()
|
||||
|
||||
try:
|
||||
serial = panda.get_serial()[0].decode("utf-8")
|
||||
@@ -90,7 +77,7 @@ def update_panda():
|
||||
|
||||
if panda.bootstub or panda_signature != fw_signature:
|
||||
cloudlog.info("Panda firmware out of date, update required")
|
||||
panda.flash(fw_fn)
|
||||
panda.flash()
|
||||
cloudlog.info("Done flashing")
|
||||
|
||||
if panda.bootstub:
|
||||
@@ -111,6 +98,7 @@ def update_panda():
|
||||
cloudlog.info("Resetting panda")
|
||||
panda.reset()
|
||||
|
||||
|
||||
def main():
|
||||
set_panda_power()
|
||||
update_panda()
|
||||
|
||||
Reference in New Issue
Block a user