Add DFU test scripts from usb_audio_testing/dfu

Taken from commit 74c206628de79230f3f9191361fe5fcfa3058e87.
This commit is contained in:
Sam Chesney
2017-06-15 17:37:12 +01:00
parent 414f205144
commit 318ec21ae3
2 changed files with 134 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
#! /bin/bash
################################################################################
function usage {
echo "USAGE: testdfu.sh device_pid device_string upgrade1 upgrade2"
echo " For example:"
echo " testdfu.sh XMOS_SMART_MIC_PLUS_BASE \"XMOS SmartMic\" upgrade1.bin upgrade2.bin"
echo " testdfu.sh 0x0008 \"xCORE\" upgrade1.bin upgrade2.bin"
exit 1
}
#find out were we are running from so we only exec this programs
PROGDIR=`dirname $0`
#setup environment
export DYLD_LIBRARY_PATH=$PROGDIR:$DYLD_LIBRARY_PATH
if [ "$1" != "" ]; then
device_pid=$1
else
usage
fi
if [ "$2" != "" ]; then
device_grep_string=$2
else
usage
fi
if [ "$3" != "" ]; then
update1=$3
else
usage
fi
if [ "$4" != "" ]; then
update2=$4
else
usage
fi
#basic check for binary
if [ ! -f $update1 ]; then
echo "FATAL: can't find update binary named $update1"
exit 1
fi
if [ ! -f $update2 ]; then
echo "FATAL: can't find update binary named $update2"
exit 1
fi
#-------------------------------------------------------------------------------
echo ""
echo DFU test
echo --------
sleep 5
echo "Version Read:"
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
echo ""
echo "*** DFU download new firmware 1 ***"
$PROGDIR/xmosdfu $device_pid --download $update1
sleep 2
echo "Version Read:"
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
echo ""
echo "*** DFU download new firmware 2 ***"
$PROGDIR/xmosdfu $device_pid --download $update2
sleep 2
echo "Version Read:"
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
echo ""
echo "*** DFU upload existing firmware ***"
$PROGDIR/xmosdfu $device_pid --upload upload.bin
sleep 2
echo "Version Read:"
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
echo ""
echo "*** DFU revert to factory ***"
$PROGDIR/xmosdfu $device_pid --revertfactory
sleep 2
echo "Version Read:"
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
echo ""
echo "*** DFU download uploaded firmware ***"
$PROGDIR/xmosdfu $device_pid --download upload.bin
sleep 2
echo "Version Read:"
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
echo ""
echo "*** DFU revert to factory ***"
$PROGDIR/xmosdfu $device_pid --revertfactory
sleep 2
echo "Version Read:"
system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version
echo ""
echo DFU Test Complete!