mirror of https://github.com/commaai/openpilot.git
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
This commit is contained in:
parent
7ee79c9923
commit
0e338d2b91
|
@ -14,6 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
cppcheck \
|
cppcheck \
|
||||||
curl \
|
curl \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
gcc-arm-none-eabi \
|
||||||
git \
|
git \
|
||||||
iputils-ping \
|
iputils-ping \
|
||||||
libarchive-dev \
|
libarchive-dev \
|
||||||
|
|
|
@ -357,6 +357,7 @@ Export('common', 'gpucommon', 'visionipc')
|
||||||
# Build openpilot
|
# Build openpilot
|
||||||
|
|
||||||
SConscript(['cereal/SConscript'])
|
SConscript(['cereal/SConscript'])
|
||||||
|
SConscript(['panda/board/SConscript'])
|
||||||
SConscript(['opendbc/can/SConscript'])
|
SConscript(['opendbc/can/SConscript'])
|
||||||
|
|
||||||
SConscript(['phonelibs/SConscript'])
|
SConscript(['phonelibs/SConscript'])
|
||||||
|
|
2
panda
2
panda
|
@ -1 +1 @@
|
||||||
Subproject commit d572c012cb9f3f421d1556b37a1d3f18b5366b06
|
Subproject commit a8917adcdf5b122ffd04f3734de9e0339531f181
|
|
@ -64,16 +64,6 @@ git commit -a -m "openpilot v$VERSION release"
|
||||||
# Run build
|
# Run build
|
||||||
SCONS_CACHE=1 scons -j3
|
SCONS_CACHE=1 scons -j3
|
||||||
|
|
||||||
echo "[-] testing panda build T=$SECONDS"
|
|
||||||
pushd panda/board/
|
|
||||||
make bin
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo "[-] testing pedal build T=$SECONDS"
|
|
||||||
pushd panda/board/pedal
|
|
||||||
make obj/comma.bin
|
|
||||||
popd
|
|
||||||
|
|
||||||
if [ ! -z "$CI_PUSH" ]; then
|
if [ ! -z "$CI_PUSH" ]; then
|
||||||
echo "[-] Pushing to $CI_PUSH T=$SECONDS"
|
echo "[-] Pushing to $CI_PUSH T=$SECONDS"
|
||||||
git remote set-url origin git@github.com:commaai/openpilot.git
|
git remote set-url origin git@github.com:commaai/openpilot.git
|
||||||
|
|
|
@ -41,13 +41,9 @@ echo "#define COMMA_VERSION \"$VERSION-release\"" > selfdrive/common/version.h
|
||||||
git commit -m "openpilot v$VERSION"
|
git commit -m "openpilot v$VERSION"
|
||||||
|
|
||||||
# Build signed panda firmware
|
# Build signed panda firmware
|
||||||
pushd panda/board/
|
pushd panda/
|
||||||
cp -r /tmp/pandaextra /data/openpilot/
|
CERT=/tmp/pandaextra/certs/release RELEASE=1 scons
|
||||||
RELEASE=1 make obj/panda.bin
|
mv board/obj/panda.bin.signed /tmp/panda.bin.signed
|
||||||
mv obj/panda.bin /tmp/panda.bin
|
|
||||||
make clean
|
|
||||||
mv /tmp/panda.bin obj/panda.bin.signed
|
|
||||||
rm -rf /data/openpilot/pandaextra
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Build stuff
|
# Build stuff
|
||||||
|
@ -65,8 +61,13 @@ find . -name '*.o' -delete
|
||||||
find . -name '*.os' -delete
|
find . -name '*.os' -delete
|
||||||
find . -name '*.pyc' -delete
|
find . -name '*.pyc' -delete
|
||||||
find . -name '__pycache__' -delete
|
find . -name '__pycache__' -delete
|
||||||
|
rm -rf panda/board panda/certs panda/crypto
|
||||||
rm -rf .sconsign.dblite Jenkinsfile release/
|
rm -rf .sconsign.dblite Jenkinsfile release/
|
||||||
|
|
||||||
|
# Move back signed panda fw
|
||||||
|
mkdir -p panda/board/obj
|
||||||
|
mv /tmp/panda.bin.signed panda/board/obj/panda.bin.signed
|
||||||
|
|
||||||
# Restore phonelibs
|
# Restore phonelibs
|
||||||
git checkout phonelibs/
|
git checkout phonelibs/
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,9 @@ git status
|
||||||
git commit -a -m "openpilot v$VERSION release"
|
git commit -a -m "openpilot v$VERSION release"
|
||||||
|
|
||||||
# Build panda firmware
|
# Build panda firmware
|
||||||
pushd panda/board/
|
pushd panda/
|
||||||
make obj/panda.bin
|
scons
|
||||||
mv obj/panda.bin /tmp/panda.bin
|
mv board/obj/panda.bin.signed /tmp/panda.bin.signed
|
||||||
make clean
|
|
||||||
mv /tmp/panda.bin obj/panda.bin
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
|
@ -79,8 +77,13 @@ find . -name '*.o' -delete
|
||||||
find . -name '*.os' -delete
|
find . -name '*.os' -delete
|
||||||
find . -name '*.pyc' -delete
|
find . -name '*.pyc' -delete
|
||||||
find . -name '__pycache__' -delete
|
find . -name '__pycache__' -delete
|
||||||
|
rm -rf panda/board panda/certs panda/crypto
|
||||||
rm -rf .sconsign.dblite Jenkinsfile release/ apk/
|
rm -rf .sconsign.dblite Jenkinsfile release/ apk/
|
||||||
|
|
||||||
|
# Move back signed panda fw
|
||||||
|
mkdir -p panda/board/obj
|
||||||
|
mv /tmp/panda.bin.signed panda/board/obj/panda.bin.signed
|
||||||
|
|
||||||
# Restore phonelibs
|
# Restore phonelibs
|
||||||
git checkout phonelibs/
|
git checkout phonelibs/
|
||||||
|
|
||||||
|
|
|
@ -513,7 +513,6 @@ panda/__init__.py
|
||||||
panda/VERSION
|
panda/VERSION
|
||||||
panda/board/**
|
panda/board/**
|
||||||
panda/certs/**
|
panda/certs/**
|
||||||
panda/common/**
|
|
||||||
panda/crypto/**
|
panda/crypto/**
|
||||||
panda/python/**
|
panda/python/**
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ os.environ['FAKEUPLOAD'] = "1"
|
||||||
|
|
||||||
# TODO: make eon fast
|
# TODO: make eon fast
|
||||||
MAX_STARTUP_TIME = 30 if EON else 15
|
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):
|
class TestManager(unittest.TestCase):
|
||||||
|
@ -42,7 +42,7 @@ class TestManager(unittest.TestCase):
|
||||||
for p in ALL_PROCESSES:
|
for p in ALL_PROCESSES:
|
||||||
managed_processes[p].start()
|
managed_processes[p].start()
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(30)
|
||||||
|
|
||||||
for p in reversed(ALL_PROCESSES):
|
for p in reversed(ALL_PROCESSES):
|
||||||
exit_code = managed_processes[p].stop(retry=False)
|
exit_code = managed_processes[p].stop(retry=False)
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
import os
|
import os
|
||||||
import time
|
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.basedir import BASEDIR
|
||||||
from common.gpio import gpio_init, gpio_set
|
from common.gpio import gpio_init, gpio_set
|
||||||
from selfdrive.hardware import TICI
|
from selfdrive.hardware import TICI
|
||||||
from selfdrive.hardware.tici.pins import GPIO_HUB_RST_N, GPIO_STM_BOOT0, GPIO_STM_RST_N
|
from selfdrive.hardware.tici.pins import GPIO_HUB_RST_N, GPIO_STM_BOOT0, GPIO_STM_RST_N
|
||||||
from selfdrive.swaglog import cloudlog
|
from selfdrive.swaglog import cloudlog
|
||||||
|
|
||||||
|
PANDA_FW_FN = os.path.join(PANDA_BASEDIR, "board", "obj", "panda.bin.signed")
|
||||||
|
|
||||||
|
|
||||||
def set_panda_power(power=True):
|
def set_panda_power(power=True):
|
||||||
if not TICI:
|
if not TICI:
|
||||||
return
|
return
|
||||||
|
@ -25,24 +28,9 @@ def set_panda_power(power=True):
|
||||||
gpio_set(GPIO_STM_RST_N, not power)
|
gpio_set(GPIO_STM_RST_N, not power)
|
||||||
|
|
||||||
|
|
||||||
def get_firmware_fn():
|
def get_expected_signature():
|
||||||
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()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return Panda.get_signature_from_firmware(fw_fn)
|
return Panda.get_signature_from_firmware(PANDA_FW_FN)
|
||||||
except Exception:
|
except Exception:
|
||||||
cloudlog.exception("Error computing expected signature")
|
cloudlog.exception("Error computing expected signature")
|
||||||
return b""
|
return b""
|
||||||
|
@ -71,8 +59,7 @@ def update_panda():
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
fw_fn = get_firmware_fn()
|
fw_signature = get_expected_signature()
|
||||||
fw_signature = get_expected_signature(fw_fn)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
serial = panda.get_serial()[0].decode("utf-8")
|
serial = panda.get_serial()[0].decode("utf-8")
|
||||||
|
@ -90,7 +77,7 @@ def update_panda():
|
||||||
|
|
||||||
if panda.bootstub or panda_signature != fw_signature:
|
if panda.bootstub or panda_signature != fw_signature:
|
||||||
cloudlog.info("Panda firmware out of date, update required")
|
cloudlog.info("Panda firmware out of date, update required")
|
||||||
panda.flash(fw_fn)
|
panda.flash()
|
||||||
cloudlog.info("Done flashing")
|
cloudlog.info("Done flashing")
|
||||||
|
|
||||||
if panda.bootstub:
|
if panda.bootstub:
|
||||||
|
@ -111,6 +98,7 @@ def update_panda():
|
||||||
cloudlog.info("Resetting panda")
|
cloudlog.info("Resetting panda")
|
||||||
panda.reset()
|
panda.reset()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
set_panda_power()
|
set_panda_power()
|
||||||
update_panda()
|
update_panda()
|
||||||
|
|
|
@ -20,6 +20,7 @@ brew "openssl"
|
||||||
brew "pyenv"
|
brew "pyenv"
|
||||||
brew "qt@5"
|
brew "qt@5"
|
||||||
brew "zeromq"
|
brew "zeromq"
|
||||||
|
cask "gcc-arm-embedded"
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
if [[ $SHELL == "/bin/zsh" ]]; then
|
if [[ $SHELL == "/bin/zsh" ]]; then
|
||||||
|
|
Loading…
Reference in New Issue