Skip to content

Commit

Permalink
AP_Common: remove CxVersion stuff
Browse files Browse the repository at this point in the history
Replace with defining in hwdef.dat with a version.inc file. For SITL,
this define is added in the command-line instead.
  • Loading branch information
robertlong13 committed Sep 25, 2024
1 parent b01ce25 commit f2fb76a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/carbonix_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Tools/AP_Periph/AP_Periph.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <SITL/SITL.h>
#endif
#include <AP_AHRS/AP_AHRS.h>
#include <AP_Common/CxVersion.h>

#ifdef HAL_PERIPH_ENABLE_RELAY
#ifdef HAL_PERIPH_ENABLE_PWM_HARDPOINT
Expand Down
6 changes: 3 additions & 3 deletions Tools/Carbonix_scripts/carbonix_waf_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down
15 changes: 8 additions & 7 deletions Tools/scripts/cygwin_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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++"
Expand All @@ -21,20 +25,17 @@ 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
# python ./waf heli 2>&1
# 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
Expand All @@ -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)"
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion libraries/AP_Common/AP_FWVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <stdint.h>
#include <AP_Common/AP_Common.h>
#include <AP_HAL/AP_HAL_Boards.h>
#include <AP_Common/CxVersion.h>

class PACKED AP_FWVersion {

Expand Down
5 changes: 0 additions & 5 deletions libraries/AP_Common/CxVersion.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
define AP_CUSTOM_FIRMWARE_STRING "CxPilot-7.0.0dev"
2 changes: 2 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/CarbonixF405/hwdef.dat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include ../CarbonixCommon/version.inc

# hw definition file for processing by chibios_pins.py

# MCU class and specific type
Expand Down

0 comments on commit f2fb76a

Please sign in to comment.