diff options
author | Uros Majstorovic <majstor@majstor.org> | 2019-12-04 06:11:35 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2019-12-04 06:11:35 +0100 |
commit | 31578e285a21a749a49e3ac146feb8b02fcc7b52 (patch) | |
tree | e67f619360352a87fb6e0f410f5246468fbc1073 /code/fe310/scripts | |
parent | 2c981aec5e5c10f9fd036dfb48105b16f16e4233 (diff) |
added new metal sdk
Diffstat (limited to 'code/fe310/scripts')
-rwxr-xr-x | code/fe310/scripts/start.sh | 5 | ||||
-rwxr-xr-x | code/fe310/scripts/upload | 47 |
2 files changed, 52 insertions, 0 deletions
diff --git a/code/fe310/scripts/start.sh b/code/fe310/scripts/start.sh new file mode 100755 index 0000000..c5dc990 --- /dev/null +++ b/code/fe310/scripts/start.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +export RISCV_HOME=/opt/my/riscv/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin +export RISCV_OPENOCD_HOME=/opt/my/riscv/riscv-openocd-0.10.0-2019.08.2-x86_64-apple-darwin +export FE310_HOME=/Volumes/ecp/repo/code/fe310 diff --git a/code/fe310/scripts/upload b/code/fe310/scripts/upload new file mode 100755 index 0000000..a52fc0a --- /dev/null +++ b/code/fe310/scripts/upload @@ -0,0 +1,47 @@ +#!/bin/bash + +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" == "" -a "$hex" == "" ] +then + 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 |