ao-bringup: Get turnon_telemini working
authorKeith Packard <keithp@keithp.com>
Sat, 5 Apr 2014 06:36:34 +0000 (23:36 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 5 Apr 2014 07:22:30 +0000 (00:22 -0700)
This script now does complete testing of the board

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-bringup/test-igniter
ao-bringup/turnon_easymini [changed mode: 0644->0755]

index 72dd7723a0e1a291b288272e4a882eae84084c55..454f63289e859cf245f256c4ec0c07de821f162c 100755 (executable)
@@ -98,10 +98,32 @@ do_igniter(file f, string igniter) {
        return true;
 }
 
+file
+open_tty(string name)
+{
+       int i = 0;
+       for (;;) {
+               try {
+                       return open (name, "r+");
+               } catch open_error(string error, File::error_type error, string name) {
+                       if (error == File::error_type.BUSY) {
+                               if (i < 30) {
+                                       printf ("waiting for %s to be usable\n", name);
+                                       sleep(2000);
+                                       continue;
+                               }
+                       } else {
+                               printf ("%s: %s\n", name, error);
+                               exit(1);
+                       }
+               }
+       }
+}
+
 void main () {
        string  name = argv[1];
        string[dim(argv)-2]     igniters = { [i] = argv[i+2] };
-       file    f = open(name, "r+");
+       file    f = open_tty(name);
        bool ret = true;
 
        for (int i = 0; i < dim(igniters); i++) {
old mode 100644 (file)
new mode 100755 (executable)
index 3c24aa2..db2b324
@@ -20,7 +20,8 @@ fi
 
 VERSION=1.0
 PRODUCT=EasyMini
-#VERSION=0.1
+BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'`
+echo $FILE
 
 echo "$PRODUCT v$VERSION Turn-On and Calibration Program"
 echo "Copyright 2010 by Bdale Garbee.  Released under GPL v2"
@@ -34,23 +35,24 @@ read SERIAL
 
 echo $FLASH_LPC
 
-$FLASH_LPC ../src/easymini-v$VERSION/flash-loader/*.elf || exit 1
+$FLASH_LPC ../src/$BASE-v$VERSION/flash-loader/$BASE-v$VERSION-altos-flash-*.elf || exit 1
 
-sleep 2
+sleep 1
+
+echo $USBLOAD
 
-$USBLOAD --serial=$SERIAL ../src/easymini-v$VERSION/*.ihx || exit 1
-#$USBLOAD --serial=$SERIAL /usr/share/altos/telemega-v$VERSION*.ihx || exit 1
+$USBLOAD --serial=$SERIAL ../src/$BASE-v$VERSION/*.ihx || exit 1
 
 sleep 2
 
-dev=`ao-list | awk '/$PRODUCT-v'"$VERSION"'/ { print $3; exit(0); }'`
+dev=`ao-list | awk '/'"$PRODUCT"'-v'"$VERSION"'/ { print $3; exit(0); }'`
 
 case "$dev" in
 /dev/tty*)
        echo "$PRODUCT found on $dev"
        ;;
 *)
-       echo 'No $PRODUCT-v'"$VERSION"' found'
+       echo 'No '"$PRODUCT"'-v'"$VERSION"' found'
        exit 1
        ;;
 esac
@@ -76,3 +78,19 @@ case $? in
        echo "failed"
        exit 1
 esac
+
+FLASHSIZE=1048576
+
+echo "Testing flash"
+./test-flash "$dev" "$FLASHSIZE"
+
+case $? in
+0)
+       ;;
+*)
+       echo "failed"
+       exit 1
+esac
+
+echo "$PRODUCT-v$VERSION" serial "$SERIAL" is ready to ship
+exit 0