From abaa9f8968df13c8a858413cc9936269702c2d60 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Fri, 19 Aug 2022 11:41:34 -0700 Subject: [PATCH] always build all projects + test libs (#1038) * always build all projects * and tests * fix that --- Jenkinsfile | 4 +-- SConstruct | 5 ++-- board/README.md | 8 ++--- board/SConscript | 75 +++++++++++++++++++++++----------------------- board/build_all.sh | 6 ---- 5 files changed, 44 insertions(+), 54 deletions(-) delete mode 100755 board/build_all.sh diff --git a/Jenkinsfile b/Jenkinsfile index 11cedd5d..75c97d09 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ pipeline { --volume /var/run/dbus:/var/run/dbus \ --net host \ ${env.DOCKER_IMAGE_TAG} \ - bash -c 'cd /tmp/panda && ./board/build_all.sh && PANDAS_JUNGLE=23002d000851393038373731 PANDAS_EXCLUDE=\"1d0002000c51303136383232 2f002e000c51303136383232\" ./tests/automated/test.sh'" + bash -c 'cd /tmp/panda && scons -j8 && PANDAS_JUNGLE=23002d000851393038373731 PANDAS_EXCLUDE=\"1d0002000c51303136383232 2f002e000c51303136383232\" ./tests/automated/test.sh'" } } } @@ -56,7 +56,7 @@ pipeline { --volume /var/run/dbus:/var/run/dbus \ --net host \ ${env.DOCKER_IMAGE_TAG} \ - bash -c 'cd /tmp/panda && ./board/build_all.sh && JUNGLE=058010800f51363038363036 H7_PANDAS_EXCLUDE=\"080021000c51303136383232\" ./tests/canfd/test_canfd.py'" + bash -c 'cd /tmp/panda && scons -j8 && JUNGLE=058010800f51363038363036 H7_PANDAS_EXCLUDE=\"080021000c51303136383232\" ./tests/canfd/test_canfd.py'" } } } diff --git a/SConstruct b/SConstruct index 1ee5df79..ba4b18dc 100644 --- a/SConstruct +++ b/SConstruct @@ -2,7 +2,8 @@ AddOption('--test', action='store_true', help='build test files') +# panda fw SConscript('board/SConscript') -if GetOption('test'): - SConscript('tests/safety/SConscript') +# test files +SConscript('tests/safety/SConscript') diff --git a/board/README.md b/board/README.md index d2ab341f..dbb84cd6 100644 --- a/board/README.md +++ b/board/README.md @@ -21,17 +21,13 @@ Programming **Panda** ``` -./flash.sh # for any pandas +./flash.sh # for any panda ``` Troubleshooting ---- -If your panda will not flash and is quickly blinking a single Green LED, use: -``` -./recover_h7.sh # for red panda -./recover.sh # for other pandas -``` +If your panda will not flash and is quickly blinking a single Green LED, use `recover.sh`. A [panda paw](https://comma.ai/shop/products/panda-paw) can be used to put panda into DFU mode. diff --git a/board/SConscript b/board/SConscript index 2fcdfeeb..ebdca130 100644 --- a/board/SConscript +++ b/board/SConscript @@ -1,4 +1,5 @@ import os +import copy import subprocess PREFIX = "arm-none-eabi-" @@ -7,25 +8,23 @@ BUILDER = "DEV" common_flags = [] build_projects = {} -if os.getenv("PEDAL"): - build_projects["pedal"] = { - "MAIN": "pedal/main.c", - "STARTUP_FILE": "stm32fx/startup_stm32f205xx.s", - "LINKER_SCRIPT": "stm32fx/stm32fx_flash.ld", - "APP_START_ADDRESS": "0x8004000", - "PROJECT_FLAGS": [ - "-mcpu=cortex-m3", - "-msoft-float", - "-DSTM32F2", - "-DSTM32F205xx", - "-O2", - "-DPEDAL", - ], - } +build_projects["pedal"] = { + "MAIN": "pedal/main.c", + "STARTUP_FILE": "stm32fx/startup_stm32f205xx.s", + "LINKER_SCRIPT": "stm32fx/stm32fx_flash.ld", + "APP_START_ADDRESS": "0x8004000", + "PROJECT_FLAGS": [ + "-mcpu=cortex-m3", + "-msoft-float", + "-DSTM32F2", + "-DSTM32F205xx", + "-O2", + "-DPEDAL", + ], +} - if os.getenv("PEDAL_USB"): - build_projects["pedal_usb"] = build_projects.pop("pedal") - build_projects["pedal_usb"]["PROJECT_FLAGS"].append("-DPEDAL_USB") +build_projects["pedal_usb"] = copy.deepcopy(build_projects["pedal"]) +build_projects["pedal_usb"]["PROJECT_FLAGS"].append("-DPEDAL_USB") build_projects["panda"] = { "MAIN": "main.c", @@ -45,25 +44,23 @@ build_projects["panda"] = { ], } -# arm-none-eabi-gcc on comma two has no cortex-m7 support -if not os.path.exists("/EON"): - build_projects["panda_h7"] = { - "MAIN": "main.c", - "STARTUP_FILE": "stm32h7/startup_stm32h7x5xx.s", - "LINKER_SCRIPT": "stm32h7/stm32h7x5_flash.ld", - "APP_START_ADDRESS": "0x8020000", - "PROJECT_FLAGS": [ - "-mcpu=cortex-m7", - "-mhard-float", - "-DSTM32H7", - "-DSTM32H725xx", - "-mfpu=fpv5-d16", - "-fsingle-precision-constant", - "-Os", - "-g", - "-DPANDA", - ], - } +build_projects["panda_h7"] = { + "MAIN": "main.c", + "STARTUP_FILE": "stm32h7/startup_stm32h7x5xx.s", + "LINKER_SCRIPT": "stm32h7/stm32h7x5_flash.ld", + "APP_START_ADDRESS": "0x8020000", + "PROJECT_FLAGS": [ + "-mcpu=cortex-m7", + "-mhard-float", + "-DSTM32H7", + "-DSTM32H725xx", + "-mfpu=fpv5-d16", + "-fsingle-precision-constant", + "-Os", + "-g", + "-DPANDA", + ], +} if os.getenv("RELEASE"): BUILD_TYPE = "RELEASE" @@ -137,6 +134,7 @@ with open("obj/cert.h", "w") as f: for cert in certs: f.write("\n".join(cert) + "\n") + for project_name in build_projects: project = build_projects[project_name] linkerscript_fn = File(project["LINKER_SCRIPT"]).srcnode().abspath @@ -169,7 +167,8 @@ for project_name in build_projects: 'Objcopy': Builder(generator=objcopy, suffix='.bin', src_suffix='.elf') } ) - startup = project_env.Object(project["STARTUP_FILE"]) + + startup = project_env.Object(f"obj/startup_{project_name}", project["STARTUP_FILE"]) # Bootstub crypto_obj = [ diff --git a/board/build_all.sh b/board/build_all.sh deleted file mode 100755 index 1c3a92de..00000000 --- a/board/build_all.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -set -e - -scons -u -j$(nproc) -PEDAL=1 scons -u -j$(nproc) -PEDAL=1 PEDAL_USB=1 scons -u -j$(nproc)