From 66557241f3282c7ef2a532e7a6e7ca7e6c1f8e81 Mon Sep 17 00:00:00 2001 From: geeksville Date: Mon, 17 Aug 2020 12:29:45 -0700 Subject: [PATCH] Generate UF2 files for NRF52 release builds --- bin/build-all.sh | 31 ++++++++++++++++++++++--------- bin/upload-to-bootloader.sh | 4 ++-- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index 3f32d228..5a860bc4 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -8,7 +8,11 @@ COUNTRIES="US EU433 EU865 CN JP" #COUNTRIES=US #COUNTRIES=CN -BOARDS="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7" +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" #BOARDS=tbeam OUTDIR=release/latest @@ -23,20 +27,17 @@ rm -f $OUTDIR/bins/* # build the named environment and copy the bins to the release directory 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 - rm -f $SRCBIN + echo "Building for $BOARD with $PLATFORMIO_BUILD_FLAGS" + rm -f .pio/build/$BOARD/firmware.* # The shell vars the build tool expects to find export HW_VERSION="1.0-$COUNTRY" export APP_VERSION=$VERSION export COUNTRY - pio run --jobs 4 --environment $ENV_NAME # -v - cp $SRCBIN $OUTDIR/bins/firmware-$ENV_NAME-$COUNTRY-$VERSION.bin - cp $SRCELF $OUTDIR/elfs/firmware-$ENV_NAME-$COUNTRY-$VERSION.elf + pio run --jobs 4 --environment $BOARD # -v + SRCELF=.pio/build/$BOARD/firmware.elf + cp $SRCELF $OUTDIR/elfs/firmware-$BOARD-$COUNTRY-$VERSION.elf } # Make sure our submodules are current @@ -49,6 +50,18 @@ for COUNTRY in $COUNTRIES; do for BOARD in $BOARDS; do do_build $BOARD done + + 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 done # keep the bins in archive also diff --git a/bin/upload-to-bootloader.sh b/bin/upload-to-bootloader.sh index edaee75c..55a039a6 100755 --- a/bin/upload-to-bootloader.sh +++ b/bin/upload-to-bootloader.sh @@ -1,4 +1,4 @@ echo "Converting to uf2 for NRF52 Adafruit bootloader" -bin/uf2conv.py .pio/build/lora-relay-v1/firmware.hex -c -f 0xADA52840 -cp flash.uf2 /media/kevinh/FTH*BOOT/ +bin/uf2conv.py .pio/build/lora-relay-v1/firmware.hex -f 0xADA52840 +# cp flash.uf2 /media/kevinh/FTH*BOOT/