2022-02-13 20:10:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
VERSION=`bin/buildinfo.py long`
|
|
|
|
SHORT_VERSION=`bin/buildinfo.py short`
|
|
|
|
|
|
|
|
OUTDIR=release/
|
|
|
|
|
|
|
|
rm -f $OUTDIR/firmware*
|
|
|
|
rm -r $OUTDIR/* || true
|
|
|
|
|
|
|
|
# Make sure our submodules are current
|
|
|
|
git submodule update
|
|
|
|
|
|
|
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
2022-11-09 13:14:08 +00:00
|
|
|
platformio pkg update
|
2022-02-13 20:10:59 +00:00
|
|
|
|
|
|
|
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
|
|
|
|
rm -f .pio/build/$1/firmware.*
|
|
|
|
|
|
|
|
# The shell vars the build tool expects to find
|
|
|
|
export APP_VERSION=$VERSION
|
|
|
|
|
|
|
|
basename=firmware-$1-$VERSION
|
|
|
|
|
|
|
|
pio run --environment $1 # -v
|
|
|
|
SRCELF=.pio/build/$1/firmware.elf
|
2022-10-12 13:05:00 +00:00
|
|
|
DFUPKG=.pio/build/$1/firmware.zip
|
2022-02-13 20:10:59 +00:00
|
|
|
cp $SRCELF $OUTDIR/$basename.elf
|
2022-10-12 13:05:00 +00:00
|
|
|
cp $DFUPKG $OUTDIR/$basename-ota.zip
|
2022-02-13 20:10:59 +00:00
|
|
|
|
|
|
|
echo "Generating NRF52 uf2 file"
|
|
|
|
SRCHEX=.pio/build/$1/firmware.hex
|
|
|
|
bin/uf2conv.py $SRCHEX -c -o $OUTDIR/$basename.uf2 -f 0xADA52840
|
|
|
|
|
|
|
|
cp bin/device-install.* $OUTDIR
|
|
|
|
cp bin/device-update.* $OUTDIR
|
2022-10-05 15:52:51 +00:00
|
|
|
cp bin/*.uf2 $OUTDIR
|