ao-bringup: Revert EasyMini scripts to 1.0
[fw/altos] / ao-bringup / turnon_easymini
1 #!/bin/sh
2
3 if [ -x ../ao-tools/ao-flash/ao-flash-lpc ]; then
4         FLASH_LPC=../ao-tools/ao-flash/ao-flash-lpc
5 elif [ -x /usr/bin/ao-flash-lpc ]; then
6         FLASH_LPC=/usr/bin/ao-flash-lpc
7 else
8         echo "Can't find ao-flash-lpc!  Aborting."
9         exit 1
10 fi
11
12 if [ -x ../ao-tools/ao-usbload/ao-usbload ]; then
13         USBLOAD=../ao-tools/ao-usbload/ao-usbload
14 elif [ -x /usr/bin/ao-usbload ]; then
15         USBLOAD=/usr/bin/ao-usbload
16 else
17         echo "Can't find ao-usbload!  Aborting."
18         exit 1
19 fi
20
21 VERSION=1.0
22 PRODUCT=EasyMini
23 BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
24 echo $FILE
25
26 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
27 echo "Copyright 2010 by Bdale Garbee.  Released under GPL v2"
28 echo
29 echo "Expectations:"
30 echo "\t$PRODUCT v$VERSION powered from USB"
31 echo "\t\twith ST-Link-V2 cabled to debug header"
32 echo
33
34 case $# in
35     1)
36         SERIAL="$1"
37         echo "$PRODUCT-$VERSION serial number: $SERIAL" 
38         ;;
39     0)
40         echo -n "$PRODUCT-$VERSION serial number: "
41         read SERIAL
42         ;;
43     *)
44         echo "Usage: $0 <serial-number>" 1>&2
45         exit 1;
46         ;;
47 esac
48
49 #
50 # Use released versions of everything
51 #
52 FLASH_FILE=~/altusmetrumllc/Binaries/loaders/easymini-v1.0-altos-flash-*.elf
53 ALTOS_FILE=~/altusmetrumllc/Binaries/easymini-v1.0-*.elf
54
55 #FLASH_FILE=../src/$BASE-v$VERSION/flash-loader/$BASE-v$VERSION-altos-flash-*.elf
56 #ALTOS_FILE=../src/$BASE-v$VERSION/*.ihx
57
58 echo $FLASH_LPC $FLASH_FILE
59
60 $FLASH_LPC $FLASH_FILE || exit 1
61
62 sleep 1
63
64 echo $USBLOAD $ALTOS_FILE
65
66 $USBLOAD --serial=$SERIAL $ALTOS_FILE || exit 1
67
68 sleep 1
69
70 ./test-easymini-v1.0
71
72 exit $?