ao-bringup: Test chaoskey using dieharder
[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 $DFU_UTIL -a 0 -s 0x08000000:leave -D ../src/chaoskey-v$VERSION/flash-loader/chaoskey-v$VERSION*.bin || exit 1
28
29 sleep 2
30
31 $USBLOAD --serial=1 ../src/chaoskey-v$VERSION/chaoskey-v$VERSION*.ihx || exit 1
32
33 sleep 1
34
35 serial=`dmesg | grep 'on chaoskey' | tail -1 | sed 's/.*chaoskey \([0-9a-f][0-9a-f]*\) on chaoskey.*/\1/'`
36
37 echo 'Testing ChaosKey' $serial
38
39 ./test-chaoskey $serial
40
41 exit $?