Skip to content

Commit

Permalink
Merge pull request #85 from augustozanellato/fix_successive_builds
Browse files Browse the repository at this point in the history
Fix stuff I broke yesterday
  • Loading branch information
doegox committed Aug 23, 2023
2 parents e7e4be0 + 9d5cf21 commit 5c62739
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
12 changes: 8 additions & 4 deletions firmware/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,19 @@ set -xe
--merge \
settings.hex \
application.hex \
--output application.hex
rm settings.hex
--output application_merged.hex

mergehex \
--merge \
bootloader.hex \
application.hex \
application_merged.hex \
softdevice.hex \
--output fullimage.hex

zip ${device_type}-binaries.zip *.hex
tmp_dir=$(mktemp -d -t cu_binaries_XXXXXXXXXX)
cp *.hex "$tmp_dir"
mv $tmp_dir/application_merged.hex $tmp_dir/application.hex
rm $tmp_dir/settings.hex
zip -j ${device_type}-binaries.zip $tmp_dir/*.hex
rm -rf $tmp_dir
)
21 changes: 20 additions & 1 deletion firmware/flash-dfu-app.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

if [[ $BASH_SOURCE = */* ]]; then
cd -- "${BASH_SOURCE%/*}/" || exit
fi

if ! ../resource/tools/enter_dfu.py; then
echo "Wait for device to be off"
echo "Press B and plug"
Expand All @@ -9,4 +13,19 @@ while :; do
lsusb|grep -q 1915:521f && break
sleep 1
done
nrfutil device program --firmware objects/dfu-app.zip --traits nordicDfu

device_type=ultra
lsusb | grep 1915:521f | grep -q ChameleonLite && device_type=lite

echo "Flashing $device_type"

dfu_package=objects/${device_type}-dfu-app.zip

if [ ! -f $dfu_package ]; then
echo "DFU package for $device_type not found, aborting."
echo "Build firmware using CURRENT_DEVICE_TYPE=$device_type firmware/build.sh"
exit 1
fi

nrfutil device program --firmware $dfu_package --traits nordicDfu

21 changes: 20 additions & 1 deletion firmware/flash-dfu-full.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

if [[ $BASH_SOURCE = */* ]]; then
cd -- "${BASH_SOURCE%/*}/" || exit
fi

if ! ../resource/tools/enter_dfu.py; then
echo "Wait for device to be off"
echo "Press B and plug"
Expand All @@ -9,4 +13,19 @@ while :; do
lsusb|grep -q 1915:521f && break
sleep 1
done
nrfutil device program --firmware objects/dfu-full.zip --traits nordicDfu

device_type=ultra
lsusb | grep 1915:521f | grep -q ChameleonLite && device_type=lite

echo "Flashing $device_type"

dfu_package=objects/${device_type}-dfu-full.zip

if [ ! -f $dfu_package ]; then
echo "DFU package for $device_type not found, aborting."
echo "Build firmware using CURRENT_DEVICE_TYPE=$device_type firmware/build.sh"
exit 1
fi

nrfutil device program --firmware $dfu_package --traits nordicDfu

0 comments on commit 5c62739

Please sign in to comment.