From f2fb76a26df1784d9d89af4b97a5f86a3009f854 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Thu, 19 Sep 2024 09:27:57 +1000 Subject: [PATCH] AP_Common: remove CxVersion stuff Replace with defining in hwdef.dat with a version.inc file. For SITL, this define is added in the command-line instead. --- .github/workflows/carbonix_build.yml | 2 +- Tools/AP_Periph/AP_Periph.h | 1 - Tools/Carbonix_scripts/carbonix_waf_build.sh | 6 +++--- Tools/scripts/cygwin_build.sh | 15 ++++++++------- libraries/AP_Common/AP_FWVersion.h | 1 - libraries/AP_Common/CxVersion.h | 5 ----- .../hwdef/CarbonixCommon/cubeorange.inc | 1 + .../hwdef/CarbonixCommon/version.inc | 1 + .../AP_HAL_ChibiOS/hwdef/CarbonixF405/hwdef.dat | 2 ++ 9 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 libraries/AP_Common/CxVersion.h create mode 100644 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc diff --git a/.github/workflows/carbonix_build.yml b/.github/workflows/carbonix_build.yml index 816fe59ba3..0a503f4b58 100644 --- a/.github/workflows/carbonix_build.yml +++ b/.github/workflows/carbonix_build.yml @@ -310,7 +310,7 @@ jobs: - name: Extract firmware version, commit id, and branch name id: extract_info run: | - FIRMWARE_VERSION=$(grep -oP '#define AP_CUSTOM_FIRMWARE_STRING "\K(.*)(?=")' libraries/AP_Common/CxVersion.h) + FIRMWARE_VERSION=$(grep -oP 'define AP_CUSTOM_FIRMWARE_STRING "\K(.*)(?=")' libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc) COMMIT_ID=$(git rev-parse --short HEAD) BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) echo "firmware_version=$FIRMWARE_VERSION" >> $GITHUB_ENV diff --git a/Tools/AP_Periph/AP_Periph.h b/Tools/AP_Periph/AP_Periph.h index 63ced7a426..afa3d7fcbb 100644 --- a/Tools/AP_Periph/AP_Periph.h +++ b/Tools/AP_Periph/AP_Periph.h @@ -44,7 +44,6 @@ #include #endif #include -#include #ifdef HAL_PERIPH_ENABLE_RELAY #ifdef HAL_PERIPH_ENABLE_PWM_HARDPOINT diff --git a/Tools/Carbonix_scripts/carbonix_waf_build.sh b/Tools/Carbonix_scripts/carbonix_waf_build.sh index ab98176e22..cc3ec8a690 100755 --- a/Tools/Carbonix_scripts/carbonix_waf_build.sh +++ b/Tools/Carbonix_scripts/carbonix_waf_build.sh @@ -9,7 +9,7 @@ echo "Running distclean..." main_boards=("CubeOrange" "CubeOrange-Volanti" "CubeOrange-Ottano") for board in "${main_boards[@]}"; do echo "Compiling ArduPlane for $board..." - ./waf configure --board "$board" --define=CARBOPILOT=1 + ./waf configure --board "$board" ./waf plane done @@ -29,7 +29,7 @@ for board in "${periph_boards[@]}"; do # Compile AP_Periph for each board echo "Compiling AP_Periph for $board with $filename..." - ./waf configure --board "$board" --define=CARBOPILOT=1 --extra-hwdef=temp.hwdef --default-parameters="$file" + ./waf configure --board "$board" --extra-hwdef=temp.hwdef --default-parameters="$file" ./waf AP_Periph # Rename build outputs @@ -47,7 +47,7 @@ done # Build all Default periph board for board in "${periph_boards[@]}"; do echo "Compiling AP_Periph for $board..." - ./waf configure --board "$board" --define=CARBOPILOT=1 + ./waf configure --board "$board" ./waf AP_Periph done diff --git a/Tools/scripts/cygwin_build.sh b/Tools/scripts/cygwin_build.sh index e577703926..53b3f0086e 100755 --- a/Tools/scripts/cygwin_build.sh +++ b/Tools/scripts/cygwin_build.sh @@ -8,6 +8,10 @@ set -x +# Get Carbonix version number +FIRMWARE_VERSION=$(grep -oP 'define AP_CUSTOM_FIRMWARE_STRING "\K(.*)(?=")' libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc) +COMMIT_ID=$(git rev-parse --short HEAD) + # TOOLCHAIN=i686-pc-cygwin TOOLCHAIN=x86_64-pc-cygwin GPP_COMPILER="${TOOLCHAIN}-g++" @@ -21,7 +25,7 @@ rm -rf artifacts mkdir artifacts ( - python ./waf --color yes --toolchain $TOOLCHAIN --board sitl configure --define CARBOPILOT=1 2>&1 + python ./waf --color yes --toolchain $TOOLCHAIN --board sitl configure --define AP_CUSTOM_FIRMWARE_STRING=\"$FIRMWARE_VERSION\" 2>&1 python ./waf plane 2>&1 ) | tee artifacts/build.txt # python ./waf copter 2>&1 @@ -29,12 +33,9 @@ mkdir artifacts # python ./waf rover 2>&1 # python ./waf sub 2>&1 -# Get Carbonix version number to name the exe file -FIRMWARE_VERSION=$(grep -oP '#define AP_CUSTOM_FIRMWARE_STRING "\K(.*)(?=")' libraries/AP_Common/CxVersion.h)-$(git rev-parse --short HEAD) - # copy both with exe and without to cope with differences # between windows versions in CI -cp -v build/sitl/bin/arduplane artifacts/${FIRMWARE_VERSION}.exe +cp -v build/sitl/bin/arduplane artifacts/${FIRMWARE_VERSION}-${COMMIT_ID}.exe # cp -v build/sitl/bin/arduplane artifacts/ArduPlane.elf.exe # cp -v build/sitl/bin/arducopter artifacts/ArduCopter.elf.exe @@ -60,7 +61,7 @@ done # Process Carbonix SITL parameters for file in libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/sitl_params/*.parm do - destfolder=artifacts/$(basename $file .parm)-${FIRMWARE_VERSION} + destfolder=artifacts/$(basename $file .parm)-${FIRMWARE_VERSION}-${COMMIT_ID} mkdir -p $destfolder outfile=$destfolder/defaults.parm echo "Processing $(basename $file)" @@ -74,7 +75,7 @@ do else model="quadplane" fi - printf "rem Launch at Eli Field\r\n..\\${FIRMWARE_VERSION}.exe -O 40.0594626,-88.5513292,206.0,0 --serial0 tcp:0 -M ${model} --defaults defaults.parm\r\n" > $destfolder/launch.bat + printf "rem Launch at Eli Field\r\n..\\${FIRMWARE_VERSION}-${COMMIT_ID}.exe -O 40.0594626,-88.5513292,206.0,0 --serial0 tcp:0 -M ${model} --defaults defaults.parm\r\n" > $destfolder/launch.bat done git log -1 > artifacts/git.txt diff --git a/libraries/AP_Common/AP_FWVersion.h b/libraries/AP_Common/AP_FWVersion.h index 0fdc3f22ae..95a7eb50d1 100644 --- a/libraries/AP_Common/AP_FWVersion.h +++ b/libraries/AP_Common/AP_FWVersion.h @@ -3,7 +3,6 @@ #include #include #include -#include class PACKED AP_FWVersion { diff --git a/libraries/AP_Common/CxVersion.h b/libraries/AP_Common/CxVersion.h deleted file mode 100644 index 2029420adb..0000000000 --- a/libraries/AP_Common/CxVersion.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef CARBOPILOT -#ifndef AP_CUSTOM_FIRMWARE_STRING -#define AP_CUSTOM_FIRMWARE_STRING "CxPilot-7.0.0dev" -#endif -#endif diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cubeorange.inc b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cubeorange.inc index 209c017ee5..19420ff7ea 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cubeorange.inc +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cubeorange.inc @@ -2,6 +2,7 @@ include ../CubeOrange/hwdef.dat include ./features.inc +include ./version.inc # The Carbonix carrier board (CX13042008) uses uninverted logic for these pins, # as opposed to how the CubePilot carrier hardware is designed. We have to diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc new file mode 100644 index 0000000000..19aa43f364 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc @@ -0,0 +1 @@ +define AP_CUSTOM_FIRMWARE_STRING "CxPilot-7.0.0dev" diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixF405/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixF405/hwdef.dat index 574d49c738..ef573aface 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixF405/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixF405/hwdef.dat @@ -1,3 +1,5 @@ +include ../CarbonixCommon/version.inc + # hw definition file for processing by chibios_pins.py # MCU class and specific type