From b2a603ed21e6a3fe014be5fdcc08e3527abc8245 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Thu, 1 Aug 2024 19:45:54 +1000 Subject: [PATCH] chore: fixup missed build options, use common build options file (#5334) --- companion/src/CMakeLists.txt | 2 + .../src/firmwares/opentx/opentxinterface.cpp | 29 ---- radio/src/datastructs.h | 1 - tools/build-common.sh | 136 +++++++++++++++++ tools/build-companion.sh | 134 +---------------- tools/build-gh.sh | 141 +----------------- tools/commit-tests.sh | 113 +------------- tools/generate-hw-defs.sh | 119 +-------------- tools/generate-yaml.sh | 114 +------------- 9 files changed, 177 insertions(+), 612 deletions(-) create mode 100644 tools/build-common.sh diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index f194e151abe..8a8eef54f5c 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -306,6 +306,8 @@ elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TPRO) set(FLAVOUR tpro) elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TPROV2) set(FLAVOUR tprov2) +elseif(PCB STREQUAL X7 AND PCBREV STREQUAL TPROS) + set(FLAVOUR tpros) elseif(PCB STREQUAL X7 AND PCBREV STREQUAL T20) set(FLAVOUR t20) elseif(PCB STREQUAL X7 AND PCBREV STREQUAL T20V2) diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 8344cfe9c4d..693a01a4065 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -1410,18 +1410,6 @@ void registerOpenTxFirmwares() registerOpenTxFirmware(firmware); addOpenTxRfOptions(firmware, FLEX); - /* Jumper T-Lite F4 board */ - /* No immediate plans for this to be needed now - firmware = new OpenTxFirmware(FIRMWAREID("tlitef4"), QCoreApplication::translate("Firmware", "Jumper T-Lite (F4 MCU)"), BOARD_JUMPER_TLITE_F4, "tlitef4", "edgetx-tlite"); - addOpenTxCommonOptions(firmware); - firmware->addOption("noheli", Firmware::tr("Disable HELI menu and cyclic mix support")); - firmware->addOption("nogvars", Firmware::tr("Disable Global variables")); - firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen")); - addOpenTxFontOptions(firmware); - registerOpenTxFirmware(firmware); - addOpenTxRfOptions(firmware, FLEX); - */ - /* Jumper T-Pro board */ firmware = new OpenTxFirmware(FIRMWAREID("tpro"), QCoreApplication::translate("Firmware", "Jumper T-Pro"), BOARD_JUMPER_TPRO); addOpenTxCommonOptions(firmware); @@ -1582,23 +1570,6 @@ void registerOpenTxFirmwares() registerOpenTxFirmware(firmware); addOpenTxRfOptions(firmware, FLEX + AFHDS2A + AFHDS3); -// /* 9XR-Pro */ -// firmware = new OpenTxFirmware(FIRMWAREID("9xrpro"), Firmware::tr("Turnigy 9XR-PRO"), BOARD_9XRPRO); -// addOpenTxArm9xOptions(firmware, false); -// registerOpenTxFirmware(firmware, true); -// -// /* ar9x board */ -// firmware = new OpenTxFirmware(FIRMWAREID("ar9x"), Firmware::tr("9X with AR9X board"), BOARD_AR9X); -// addOpenTxArm9xOptions(firmware, true); -// //firmware->addOption("rtc", Firmware::tr("Optional RTC added")); -// //firmware->addOption("volume", Firmware::tr("i2c volume control added")); -// registerOpenTxFirmware(firmware, true); -// -// /* Sky9x board */ -// firmware = new OpenTxFirmware(FIRMWAREID("sky9x"), Firmware::tr("9X with Sky9x board"), BOARD_SKY9X); -// addOpenTxArm9xOptions(firmware); -// registerOpenTxFirmware(firmware, true); - Firmware::sortRegisteredFirmwares(); Firmware::setDefaultVariant(Firmware::getFirmwareForFlavour("tx16s")); Firmware::setCurrentVariant(Firmware::getDefaultVariant()); diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index b0f3c957a11..48b62c40518 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -93,7 +93,6 @@ static inline void check_struct() #if defined(RADIO_TPRO) || defined(RADIO_TPROV2) CHKSIZE(ModelData, 6354); #elif defined(RADIO_T14) || defined(RADIO_T12MAX) - CHKSIZE(RadioData, 869); CHKSIZE(ModelData, 6329); #elif defined(RADIO_FAMILY_T20) CHKSIZE(ModelData, 6390); diff --git a/tools/build-common.sh b/tools/build-common.sh new file mode 100644 index 00000000000..3b18366943f --- /dev/null +++ b/tools/build-common.sh @@ -0,0 +1,136 @@ +get_target_build_options() { + local target_name=$1 + + case $target_name in + x9lite) + BUILD_OPTIONS+="-DPCB=X9LITE" + ;; + x9lites) + BUILD_OPTIONS+="-DPCB=X9LITES" + ;; + x7) + BUILD_OPTIONS+="-DPCB=X7" + ;; + x7access) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ACCESS -DPXX1=YES" + ;; + t12) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12 -DINTERNAL_MODULE_MULTI=ON" + ;; + tx12) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12" + ;; + tx12mk2) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2" + ;; + boxer) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=BOXER" + ;; + t8) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T8" + ;; + zorro) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ZORRO" + ;; + pocket) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=POCKET" + ;; + mt12) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=MT12" + ;; + tlite) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITE" + ;; + tlitef4) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITEF4" + ;; + tpro) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPRO" + ;; + tprov2) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROV2" + ;; + tpros) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROS" + ;; + t20) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20" + ;; + t12max) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12MAX" + ;; + t14) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T14" + ;; + t20v2) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20V2" + ;; + lr3pro) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=LR3PRO" + ;; + commando8) + BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=COMMANDO8" + ;; + xlite) + BUILD_OPTIONS+="-DPCB=XLITE" + ;; + xlites) + BUILD_OPTIONS+="-DPCB=XLITES" + ;; + x9d) + BUILD_OPTIONS+="-DPCB=X9D" + ;; + x9dp) + BUILD_OPTIONS+="-DPCB=X9D+" + ;; + x9dp2019) + BUILD_OPTIONS+="-DPCB=X9D+ -DPCBREV=2019" + ;; + x9e) + BUILD_OPTIONS+="-DPCB=X9E" + ;; + x9e-hall) + BUILD_OPTIONS+="-DPCB=X9E -DSTICKS=HORUS" + ;; + x10) + BUILD_OPTIONS+="-DPCB=X10" + ;; + x10express) + BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=EXPRESS -DPXX1=YES" + ;; + x12s) + BUILD_OPTIONS+="-DPCB=X12S" + ;; + t15) + BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T15 -DINTERNAL_MODULE_CRSF=ON" + ;; + t16) + BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T16 -DINTERNAL_MODULE_MULTI=ON" + ;; + t18) + BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T18" + ;; + tx16s) + BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=TX16S" + ;; + f16) + BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=F16" + ;; + nv14) + BUILD_OPTIONS+="-DPCB=NV14" + ;; + el18) + BUILD_OPTIONS+="-DPCB=NV14 -DPCBREV=EL18" + ;; + pl18) + BUILD_OPTIONS+="-DPCB=PL18" + ;; + pl18ev) + BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=PL18EV" + ;; + *) + echo "Unknown target: $target_name" + return 1 + ;; + esac +} diff --git a/tools/build-companion.sh b/tools/build-companion.sh index 39675c19902..19f5c1ea8f9 100755 --- a/tools/build-companion.sh +++ b/tools/build-companion.sh @@ -4,6 +4,9 @@ set -e set -x +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +. "$SCRIPT_DIR/build-common.sh" + if [ "$(uname)" = "Darwin" ]; then num_cpus=$(sysctl -n hw.ncpu) : "${JOBS:=$num_cpus}" @@ -79,132 +82,11 @@ do BUILD_OPTIONS="${COMMON_OPTIONS} " echo "Building ${plugin}" - case $plugin in - x9lite) - BUILD_OPTIONS+="-DPCB=X9LITE" - ;; - x9lites) - BUILD_OPTIONS+="-DPCB=X9LITES" - ;; - x7) - BUILD_OPTIONS+="-DPCB=X7" - ;; - x7access) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ACCESS -DPXX1=YES" - ;; - t12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12 -DINTERNAL_MODULE_MULTI=ON" - ;; - tx12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12" - ;; - tx12mk2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2" - ;; - t8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T8" - ;; - zorro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ZORRO" - ;; - pocket) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=POCKET" - ;; - boxer) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=BOXER" - ;; - lr3pro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=LR3PRO" - ;; - tlite) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITE" - ;; - tlitef4) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITEF4" - ;; - tpro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPRO" - ;; - tprov2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROV2" - ;; - tpros) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROS" - ;; - t20) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20" - ;; - t12max) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12MAX" - ;; - t14) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T14" - ;; - t20v2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20V2" - ;; - xlite) - BUILD_OPTIONS+="-DPCB=XLITE" - ;; - xlites) - BUILD_OPTIONS+="-DPCB=XLITES" - ;; - x9d) - BUILD_OPTIONS+="-DPCB=X9D" - ;; - x9dp) - BUILD_OPTIONS+="-DPCB=X9D+" - ;; - x9dp2019) - BUILD_OPTIONS+="-DPCB=X9D+ -DPCBREV=2019" - ;; - x9e) - BUILD_OPTIONS+="-DPCB=X9E" - ;; - x10) - BUILD_OPTIONS+="-DPCB=X10" - ;; - x10express) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=EXPRESS -DPXX1=YES" - ;; - x12s) - BUILD_OPTIONS+="-DPCB=X12S" - ;; - t15) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T15 -DINTERNAL_MODULE_CRSF=ON" - ;; - t16) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T16 -DINTERNAL_MODULE_MULTI=ON" - ;; - t18) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T18" - ;; - tx16s) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=TX16S" - ;; - f16) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=F16" - ;; - nv14) - BUILD_OPTIONS+="-DPCB=NV14" - ;; - el18) - BUILD_OPTIONS+="-DPCB=NV14 -DPCBREV=EL18" - ;; - commando8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=COMMANDO8" - ;; - pl18) - BUILD_OPTIONS+="-DPCB=PL18" - ;; - pl18ev) - BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=PL18EV" - ;; - *) - echo "Unknown target: $target_name" - exit 1 - ;; - esac + + if ! get_target_build_options "$plugin"; then + echo "Error: Failed to find a match for target '$plugin'" + exit 1 + fi rm -f CMakeCache.txt native/CMakeCache.txt cmake ${BUILD_OPTIONS} "${SRCDIR}" diff --git a/tools/build-gh.sh b/tools/build-gh.sh index 22c3649ba77..2d137167132 100755 --- a/tools/build-gh.sh +++ b/tools/build-gh.sh @@ -4,6 +4,9 @@ set -e set -x +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +. "$SCRIPT_DIR/build-common.sh" + # Allow variable core usage # default uses all cpu cores # @@ -90,139 +93,11 @@ do BUILD_OPTIONS=${COMMON_OPTIONS} echo "Building ${fw_name}" - case $target_name in - - x9lite) - BUILD_OPTIONS+="-DPCB=X9LITE" - ;; - x9lites) - BUILD_OPTIONS+="-DPCB=X9LITES" - ;; - x7) - BUILD_OPTIONS+="-DPCB=X7" - ;; - x7access) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ACCESS -DPXX1=YES" - ;; - t12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12 -DINTERNAL_MODULE_MULTI=ON" - ;; - tx12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12" - ;; - tx12mk2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2" - ;; - boxer) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=BOXER" - ;; - t8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T8" - ;; - zorro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ZORRO" - ;; - pocket) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=POCKET" - ;; - mt12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=MT12" - ;; - tlite) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITE" - ;; - tlitef4) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITEF4" - ;; - tpro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPRO" - ;; - tprov2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROV2" - ;; - tpros) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROS" - ;; - t20) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20" - ;; - t12max) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12MAX" - ;; - t14) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T14" - ;; - t20v2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20V2" - ;; - lr3pro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=LR3PRO" - ;; - xlite) - BUILD_OPTIONS+="-DPCB=XLITE" - ;; - xlites) - BUILD_OPTIONS+="-DPCB=XLITES" - ;; - x9d) - BUILD_OPTIONS+="-DPCB=X9D" - ;; - x9dp) - BUILD_OPTIONS+="-DPCB=X9D+" - ;; - x9dp2019) - BUILD_OPTIONS+="-DPCB=X9D+ -DPCBREV=2019" - ;; - x9e) - BUILD_OPTIONS+="-DPCB=X9E" - ;; - x9e-hall) - BUILD_OPTIONS+="-DPCB=X9E -DSTICKS=HORUS" - ;; - x10) - BUILD_OPTIONS+="-DPCB=X10" - ;; - x10express) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=EXPRESS -DPXX1=YES" - ;; - x12s) - BUILD_OPTIONS+="-DPCB=X12S" - ;; - t15) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T15 -DINTERNAL_MODULE_CRSF=ON" - ;; - t16) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T16 -DINTERNAL_MODULE_MULTI=ON" - ;; - t18) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T18" - ;; - tx16s) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=TX16S" - ;; - f16) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=F16" - ;; - nv14) - BUILD_OPTIONS+="-DPCB=NV14" - ;; - el18) - BUILD_OPTIONS+="-DPCB=NV14 -DPCBREV=EL18" - ;; - pl18) - BUILD_OPTIONS+="-DPCB=PL18" - ;; - pl18ev) - BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=PL18EV" - ;; - commando8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=COMMANDO8" - ;; - *) - echo "Unknown target: $target_name" - exit 1 - ;; - esac + + if ! get_target_build_options "$target_name"; then + echo "Error: Failed to find a match for target '$target_name'" + exit 1 + fi cmake ${BUILD_OPTIONS} "${SRCDIR}" cmake --build . --target arm-none-eabi-configure diff --git a/tools/commit-tests.sh b/tools/commit-tests.sh index 6af91a6d525..c5ce23576c0 100755 --- a/tools/commit-tests.sh +++ b/tools/commit-tests.sh @@ -4,6 +4,9 @@ set -e set -x +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +. "$SCRIPT_DIR/build-common.sh" + # Allow variable core usage # default uses all cpu cores # @@ -68,111 +71,11 @@ do BUILD_OPTIONS=${COMMON_OPTIONS} echo "Testing ${target_name}" - case $target_name in - - x9lite) - BUILD_OPTIONS+="-DPCB=X9LITE" - ;; - x9lites) - BUILD_OPTIONS+="-DPCB=X9LITES" - ;; - x7) - BUILD_OPTIONS+="-DPCB=X7" - ;; - x7access) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ACCESS -DPXX1=YES" - ;; - t12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12 -DINTERNAL_MODULE_MULTI=ON" - ;; - mt12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=MT12 -DINTERNAL_MODULE_MULTI=ON" - ;; - tx12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12" - ;; - tx12mk2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2" - ;; - t8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T8" - ;; - lr3pro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=LR3PRO" - ;; - tlite) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITE" - ;; - tlitef4) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITEF4" - ;; - t20) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20" - ;; - t12max) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12MAX" - ;; - t14) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T14" - ;; - t20v2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20V2" - ;; - xlite) - BUILD_OPTIONS+="-DPCB=XLITE" - ;; - xlites) - BUILD_OPTIONS+="-DPCB=XLITES" - ;; - x9d) - BUILD_OPTIONS+="-DPCB=X9D" - ;; - x9dp) - BUILD_OPTIONS+="-DPCB=X9D+" - ;; - x9dp2019) - BUILD_OPTIONS+="-DPCB=X9D+ -DPCBREV=2019" - ;; - x9e) - BUILD_OPTIONS+="-DPCB=X9E" - ;; - x10) - BUILD_OPTIONS+="-DPCB=X10" - ;; - x10express) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=EXPRESS -DPXX1=YES" - ;; - x12s) - BUILD_OPTIONS+="-DPCB=X12S" - ;; - t15) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T15 -DINTERNAL_MODULE_CRSF=ON" - ;; - t16) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T16 -DINTERNAL_MODULE_MULTI=ON" - ;; - t18) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T18" - ;; - tx16s) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=TX16S" - ;; - nv14) - BUILD_OPTIONS+="-DPCB=NV14" - ;; - el18) - BUILD_OPTIONS+="-DPCB=NV14 -DPCBREV=EL18" - ;; - pl18) - BUILD_OPTIONS+="-DPCB=PL18" - ;; - pl18ev) - BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=PL18EV" - ;; - commando8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=COMMANDO8" - ;; - esac + + if ! get_target_build_options "$target_name"; then + echo "Error: Failed to find a match for target '$target_name'" + exit 1 + fi cmake ${BUILD_OPTIONS} "${SRCDIR}" diff --git a/tools/generate-hw-defs.sh b/tools/generate-hw-defs.sh index 2b60225f2ed..0d38d5f4304 100755 --- a/tools/generate-hw-defs.sh +++ b/tools/generate-hw-defs.sh @@ -4,9 +4,12 @@ set -e # set -x +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +. "$SCRIPT_DIR/build-common.sh" + : "${SRCDIR:=$(dirname "$(pwd)/$0")/..}" -: ${FLAVOR:="nv14;t12;t12max;t15;t16;t18;t8;zorro;pocket;commando8;tlite;tpro;tprov2;tpros;t20;t20v2;t14;lr3pro;mt12;tx12;tx12mk2;boxer;tx16s;x10;x10express;x12s;x7;x7access;x9d;x9dp;x9dp2019;x9e;x9lite;x9lites;xlite;xlites"} +: ${FLAVOR:="nv14;el18;t12;t12max;t15;t16;t18;t8;zorro;pocket;commando8;tlite;tpro;tprov2;tpros;t20;t20v2;t14;lr3pro;mt12;tx12;tx12mk2;boxer;tx16s;x10;x10express;x12s;x7;x7access;x9d;x9dp;x9dp2019;x9e;x9lite;x9lites;xlite;xlites;f16"} : ${COMMON_OPTIONS:="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DCMAKE_MESSAGE_LOG_LEVEL=WARNING"} # wipe build directory clean @@ -22,117 +25,11 @@ do BUILD_OPTIONS+=" $EXTRA_OPTIONS " echo "Processing ${target_name}" - case $target_name in - x9lite) - BUILD_OPTIONS+="-DPCB=X9LITE" - ;; - x9lites) - BUILD_OPTIONS+="-DPCB=X9LITES" - ;; - x7) - BUILD_OPTIONS+="-DPCB=X7" - ;; - x7access) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ACCESS -DPXX1=YES" - ;; - t12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12 -DINTERNAL_MODULE_MULTI=ON" - ;; - mt12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=MT12 -DINTERNAL_MODULE_MULTI=ON" - ;; - tx12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12" - ;; - tx12mk2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2" - ;; - boxer) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=BOXER" - ;; - t8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T8" - ;; - zorro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ZORRO" - ;; - pocket) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=POCKET" - ;; - tlite) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITE" - ;; - tpro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPRO" - ;; - tprov2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROV2" - ;; - tpros) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPROS" - ;; - t20) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20" - ;; - t12max) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12MAX" - ;; - t14) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T14" - ;; - t20v2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20V2" - ;; - lr3pro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=LR3PRO" - ;; - xlite) - BUILD_OPTIONS+="-DPCB=XLITE" - ;; - xlites) - BUILD_OPTIONS+="-DPCB=XLITES" - ;; - x9d) - BUILD_OPTIONS+="-DPCB=X9D" - ;; - x9dp) - BUILD_OPTIONS+="-DPCB=X9D+" - ;; - x9dp2019) - BUILD_OPTIONS+="-DPCB=X9D+ -DPCBREV=2019" - ;; - x9e) - BUILD_OPTIONS+="-DPCB=X9E" - ;; - x10) - BUILD_OPTIONS+="-DPCB=X10" - ;; - x10express) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=EXPRESS -DPXX1=YES" - ;; - x12s) - BUILD_OPTIONS+="-DPCB=X12S" - ;; - t15) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T15 -DINTERNAL_MODULE_CRSF=ON" - ;; - t16) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T16 -DINTERNAL_MODULE_MULTI=ON" - ;; - t18) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T18" - ;; - tx16s) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=TX16S" - ;; - nv14) - BUILD_OPTIONS+="-DPCB=NV14" - ;; - commando8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=COMMANDO8" - ;; - esac + if ! get_target_build_options "$target_name"; then + echo "Error: Failed to find a match for target '$target_name'" + exit 1 + fi cmake ${BUILD_OPTIONS} "${SRCDIR}" cmake --build . --target arm-none-eabi-configure diff --git a/tools/generate-yaml.sh b/tools/generate-yaml.sh index 0bb695cba69..fe0d3be4331 100755 --- a/tools/generate-yaml.sh +++ b/tools/generate-yaml.sh @@ -3,6 +3,9 @@ # Stops on first error set -e +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +. "$SCRIPT_DIR/build-common.sh" + # Add GCC_ARM to PATH if [[ -n ${GCC_ARM} ]] ; then export PATH=${GCC_ARM}:$PATH @@ -24,114 +27,11 @@ do BUILD_OPTIONS+=" $EXTRA_OPTIONS " echo "Generating YAML structures for ${target_name}" - case $target_name in - x9lite) - BUILD_OPTIONS+="-DPCB=X9LITE" - ;; - x9lites) - BUILD_OPTIONS+="-DPCB=X9LITES" - ;; - x7) - BUILD_OPTIONS+="-DPCB=X7" - ;; - x7access) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ACCESS -DPXX1=YES" - ;; - t12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12 -DINTERNAL_MODULE_MULTI=ON" - ;; - tx12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12" - ;; - tx12mk2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TX12MK2" - ;; - boxer) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=BOXER" - ;; - zorro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=ZORRO" - ;; - pocket) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=POCKET" - ;; - mt12) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=MT12" - ;; - lr3pro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=LR3PRO" - ;; - t8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T8" - ;; - tlite) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TLITE" - ;; - tpro) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=TPRO" - ;; - t20) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20" - ;; - t20v2) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T20V2" - ;; - t12max) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T12MAX" - ;; - t14) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=T14" - ;; - xlite) - BUILD_OPTIONS+="-DPCB=XLITE" - ;; - xlites) - BUILD_OPTIONS+="-DPCB=XLITES" - ;; - x9d) - BUILD_OPTIONS+="-DPCB=X9D" - ;; - x9dp) - BUILD_OPTIONS+="-DPCB=X9D+" - ;; - x9dp2019) - BUILD_OPTIONS+="-DPCB=X9D+ -DPCBREV=2019" - ;; - x9e) - BUILD_OPTIONS+="-DPCB=X9E" - ;; - x10) - BUILD_OPTIONS+="-DPCB=X10" - ;; - x10express) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=EXPRESS -DPXX1=YES" - ;; - x12s) - BUILD_OPTIONS+="-DPCB=X12S" - ;; - t15) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T15 -DINTERNAL_MODULE_CRSF=ON" - ;; - t16) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T16 -DINTERNAL_MODULE_MULTI=ON" - ;; - t18) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=T18" - ;; - tx16s) - BUILD_OPTIONS+="-DPCB=X10 -DPCBREV=TX16S -DINTERNAL_GPS=ON" - ;; - nv14) - BUILD_OPTIONS+="-DPCB=NV14" - ;; - pl18) - BUILD_OPTIONS+="-DPCB=PL18" - ;; - commando8) - BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=COMMANDO8" - ;; - esac + if ! get_target_build_options "$target_name"; then + echo "Error: Failed to find a match for target '$target_name'" + exit 1 + fi cmake ${BUILD_OPTIONS} "${SRCDIR}" make native-configure