aboutsummaryrefslogtreecommitdiff
path: root/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2013-04-03 13:51:04 +0200
committerCristian Maglie <c.maglie@bug.st>2013-04-03 13:51:04 +0200
commitee90e68e86dd61d86f5d17b69080338328765b22 (patch)
treee620c0edc2690ab789b665e567910640597aa6fe /firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh
parent0ecdc5ebc96ad4c7c548c438a03d9ce00679db8b (diff)
parentf50c307be280dc6ece9e70c43b301c1db36291a0 (diff)
Merged 1.0.5
Merge remote-tracking branch 'arduino/master' into ide-1.5.x Conflicts: app/src/processing/app/Base.java build/shared/revisions.txt hardware/arduino/avr/cores/arduino/malloc.c hardware/arduino/cores/arduino/avr-libc/malloc.c hardware/arduino/cores/arduino/malloc.c todo.txt
Diffstat (limited to 'firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh')
-rwxr-xr-x[-rw-r--r--]firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh44
1 files changed, 34 insertions, 10 deletions
diff --git a/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh b/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh
index 5082392..d9a9e02 100644..100755
--- a/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh
+++ b/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh
@@ -1,8 +1,11 @@
#!/bin/sh
-WIFI_FW_PATH="/hardware/arduino/firmwares/wifi-shield"
+WIFI_FW_PATH="/hardware/arduino/firmwares/wifishield/binary"
AVR_TOOLS_PATH="/hardware/tools/avr/bin"
+TARGET_MICRO="at32uc3a1256"
+
+
progname=$0
usage () {
@@ -20,28 +23,49 @@ EOF
upgradeHDmodule () {
sleep 1 # Give time to the shield to end the boot
echo "****Upgrade HD WiFi module firmware****\n"
- dfu-programmer at32uc3a1256 erase
- dfu-programmer at32uc3a1256 flash --suppress-bootloader-mem $WIFI_FW_PATH/wifi_dnld.hex
- dfu-programmer at32uc3a1256 start
- echo -n "\nRemove the J3 jumper then press the RESET button on the shield then type [ENTER] to upgrade the firmware of the shield..\n"
+ dfu-programmer $TARGET_MICRO erase
+ dfu-programmer $TARGET_MICRO flash --suppress-bootloader-mem $WIFI_FW_PATH/wifi_dnld.hex
+ dfu-programmer $TARGET_MICRO start
+
+ if [ $? != 0 ] ; then
+ echo "\nError during device initialization, please close the J3 jumper and press the reset button.\nTry -h for help\n"
+ exit 1 # if the device is not recognized exit
+ fi
+
+ echo -n "\nPress the RESET button on the shield then type [ENTER] to upgrade the firmware of the shield..\n"
read readEnter
}
upgradeShield () {
sleep 1 # Give time to the shield to end the boot
echo "****Upgrade WiFi Shield firmware****\n"
- dfu-programmer at32uc3a1256 erase
- dfu-programmer at32uc3a1256 flash --suppress-bootloader-mem $WIFI_FW_PATH/wifiHD.hex
- dfu-programmer at32uc3a1256 start
+ dfu-programmer $TARGET_MICRO erase
+ dfu-programmer $TARGET_MICRO flash --suppress-bootloader-mem $WIFI_FW_PATH/wifiHD.hex
+ dfu-programmer $TARGET_MICRO start
+
+ if [ $? != 0 ] ; then
+ echo "\nError during device initialization, please close the J3 jumper and press the reset button.\nTry -h for help\n"
+ exit 1 # if the device is not recognized exit
+ fi
+
echo "\nDone. Remove the J3 jumper and press the RESET button on the shield."
echo "Thank you!\n"
}
+
cat <<EOF
Arduino WiFi Shield upgrade
=========================================
-Disclaimer: to access to the USB devices correctly, the dfu-programmer needs to be used as root. Run this script as root.
+Instructions:
+
+To access to the USB devices correctly, the dfu-programmer needs to have the root permissions.
+
+You can upgrade the firmware of the antenna togheter with the shield firmware or only the shield firmware
+if there aren't changes on the antenna firmware.
+
+Use the '-h' parameter for help
+=========================================
EOF
@@ -90,7 +114,7 @@ if [ $USER = 'root' ] ; then #check if the current user is root
esac
done
else
- echo "You are not root!\n"
+ echo "Please retry running the script as root.\n"
fi
shift $(($OPTIND - 1))