2022-03-07 18:46:31 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
BOARD=NucleoH743
|
|
|
|
BOARD=MatekH743
|
|
|
|
#BOARD=F35Lightning
|
|
|
|
|
2022-05-23 22:24:20 -03:00
|
|
|
THISDIR=$(realpath $(dirname $0))
|
|
|
|
ROOTDIR=$(realpath "$THISDIR/../../../..")
|
2022-03-07 18:46:31 -04:00
|
|
|
|
2022-05-23 01:06:18 -03:00
|
|
|
VEHICLE="copter"
|
|
|
|
DEFAULTS_PATH=""
|
|
|
|
EXTRA_HWDEF=""
|
|
|
|
|
|
|
|
usage() {
|
2022-08-22 02:03:07 -03:00
|
|
|
echo "Usage: $0 [-v <plane|copter>] [-d DEFAULT_FILEPATH] [-b BOARDNAME] [-m APPEND_DEFAULTS_PATH" >&2;
|
2022-05-23 01:06:18 -03:00
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
2022-08-22 02:03:07 -03:00
|
|
|
while getopts ":v:d:b:m:" o; do
|
2022-05-23 01:06:18 -03:00
|
|
|
case "${o}" in
|
|
|
|
v)
|
|
|
|
VEHICLE=${OPTARG}
|
|
|
|
[ "$VEHICLE" == "plane" ] || [ "$VEHICLE" == "copter" ] || usage
|
|
|
|
;;
|
|
|
|
d)
|
|
|
|
DEFAULTS_PATH=${OPTARG}
|
|
|
|
;;
|
2022-08-22 02:03:07 -03:00
|
|
|
m)
|
|
|
|
MORE_DEFAULTS_PATH=${OPTARG}
|
|
|
|
;;
|
2022-05-23 01:06:18 -03:00
|
|
|
b)
|
|
|
|
BOARD=${OPTARG}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
|
|
|
if [ -z "${DEFAULTS_PATH}" ]; then
|
|
|
|
if [ "$VEHICLE" == "plane" ]; then
|
|
|
|
DEFAULTS_PATH="$THISDIR/plane-default.param"
|
|
|
|
EXTRA_HWDEF="$THISDIR/plane-extra-hwdef-sitl-on-hw.dat"
|
|
|
|
elif ["$VEHICLE" == "copter" ]; then
|
|
|
|
DEFAULTS_PATH="$THISDIR/default.param"
|
|
|
|
EXTRA_HWDEF="$THISDIR/extra-hwdef-sitl-on-hw.dat"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-08-22 02:03:07 -03:00
|
|
|
if [ ! -z "${MORE_DEFAULTS_PATH}" ]; then
|
|
|
|
NEW_DEFAULTS_PATH="/tmp/some-defaults.param"
|
|
|
|
cp "$DEFAULTS_PATH" "$NEW_DEFAULTS_PATH"
|
|
|
|
cat "$MORE_DEFAULTS_PATH" >> "$NEW_DEFAULTS_PATH"
|
|
|
|
DEFAULTS_PATH="$NEW_DEFAULTS_PATH"
|
|
|
|
fi
|
|
|
|
|
2022-05-23 22:24:20 -03:00
|
|
|
pushd $ROOTDIR
|
|
|
|
|
2022-03-07 18:46:31 -04:00
|
|
|
./waf configure \
|
|
|
|
--board=$BOARD \
|
2022-05-23 01:06:18 -03:00
|
|
|
--extra-hwdef="$EXTRA_HWDEF" \
|
|
|
|
--default-param="$DEFAULTS_PATH"
|
2022-03-07 18:46:31 -04:00
|
|
|
|
2022-05-23 01:06:18 -03:00
|
|
|
./waf ${VEHICLE} --upload
|