2020-02-20 20:49:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-02-14 22:00:08 +00:00
|
|
|
set -e
|
|
|
|
|
2020-02-24 17:22:34 +00:00
|
|
|
source bin/version.sh
|
2020-02-19 00:18:01 +00:00
|
|
|
|
2020-03-12 06:05:11 +00:00
|
|
|
COUNTRIES="US EU433 EU865 CN JP"
|
2020-03-24 21:43:55 +00:00
|
|
|
#COUNTRIES=US
|
2020-02-20 20:49:34 +00:00
|
|
|
|
2020-02-24 17:33:41 +00:00
|
|
|
OUTDIR=release/latest
|
|
|
|
|
|
|
|
# We keep all old builds (and their map files in the archive dir)
|
|
|
|
ARCHIVEDIR=release/archive
|
|
|
|
|
|
|
|
rm -f $OUTDIR/firmware*
|
2020-02-20 20:49:34 +00:00
|
|
|
|
2020-03-31 01:51:15 +00:00
|
|
|
mkdir -p $OUTDIR/bins $OUTDIR/elfs
|
2020-04-05 21:13:18 +00:00
|
|
|
rm -f $OUTDIR/bins/*
|
2020-03-31 01:51:15 +00:00
|
|
|
|
2020-03-27 23:55:19 +00:00
|
|
|
# build the named environment and copy the bins to the release directory
|
2020-03-27 20:20:52 +00:00
|
|
|
function do_build {
|
|
|
|
ENV_NAME=$1
|
|
|
|
echo "Building for $ENV_NAME with $PLATFORMIO_BUILD_FLAGS"
|
|
|
|
SRCBIN=.pio/build/$ENV_NAME/firmware.bin
|
|
|
|
SRCELF=.pio/build/$ENV_NAME/firmware.elf
|
2020-03-28 20:16:54 +00:00
|
|
|
rm -f $SRCBIN
|
2020-03-27 20:20:52 +00:00
|
|
|
pio run --environment $ENV_NAME # -v
|
2020-03-31 01:51:15 +00:00
|
|
|
cp $SRCBIN $OUTDIR/bins/firmware-$ENV_NAME-$COUNTRY-$VERSION.bin
|
|
|
|
cp $SRCELF $OUTDIR/elfs/firmware-$ENV_NAME-$COUNTRY-$VERSION.elf
|
2020-03-27 20:20:52 +00:00
|
|
|
}
|
|
|
|
|
2020-02-20 20:49:34 +00:00
|
|
|
for COUNTRY in $COUNTRIES; do
|
|
|
|
|
2020-02-24 17:22:34 +00:00
|
|
|
HWVERSTR="1.0-$COUNTRY"
|
2020-03-27 20:20:52 +00:00
|
|
|
COMMONOPTS="-DAPP_VERSION=$VERSION -DHW_VERSION_$COUNTRY -DHW_VERSION=$HWVERSTR -Wall -Wextra -Wno-missing-field-initializers -Isrc -Os -DAXP_DEBUG_PORT=Serial"
|
2020-02-20 20:49:34 +00:00
|
|
|
|
2020-03-27 20:20:52 +00:00
|
|
|
export PLATFORMIO_BUILD_FLAGS="$COMMONOPTS"
|
2020-02-20 20:49:34 +00:00
|
|
|
|
2020-03-28 22:31:22 +00:00
|
|
|
do_build "tbeam0.7"
|
2020-03-28 21:45:33 +00:00
|
|
|
do_build "ttgo-lora32-v2"
|
2020-03-27 23:55:19 +00:00
|
|
|
do_build "ttgo-lora32-v1"
|
2020-03-27 20:20:52 +00:00
|
|
|
do_build "tbeam"
|
|
|
|
do_build "heltec"
|
2020-02-20 20:49:34 +00:00
|
|
|
done
|
2020-02-14 22:00:08 +00:00
|
|
|
|
2020-02-24 17:33:41 +00:00
|
|
|
# keep the bins in archive also
|
2020-04-05 21:13:18 +00:00
|
|
|
cp $OUTDIR/bins/firmware* $OUTDIR/elfs/firmware* $ARCHIVEDIR
|
2020-02-24 17:33:41 +00:00
|
|
|
|
2020-02-24 17:55:02 +00:00
|
|
|
cat >$OUTDIR/curfirmwareversion.xml <<XML
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
|
|
|
|
<!-- This file is kept in source control because it reflects the last stable
|
|
|
|
release. It is used by the android app for forcing software updates. Do not edit.
|
|
|
|
Generated by bin/buildall.sh -->
|
|
|
|
|
|
|
|
<resources>
|
|
|
|
<string name="cur_firmware_version">$VERSION</string>
|
|
|
|
</resources>
|
|
|
|
XML
|
|
|
|
|
2020-02-26 22:27:00 +00:00
|
|
|
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
|
2020-03-31 01:51:15 +00:00
|
|
|
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh
|
2020-02-14 22:00:08 +00:00
|
|
|
|
2020-02-20 20:49:34 +00:00
|
|
|
echo BUILT ALL
|