From: Bdale Garbee Date: Tue, 13 Apr 2021 00:36:45 +0000 (-0600) Subject: ao-bringup: add tools for flash/cal/test of EasyMotor v2 X-Git-Tag: 1.9.7~1^2~11 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=b8437a3f994845dd84080cc20122494aaf901124 ao-bringup: add tools for flash/cal/test of EasyMotor v2 --- diff --git a/ao-bringup/test-easymotor b/ao-bringup/test-easymotor new file mode 100755 index 00000000..a99ca9d6 --- /dev/null +++ b/ao-bringup/test-easymotor @@ -0,0 +1,40 @@ +#!/bin/sh + +VERSION=2 +PRODUCT=EasyMotor +BASE=`echo $PRODUCT | tr 'A-Z' 'a-z'` + +echo "$PRODUCT-v$VERSION Test Program" +echo "Copyright 2021 by Bdale Garbee. Released under GPL v3" +echo +echo "Expectations:" +echo "\t$PRODUCT v$VERSION powered from USB" +echo + +ret=1 +ao-list | while read product serial dev; do + case "$product" in + "$PRODUCT-v$VERSION") + + echo "Testing $product $serial $dev" + echo "" + + FLASHSIZE=8388608 + + echo "Testing flash" + ../ao-tools/ao-test-flash/ao-test-flash --tty="$dev" "$FLASHSIZE" + + case $? in + 0) + ;; + *) + echo "failed" + exit 1 + esac + echo"" + + echo "$PRODUCT-v$VERSION" serial "$serial" is ready to ship + ret=0 + ;; + esac +done diff --git a/ao-bringup/turnon_easymotor b/ao-bringup/turnon_easymotor new file mode 100755 index 00000000..b9bc0077 --- /dev/null +++ b/ao-bringup/turnon_easymotor @@ -0,0 +1,75 @@ +#!/bin/sh + +PRODUCT=EasyMotor +VERSION=2 +REPO=~/altusmetrumllc/Binaries + +if [ -x /usr/bin/dfu-util ]; then + DFU_UTIL=/usr/bin/dfu-util +else + echo "Can't find dfu-util! Aborting." + exit 1 +fi + +if [ -x /usr/bin/ao-usbload ]; then + USBLOAD=/usr/bin/ao-usbload +else + echo "Can't find ao-usbload! Aborting." + exit 1 +fi + +echo "$PRODUCT v$VERSION Turn-On and Calibration Program" +echo "Copyright 2021 by Bdale Garbee. Released under GPL v3" +echo +echo "Expectations:" +echo "\t$PRODUCT v$VERSION" +echo "\t\twith USB cable attached" +echo + +case $# in + 1) + SERIAL="$1" + echo "$PRODUCT-$VERSION serial number: $SERIAL" + ;; + 0) + echo -n "$PRODUCT-$VERSION serial number: " + read SERIAL + ;; + *) + echo "Usage: $0 " 1>&2 + exit 1; + ;; +esac + + +echo $DFU_UTIL + +$DFU_UTIL -v -v -R -a 0 -s 0x08000000:leave -D $REPO/loaders/easymotor-v$VERSION*.elf + +sleep 3 + +$USBLOAD --serial=$SERIAL $REPO/easymotor-v$VERSION*.elf || exit 1 + +sleep 5 + +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' + exit 1 + ;; +esac + +failed=1 +while [ $failed = 1 ]; do + ../ao-tools/ao-cal-accel/ao-cal-accel $dev + failed=$? +done + +./test-easymotor + +exit $?