]> git.gag.com Git - fw/altos/blob - ao-bringup/turnon_telemini
altos/stmf0: Pull beeper pin low when beeper is off
[fw/altos] / ao-bringup / turnon_telemini
1 #!/bin/sh
2
3 if [ -x /usr/bin/dfu-util ]; then
4     DFU_UTIL=/usr/bin/dfu-util
5 else
6     echo "Can't find dfu-util! Aborting."
7     exit 1
8 fi
9
10 if [ -x /usr/bin/ao-usbload ]; then
11         USBLOAD=/usr/bin/ao-usbload
12 else
13         echo "Can't find ao-usbload!  Aborting."
14         exit 1
15 fi
16
17 VERSION=3.0
18 PRODUCT=TeleMini
19
20 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
21 echo "Copyright 2017 by Keith Packard.  Released under GPL v2 or later"
22 echo
23 echo "Expectations:"
24 echo "\t$PRODUCT v$VERSION powered from USB"
25 echo
26 echo -n "$PRODUCT-$VERSION serial number: "
27
28 case $# in
29     1)
30         SERIAL="$1"
31         echo "$PRODUCT-$VERSION serial number: $SERIAL" 
32         ;;
33     0)
34         echo -n "$PRODUCT-$VERSION serial number: "
35         read SERIAL
36         ;;
37     *)
38         echo "Usage: $0 <serial-number>" 1>&2
39         exit 1;
40         ;;
41 esac
42
43 FLASH_FILE=~/altusmetrumllc/Binaries/loaders/telemini-v$VERSION-altos-flash-*.bin
44 ALTOS_FILE=~/altusmetrumllc/Binaries/telemini-v$VERSION-*.elf
45 #FLASH_FILE=../src/telemini-v3.0/flash-loader/telemini-v$VERSION-altos-flash-*.bin
46 #ALTOS_FILE=../src/telemini-v3.0/telemini-v$VERSION-*.elf
47
48 $DFU_UTIL -a 0 -s 0x08000000:leave -D $FLASH_FILE || exit 1
49
50 sleep 2
51
52 $USBLOAD --serial=$SERIAL $ALTOS_FILE || exit 1
53
54 sleep 3
55
56 dev=`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 SERIAL=$SERIAL ./cal-freq $dev
71
72 echo 'E 1' > $dev
73
74 ./test-telemini
75
76 exit $?