|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
3 |
| -WIFI_FW_PATH="/hardware/arduino/firmwares/wifi-shield" |
| 3 | +WIFI_FW_PATH="/hardware/arduino/firmwares/wifishield/binary" |
4 | 4 | AVR_TOOLS_PATH="/hardware/tools/avr/bin"
|
5 | 5 |
|
| 6 | +TARGET_MICRO="at32uc3a1256" |
| 7 | + |
| 8 | + |
6 | 9 | progname=$0
|
7 | 10 |
|
8 | 11 | usage () {
|
|
20 | 23 | upgradeHDmodule () {
|
21 | 24 | sleep 1 # Give time to the shield to end the boot
|
22 | 25 | echo "****Upgrade HD WiFi module firmware****\n"
|
23 |
| - dfu-programmer at32uc3a1256 erase |
24 |
| - dfu-programmer at32uc3a1256 flash --suppress-bootloader-mem $WIFI_FW_PATH/wifi_dnld.hex |
25 |
| - dfu-programmer at32uc3a1256 start |
26 |
| - 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" |
| 26 | + dfu-programmer $TARGET_MICRO erase |
| 27 | + dfu-programmer $TARGET_MICRO flash --suppress-bootloader-mem $WIFI_FW_PATH/wifi_dnld.hex |
| 28 | + dfu-programmer $TARGET_MICRO start |
| 29 | + |
| 30 | + if [ $? != 0 ] ; then |
| 31 | + echo "\nError during device initialization, please close the J3 jumper and press the reset button.\nTry -h for help\n" |
| 32 | + exit 1 # if the device is not recognized exit |
| 33 | + fi |
| 34 | + |
| 35 | + echo -n "\nPress the RESET button on the shield then type [ENTER] to upgrade the firmware of the shield..\n" |
27 | 36 | read readEnter
|
28 | 37 | }
|
29 | 38 |
|
30 | 39 | upgradeShield () {
|
31 | 40 | sleep 1 # Give time to the shield to end the boot
|
32 | 41 | echo "****Upgrade WiFi Shield firmware****\n"
|
33 |
| - dfu-programmer at32uc3a1256 erase |
34 |
| - dfu-programmer at32uc3a1256 flash --suppress-bootloader-mem $WIFI_FW_PATH/wifiHD.hex |
35 |
| - dfu-programmer at32uc3a1256 start |
| 42 | + dfu-programmer $TARGET_MICRO erase |
| 43 | + dfu-programmer $TARGET_MICRO flash --suppress-bootloader-mem $WIFI_FW_PATH/wifiHD.hex |
| 44 | + dfu-programmer $TARGET_MICRO start |
| 45 | + |
| 46 | + if [ $? != 0 ] ; then |
| 47 | + echo "\nError during device initialization, please close the J3 jumper and press the reset button.\nTry -h for help\n" |
| 48 | + exit 1 # if the device is not recognized exit |
| 49 | + fi |
| 50 | + |
36 | 51 | echo "\nDone. Remove the J3 jumper and press the RESET button on the shield."
|
37 | 52 | echo "Thank you!\n"
|
38 | 53 | }
|
39 | 54 |
|
| 55 | + |
40 | 56 | cat <<EOF
|
41 | 57 |
|
42 | 58 | Arduino WiFi Shield upgrade
|
43 | 59 | =========================================
|
44 |
| -Disclaimer: to access to the USB devices correctly, the dfu-programmer needs to be used as root. Run this script as root. |
| 60 | +Instructions: |
| 61 | +
|
| 62 | +To access to the USB devices correctly, the dfu-programmer needs to have the root permissions. |
| 63 | +
|
| 64 | +You can upgrade the firmware of the antenna togheter with the shield firmware or only the shield firmware |
| 65 | +if there aren't changes on the antenna firmware. |
| 66 | +
|
| 67 | +Use the '-h' parameter for help |
| 68 | +========================================= |
45 | 69 |
|
46 | 70 | EOF
|
47 | 71 |
|
@@ -90,7 +114,7 @@ if [ $USER = 'root' ] ; then #check if the current user is root
|
90 | 114 | esac
|
91 | 115 | done
|
92 | 116 | else
|
93 |
| - echo "You are not root!\n" |
| 117 | + echo "Please retry running the script as root.\n" |
94 | 118 | fi
|
95 | 119 |
|
96 | 120 | shift $(($OPTIND - 1))
|
0 commit comments