aboutsummaryrefslogtreecommitdiff
path: root/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh
diff options
context:
space:
mode:
authorDavid Madison <dmadison@users.noreply.github.com>2019-02-15 13:00:46 -0500
committerGitHub <noreply@github.com>2019-02-15 13:00:46 -0500
commit7d65dd08142eda767eb822bf2d92c3a1bd9f8b8f (patch)
tree5609dee433e7d089e6c4f974fa1d870b4068d613 /firmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh
parent2663be17272e19f00c55f3f2d8f1ebfac47158d6 (diff)
parent91e267bcc42442d4e9da09aab30065ad5d44025a (diff)
Merge pull request #1 from dmadison/forking
Forking
Diffstat (limited to 'firmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh')
-rwxr-xr-xfirmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh96
1 files changed, 0 insertions, 96 deletions
diff --git a/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh b/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh
deleted file mode 100755
index dadaf29..0000000
--- a/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/sh
-
-WIFI_FW_PATH="/hardware/arduino/avr/firmwares/wifishield/binary"
-AVR_TOOLS_PATH="/hardware/tools/avr/bin"
-
-progname=$0
-
-usage () {
-cat <<EOF
-Usage: $progname [-a Arduino_path] [-f which_firmware] [-h]
- -a set the path where the Arduino IDE is installed
- -f the firmware you want to upload, valid parameters are:
- shield - to upgrade the WiFi shield firmware
- all - to upgrade both firmwares
- -h help
-EOF
- exit 0
-}
-
-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"
- 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
- 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.
-
-EOF
-
-if [ $USER = 'root' ] ; then #check if the current user is root
- while getopts ":a:f:h" opt; do
- case $opt in
- a)
- ARDUINO_PATH=$OPTARG
- WIFI_FW_PATH=$ARDUINO_PATH$WIFI_FW_PATH
- AVR_TOOLS_PATH=$ARDUINO_PATH$AVR_TOOLS_PATH
- cd $AVR_TOOLS_PATH
- ./avr-objcopy --output-target=ihex $WIFI_FW_PATH/wifi_dnld.elf $WIFI_FW_PATH/wifi_dnld.hex
- ./avr-objcopy --output-target=ihex $WIFI_FW_PATH/wifiHD.elf $WIFI_FW_PATH/wifiHD.hex
- ;;
- f)
- if [ "$ARDUINO_PATH" != "" ] ; then
- if [ "$OPTARG" = "all" ] ; then
- upgradeHDmodule
- upgradeShield
- exit 0
- else
- if [ "$OPTARG" = "shield" ] ; then
- upgradeShield
- exit 0
- else
- echo "invalid parameter for the -f [firmware] option, please retry."
- echo "Type -h for help\n"
- exit 1
- fi
- fi
- else
- echo "Arduino Path not setted. Retry...\n"
- fi
- ;;
- h)
- usage ;;
- \?)
- echo "Invalid option: $OPTARG" >&2
- usage
- exit 1
- ;;
- :)
- echo "Option -$OPTARG requires an argument." >&2
- exit 1
- ;;
- esac
- done
-else
- echo "You are not root!\n"
-fi
-
-shift $(($OPTIND - 1))