1
0
mirror of https://github.com/raphnet/gc_n64_usb-v3 synced 2024-11-10 19:25:07 -05:00
gc_n64_usb-v3/wait_then_flash.sh
Raphael Assenat c59242383f WIP
2015-06-13 23:44:21 -04:00

28 lines
421 B
Bash
Executable File

#!/bin/bash
if [ $# -ne 2 ]; then
echo "Syntax: ./wait_then_flash.sh CPU HEXFILE"
exit 1;
fi
CPU=$1
HEXFILE=$2
echo "Will program $HEXFILE on $CPU target"
echo "Polling for chip..."
while true; do
dfu-programmer $1 erase
if [ $? -eq 0 ]; then
echo "Chip found. Erased."
break;
fi
sleep 1
done
echo "Writing flash..."
dfu-programmer $CPU flash $HEXFILE
echo "Starting program..."
dfu-programmer $CPU start