ao-bringup: Use released files for chaoskey turnon
[fw/altos] / ao-bringup / turnon_chaoskey
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=1.0
18 PRODUCT=ChaosKey
19
20 echo "ChaosKey v$VERSION Turn-On and Calibration Program"
21 echo "Copyright 2015 by Keith Packard.  Released under GPL v2"
22 echo
23 echo "Expectations:"
24 echo "\tChaosKey v$VERSION powered from USB"
25 echo
26
27 FLASH_FILE=~/altusmetrumllc/Binaries/loaders/chaoskey-v1.0-altos-flash-*.bin
28 ALTOS_FILE=~/altusmetrumllc/Binaries/chaoskey-v1.0-*.elf
29
30 $DFU_UTIL -a 0 -s 0x08000000:leave -D $FLASH_FILE || exit 1
31
32 sleep 2
33
34 $USBLOAD --serial=1 $ALTOS_FILE || exit 1
35
36 sleep 1
37
38 serial=`dmesg | grep 'on chaoskey' | tail -1 | sed 's/.*chaoskey \([0-9a-f][0-9a-f]*\) on chaoskey.*/\1/'`
39
40 echo 'Testing ChaosKey' $serial
41
42 ./test-chaoskey $serial
43
44 exit $?