From 33bb9e4c3e5dd408142e772b117520a349450c9c Mon Sep 17 00:00:00 2001 From: Edward Jones Date: Wed, 24 Apr 2019 10:35:03 +0100 Subject: [PATCH 1/3] Detect _exit by matching the _exit breakpoint This should work more consistently than looking for a call to __internal_syscall, which was very library specific. testsuite/ChangeLog: * config/ri5cyverilator.exp (beebs_load): Check for _exit breakpoint instead of __internal_syscall when trying to detect exit. --- testsuite/ChangeLog | 6 ++++++ testsuite/config/ri5cyverilator.exp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index a1ba673e..68ce7bab 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-23 Edward Jones + + * config/ri5cyverilator.exp (beebs_load): Check for + _exit breakpoint instead of __internal_syscall when trying + to detect exit. + 2019-04-10 Jeremy Bennett This gives greater flexibility when testing with BEEBS. The diff --git a/testsuite/config/ri5cyverilator.exp b/testsuite/config/ri5cyverilator.exp index 13a2f6ae..d03592a1 100644 --- a/testsuite/config/ri5cyverilator.exp +++ b/testsuite/config/ri5cyverilator.exp @@ -95,7 +95,7 @@ proc beebs_load { file } { # _exit and check its argument instead). send "cont\n" expect { - -re ".*__internal_syscall.*n=93.*" { + -re ".*stopped.*_exit.*" { send "print \$a0\n" } timeout { From dbf6b68fc551b36ba697f8f78538a8533bfbf5f7 Mon Sep 17 00:00:00 2001 From: Edward Jones Date: Tue, 23 Apr 2019 11:42:01 +0100 Subject: [PATCH 2/3] Fix ri5cy chip flags to match arch and abi (rv32imc ilp32) ChangeLog: * config/riscv32/chips/ri5cy/chip.cfg: Change CHIP_CFLAGS to match architecture of ri5cy (-march=rv32imc -mabi=ilp32) --- ChangeLog | 5 +++++ config/riscv32/chips/ri5cy/chip.cfg | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 45ef5008..3b5f9f3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-04-24 Edward Jones + + * config/riscv32/chips/ri5cy/chip.cfg: Change CHIP_CFLAGS to + match architecture of ri5cy (-march=rv32imc -mabi=ilp32) + 2019-04-24 Jeremy Bennett The initial data for FDCT was in a global block, overwritten by diff --git a/config/riscv32/chips/ri5cy/chip.cfg b/config/riscv32/chips/ri5cy/chip.cfg index 1f2edad7..0c0f2d6e 100644 --- a/config/riscv32/chips/ri5cy/chip.cfg +++ b/config/riscv32/chips/ri5cy/chip.cfg @@ -19,4 +19,4 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see . -export CHIP_CFLAGS="-march=rv32i" +export CHIP_CFLAGS="-march=rv32imc -mabi=ilp32" From 75c94b59dc47f2ffd53ca04a0dd48452f21418b9 Mon Sep 17 00:00:00 2001 From: Edward Jones Date: Wed, 24 Apr 2019 11:09:32 +0100 Subject: [PATCH 3/3] ri5cy: Allow gdbserver command override with env variable This allows an alternative gdbserver command to be used when running the tests. testsuite/ChangeLog: * config/ri5cyverilator.exp (beebs_load): Pick up GDBSERVER_CMD environment variable if set. --- testsuite/ChangeLog | 5 +++++ testsuite/config/ri5cyverilator.exp | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 68ce7bab..0fdf3863 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-24 Edward Jones + + * config/ri5cyverilator.exp (beebs_load): Pick up + GDBSERVER_CMD environment variable if set. + 2019-04-23 Edward Jones * config/ri5cyverilator.exp (beebs_load): Check for diff --git a/testsuite/config/ri5cyverilator.exp b/testsuite/config/ri5cyverilator.exp index d03592a1..000d867e 100644 --- a/testsuite/config/ri5cyverilator.exp +++ b/testsuite/config/ri5cyverilator.exp @@ -23,7 +23,13 @@ set_board_info beebs,benchmarks "$env(BENCHMARKS)" proc beebs_load { file } { set GDB riscv32-unknown-elf-gdb - set GDB_SERVER riscv32-gdbserver + set GDBSERVER_CMD "riscv32-gdbserver -c ri5cy --stdin" + + # Maybe override the gdbserver command with an environment variable + if { [llength [array names ::env GDBSERVER_CMD]] > 0 } { + set GDBSERVER_CMD $::env(GDBSERVER_CMD) + verbose "GDBSERVER_CMD set to $GDBSERVER_CMD" + } # Launch GDB, the target, and start running. # @@ -37,7 +43,7 @@ proc beebs_load { file } { # We set all required breakpoints here then begin execution. spawn $GDB --interpreter=mi -ex "set height 0" \ -ex "file $file" \ - -ex "target remote | $GDB_SERVER -c ri5cy --stdin" \ + -ex "target remote | $GDBSERVER_CMD" \ -ex "stepi" \ -ex "stepi" \ -ex "load" \