2020-02-20 12:49:34 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2020-02-14 14:00:08 -08:00
|
|
|
set -e
|
|
|
|
|
|
2020-02-24 09:22:34 -08:00
|
|
|
source bin/version.sh
|
2020-02-18 16:18:01 -08:00
|
|
|
|
2020-09-17 12:04:38 +00:00
|
|
|
COUNTRIES="US EU433 EU865 CN JP ANZ"
|
2020-03-24 14:43:55 -07:00
|
|
|
#COUNTRIES=US
|
2020-04-19 08:33:59 -07:00
|
|
|
#COUNTRIES=CN
|
|
|
|
|
|
2020-08-17 12:29:45 -07:00
|
|
|
BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7"
|
|
|
|
|
|
|
|
|
|
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
|
|
|
|
BOARDS_NRF52="lora-relay-v1"
|
|
|
|
|
BOARDS="$BOARDS_ESP32 $BOARDS_NRF52"
|
2020-04-19 08:33:59 -07:00
|
|
|
#BOARDS=tbeam
|
2020-02-20 12:49:34 -08:00
|
|
|
|
2020-02-24 09:33:41 -08: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 12:49:34 -08:00
|
|
|
|
2020-03-30 18:51:15 -07:00
|
|
|
mkdir -p $OUTDIR/bins $OUTDIR/elfs
|
2020-04-05 14:13:18 -07:00
|
|
|
rm -f $OUTDIR/bins/*
|
2020-03-30 18:51:15 -07:00
|
|
|
|
2020-03-27 16:55:19 -07:00
|
|
|
# build the named environment and copy the bins to the release directory
|
2020-03-27 13:20:52 -07:00
|
|
|
function do_build {
|
2020-08-17 12:29:45 -07:00
|
|
|
echo "Building for $BOARD with $PLATFORMIO_BUILD_FLAGS"
|
|
|
|
|
rm -f .pio/build/$BOARD/firmware.*
|
2020-04-19 08:33:59 -07:00
|
|
|
|
|
|
|
|
# The shell vars the build tool expects to find
|
|
|
|
|
export HW_VERSION="1.0-$COUNTRY"
|
|
|
|
|
export APP_VERSION=$VERSION
|
|
|
|
|
export COUNTRY
|
|
|
|
|
|
2020-08-17 12:29:45 -07:00
|
|
|
pio run --jobs 4 --environment $BOARD # -v
|
|
|
|
|
SRCELF=.pio/build/$BOARD/firmware.elf
|
|
|
|
|
cp $SRCELF $OUTDIR/elfs/firmware-$BOARD-$COUNTRY-$VERSION.elf
|
2020-03-27 13:20:52 -07:00
|
|
|
}
|
|
|
|
|
|
2020-05-16 16:09:06 -07:00
|
|
|
# Make sure our submodules are current
|
|
|
|
|
git submodule update
|
|
|
|
|
|
2020-05-01 16:34:16 -07:00
|
|
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
|
|
|
|
platformio lib update
|
|
|
|
|
|
2020-02-20 12:49:34 -08:00
|
|
|
for COUNTRY in $COUNTRIES; do
|
2020-04-19 08:33:59 -07:00
|
|
|
for BOARD in $BOARDS; do
|
|
|
|
|
do_build $BOARD
|
|
|
|
|
done
|
2020-08-17 12:29:45 -07:00
|
|
|
|
|
|
|
|
echo "Copying ESP32 bin files"
|
|
|
|
|
for BOARD in $BOARDS_ESP32; do
|
|
|
|
|
SRCBIN=.pio/build/$BOARD/firmware.bin
|
|
|
|
|
cp $SRCBIN $OUTDIR/bins/firmware-$BOARD-$COUNTRY-$VERSION.bin
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo "Generating NRF52 uf2 files"
|
|
|
|
|
for BOARD in $BOARDS_NRF52; do
|
|
|
|
|
SRCHEX=.pio/build/$BOARD/firmware.hex
|
|
|
|
|
bin/uf2conv.py $SRCHEX -c -o $OUTDIR/bins/firmware-$BOARD-$COUNTRY-$VERSION.uf2 -f 0xADA52840
|
|
|
|
|
done
|
2020-02-20 12:49:34 -08:00
|
|
|
done
|
2020-02-14 14:00:08 -08:00
|
|
|
|
2020-02-24 09:33:41 -08:00
|
|
|
# keep the bins in archive also
|
2020-04-05 14:13:18 -07:00
|
|
|
cp $OUTDIR/bins/firmware* $OUTDIR/elfs/firmware* $ARCHIVEDIR
|
2020-02-24 09:33:41 -08:00
|
|
|
|
2020-02-24 09:55:02 -08: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 14:27:00 -08:00
|
|
|
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
|
2020-05-06 19:45:02 -07:00
|
|
|
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
|
2020-02-14 14:00:08 -08:00
|
|
|
|
2020-05-06 19:45:02 -07:00
|
|
|
echo BUILT ALL
|