2 # Loads firmware image using an SWD Flasher
3 # Uses MCHCK ruby flasher toolchain
4 # NOTE: Only tested with a buspirate on Linux
6 # Arg 1: Path to firmware image
7 # Arg 2: Address to flash to (byte address)
10 if [ "$#" -ne 2 ]; then
11 echo "Usage: `basename $0` <firmware binary> <starting address>"
12 echo "Example: `basename $0` kiibohd_bootloader.bin 0"
16 # First check to see if the flasher toolchain is available
17 if [ ! -d "programmer" ]; then
18 # Use git to download the toolchain
19 git clone https://github.com/mchck/programmer.git
22 # Make sure the toolchain is up to date
28 # Udev rules have been applied to name the buspirate as /dev/buspirate (instead of something like /dev/ttyUSB0)
29 # By default only root can access serial devices on Linux
30 #ruby programmer/flash.rb name=buspirate:dev=/dev/buspirate --mass-erase
31 ruby programmer/flash.rb name=buspirate:dev=/dev/buspirate "$1" "$2"
32 #ruby programmer/flash.rb name=buspirate:dev=/dev/buspirate --mass-erase "$1" "$2"