diff --git a/sparc-efl-gcc.txt b/sparc-efl-gcc.txt index 817f1154e803ca79b4ef05357b6a64d3e49d3c32..c4f137845eb101e5ebb0e3bc63dc7317078fc156 100644 --- a/sparc-efl-gcc.txt +++ b/sparc-efl-gcc.txt @@ -5,6 +5,7 @@ objc = 'sparc-elf-gcc' ar = 'sparc-elf-ar' strip = 'sparc-elf-strip' ld = 'sparc-elf-ld' +exe_wrapper = '@GLOBAL_SOURCE_ROOT@' / 'test' / 'tools' / 'flash_run_leon.sh' # pkgconfig = ['false'] # cmake = ['false'] diff --git a/test/tools/flash_run_leon.sh b/test/tools/flash_run_leon.sh new file mode 100755 index 0000000000000000000000000000000000000000..a6a3224af800a94b230acff3b7b87775c4928510 --- /dev/null +++ b/test/tools/flash_run_leon.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + +# This script is custom-tailored for our test setup and may not run everywhere. + +bin_path=${1:-} +if [[ -z "$bin_path" ]]; then + echo "usage: $0 <binary file>" + exit 1 +fi + +rm -f grmon_output +script -c "grmon -freq 80 -ftdi -u -jtagcable 1 -e 'reset; wash; load $bin_path; run; reg i0; exit'" grmon_output + + +if grep -q "Program exited normally" grmon_output; then + if grep -q "i0 =" grmon_output; then + ret=$(grep 'i0 =' grmon_output | tr -s ' ' | cut -d ' ' -f 4) + exit $ret + fi +fi + +exit 1