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