Skip to content

Instantly share code, notes, and snippets.

@byq77
Created November 12, 2019 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save byq77/5311e8a3459ceef445eeed0a96a02922 to your computer and use it in GitHub Desktop.
Save byq77/5311e8a3459ceef445eeed0a96a02922 to your computer and use it in GitHub Desktop.
ROSbot firmware update
#!/bin/bash
USAGE_STR="Usage: ./fw_update.sh <tag> e.g. ./fw_update.sh 0.9.0"
MACHINE=`uname -m`
if [ ${#} -ne 1 ]; then
echo -e "Wrong number of arguments.\n$USAGE_STR"
exit 1
fi
IS_OK=`curl -I -s https://files.husarion.com/rosbot-firmware/rosbot-2.0-fw-v${1}.bin | head -n 1 - | grep -e '200' -c`
if [ $IS_OK -eq 1 ]; then
echo "The tag ${1} exists. Downloading..."
if [ "$MACHINE" = "armv7l" ]; then
curl -o firmware.bin https://files.husarion.com/rosbot-firmware/rosbot-2.0-fw-v${1}.bin && sudo stm32loader -c tinker -u -W && sudo stm32loader -c tinker -e -w -v firmware.bin
else
curl -o firmware.bin https://files.husarion.com/rosbot-firmware/rosbot-2.0-pro-fw-v${1}.bin && sudo stm32loader -c upboard -u -W && sudo stm32loader -c tinker -e -w -v firmware.bin
fi
rm firmware.bin
else
echo "Tag ${1} does not exist. Exiting..."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment