diff options
author | Nathaniel Graff <nathaniel.graff@sifive.com> | 2019-03-06 13:08:22 -0800 |
---|---|---|
committer | Nathaniel Graff <nathaniel.graff@sifive.com> | 2019-03-06 13:39:36 -0800 |
commit | 6aab6996dbd890c5788bf4e330454a3490268174 (patch) | |
tree | 83596e3e6ed4d1fa832f6771cdee2ee35c070b95 /scripts/upload | |
parent | cc49f2721ad0c59ce829b4547644345e7a399068 (diff) |
Add support for Segger J-Link
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Diffstat (limited to 'scripts/upload')
-rwxr-xr-x | scripts/upload | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/upload b/scripts/upload index 66e9ed8..a52fc0a 100755 --- a/scripts/upload +++ b/scripts/upload @@ -4,31 +4,44 @@ set -e set -o pipefail unset elf +unset hex unset cfg unset openocd +unset jlink unset gdb while [[ "$1" != "" ]] do case "$1" in --elf) elf="$2"; shift 2;; + --hex) hex="$2"; shift 2;; --openocd) openocd="$2"; shift 2;; --openocd-config) cfg="$2"; shift 2;; + --jlink) jlink="$2"; shift 2;; --gdb) gdb="$2"; shift 2;; *) echo "$0: Unknown argument $1"; exit 1;; esac done -if [[ "$elf" == "" ]] +if [ "$elf" == "" -a "$hex" == "" ] then - echo "$0: --elf is required" >&2 + echo "$0: --elf or --hex is required" >&2 exit 1 fi export GDB_PORT=3333 +if [ "$jlink" != "" ] +then + +echo -e "loadfile $hex\nrnh\nexit" | $jlink -device FE310 -if JTAG -speed 4000 -jtagconf -1,-1 -autoconnect 1 + +else + $openocd -f $cfg & $gdb $elf --batch -ex "set remotetimeout 240" -ex "target extended-remote localhost:${GDB_PORT}" -ex "monitor reset halt" -ex "monitor flash protect 0 64 last off" -ex "load" -ex "monitor resume" -ex "monitor shutdown" -ex "quit" kill %1 + +fi |