#!/bin/bash # NOTE: I've found it easier to go through gdb running in gud (emacs), # accessed through emacsclient. See http://zwizwa.be/darcs/ecos/bin/gud # Load an ELF file to Flash mememory through the OpenOCD telnet interface. [ -z "$1" ] && echo "usage: $0 " && exit 1 FILE=`readlink -f $1` BASE=0 HOST=localhost PORT=4444 send () { echo "$1" | telnet $HOST $PORT 2>/dev/null >/dev/null } # Commands do get queued this way, but the operation is not # synchronous: we don't know when they're done or whether they # succeed. send "reset halt" send "flash write_image erase $FILE $BASE elf"