Files
firmware/bin/build-nrf52.sh

55 lines
1.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2024-07-04 08:10:40 -05:00
VERSION=$(bin/buildinfo.py long)
SHORT_VERSION=$(bin/buildinfo.py short)
2025-12-08 18:21:23 -05:00
BUILDDIR=.pio/build/$1
OUTDIR=release
rm -f $OUTDIR/firmware*
rm -r $OUTDIR/* || true
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
platformio pkg install -e $1
echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS"
2025-12-08 18:21:23 -05:00
rm -f $BUILDDIR/firmware*
# The shell vars the build tool expects to find
export APP_VERSION=$VERSION
basename=firmware-$1-$VERSION
pio run --environment $1 # -v
2024-07-09 09:12:23 -05:00
2025-12-08 18:21:23 -05:00
cp $BUILDDIR/$basename.elf $OUTDIR/$basename.elf
2024-07-09 09:12:23 -05:00
2025-12-08 18:21:23 -05:00
echo "Copying NRF52 dfu (OTA) file"
cp $BUILDDIR/$basename.zip $OUTDIR/$basename.zip
2024-07-04 08:10:40 -05:00
2025-12-08 18:21:23 -05:00
echo "Copying NRF52 UF2 file"
cp $BUILDDIR/$basename.uf2 $OUTDIR/$basename.uf2
cp bin/*.uf2 $OUTDIR/
SRCHEX=$BUILDDIR/$basename.hex
# if WM1110 target, copy the merged.hex
2024-07-04 08:29:49 -05:00
if (echo $1 | grep -q "wio-sdk-wm1110"); then
2025-12-08 18:21:23 -05:00
echo "Copying .merged.hex file"
SRCHEX=$BUILDDIR/$basename.merged.hex
cp $SRCHEX $OUTDIR/
2024-07-04 08:10:40 -05:00
fi
2024-08-27 18:24:14 -05:00
if (echo $1 | grep -q "rak4631"); then
2025-12-08 18:21:23 -05:00
echo "Copying .hex file"
cp $SRCHEX $OUTDIR/
fi
# Generate the manifest file
echo "Generating Meshtastic manifest"
TIMEFORMAT="Generated manifest in %E seconds"
time pio run --environment $1 -t mtjson --silent --disable-auto-clean
cp $BUILDDIR/$basename.mt.json $OUTDIR/$basename.mt.json