]> git.gag.com Git - fw/altos/blob - ao-bringup/turnon_easymega
split lintian overrides into source and binary
[fw/altos] / ao-bringup / turnon_easymega
1 #!/bin/sh
2
3 PRODUCT=EasyMega
4 VERSION=2.0
5 REPO=~/altusmetrumllc/Binaries
6
7 if [ -x /usr/bin/ao-flash-stm ]; then
8         FLASH_STM=/usr/bin/ao-flash-stm
9 else
10         echo "Can't find ao-flash-stm!  Aborting."
11         exit 1
12 fi
13
14 if [ -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 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
22 echo "Copyright 2018 by Bdale Garbee.  Released under GPL v2"
23 echo
24 echo "Expectations:"
25 echo "\t$PRODUCT v$VERSION"
26 echo "\t\twith USB cable attached"
27 echo "\t\twith ST-Link-V2 cabled to debug header"
28 echo
29
30 case $# in
31     1)
32         SERIAL="$1"
33         echo "$PRODUCT-$VERSION serial number: $SERIAL" 
34         ;;
35     0)
36         echo -n "$PRODUCT-$VERSION serial number: "
37         read SERIAL
38         ;;
39     *)
40         echo "Usage: $0 <serial-number>" 1>&2
41         exit 1;
42         ;;
43 esac
44
45 echo $FLASH_STM
46
47 $FLASH_STM $REPO/loaders/easymega-v$VERSION*.elf
48
49 sleep 3
50
51 $USBLOAD --serial=$SERIAL $REPO/easymega-v$VERSION*.elf || exit 1
52
53 sleep 5
54
55 dev=`ao-list | awk '/'"$PRODUCT"'-v'"$VERSION"'/ { print $3; exit(0); }'`
56
57 case "$dev" in
58 /dev/tty*)
59         echo "$PRODUCT found on $dev"
60         ;;
61 *)
62         echo 'No '"$PRODUCT"'-v'"$VERSION"' found'
63         exit 1
64         ;;
65 esac
66
67 echo 'E 0' > $dev
68
69 failed=1
70 while [ $failed =  1 ]; do
71     ../ao-tools/ao-cal-accel/ao-cal-accel $dev
72     failed=$?
73 done
74
75 echo 'E 1' > $dev
76
77 ./test-easymega
78
79 exit $?