summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2018-12-13 18:15:05 -0800
committerGitHub <noreply@github.com>2018-12-13 18:15:05 -0800
commit0c3b3d75eadffb9ab1d85e811cac55d54ac9d3ca (patch)
tree084c876c10af7b31f73c2d8cfb7cc4511053c128 /scripts
parentdca1dfaf1cfb80ec30a7a16b899efa1040e3451d (diff)
parent853e244604682b57e88535671b9c66cfbd3e8f3f (diff)
Merge pull request #113 from sifive/add-mee-support
Add MEE Support
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/debug34
-rwxr-xr-xscripts/upload34
2 files changed, 68 insertions, 0 deletions
diff --git a/scripts/debug b/scripts/debug
new file mode 100755
index 0000000..d02c42c
--- /dev/null
+++ b/scripts/debug
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -e
+set -o pipefail
+
+unset elf
+unset cfg
+unset openocd
+unset gdb
+while [[ "$1" != "" ]]
+do
+ case "$1"
+ in
+ --elf) elf="$2"; shift 2;;
+ --openocd) openocd="$2"; shift 2;;
+ --openocd-config) cfg="$2"; shift 2;;
+ --gdb) gdb="$2"; shift 2;;
+ *) echo "$0: Unknown argument $1"; exit 1;;
+ esac
+done
+
+if [[ "$elf" == "" ]]
+then
+ echo "$0: --elf is required" >&2
+ exit 1
+fi
+
+export GDB_PORT=3333
+
+$openocd -f $cfg &
+
+$gdb $elf -ex "set remotetimeout 240" -ex "target extended-remote localhost:${GDB_PORT}"
+
+kill %1
diff --git a/scripts/upload b/scripts/upload
new file mode 100755
index 0000000..66e9ed8
--- /dev/null
+++ b/scripts/upload
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+set -e
+set -o pipefail
+
+unset elf
+unset cfg
+unset openocd
+unset gdb
+while [[ "$1" != "" ]]
+do
+ case "$1"
+ in
+ --elf) elf="$2"; shift 2;;
+ --openocd) openocd="$2"; shift 2;;
+ --openocd-config) cfg="$2"; shift 2;;
+ --gdb) gdb="$2"; shift 2;;
+ *) echo "$0: Unknown argument $1"; exit 1;;
+ esac
+done
+
+if [[ "$elf" == "" ]]
+then
+ echo "$0: --elf is required" >&2
+ exit 1
+fi
+
+export GDB_PORT=3333
+
+$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