From 2b116f9fb820641cb0a3a04e51164f2ef76478d6 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Tue, 18 Apr 2017 15:09:55 -0700 Subject: [PATCH] debug: Don't halt out of reset. It's unrealistic. Use a program which loops (actually it just gets an exception anyway). --- debug/programs/infinite_loop | Bin 0 -> 6344 bytes debug/programs/infinite_loop.c | 14 ++++++++++++++ debug/targets.py | 4 ++-- debug/targets/spike/openocd.cfg | 3 ++- debug/testlib.py | 4 ++-- 5 files changed, 20 insertions(+), 5 deletions(-) create mode 100755 debug/programs/infinite_loop create mode 100644 debug/programs/infinite_loop.c diff --git a/debug/programs/infinite_loop b/debug/programs/infinite_loop new file mode 100755 index 0000000000000000000000000000000000000000..628fd246c2866cd223cff9eaf15dd9cdc10fb11d GIT binary patch literal 6344 zcmeHML2nyH6n?X_-i>R!-qwYJK*-Is&?4ck(@o>1Zflf65g=5Ms$L?k9Cw>o*k0pZ zp)^7wlNB@v4uw5bqDZ6?;=-xwfom%92e@+p^#>$X!wGPBCRdsD zxymYcRaU*HGV_7PtRFR2`9)*ZM;bFp8ue+^r%|6qeFpUz)MrqiL46MOIn?J+pF@2f z^?B6iQJ?pY6|Kj|46C3K*nrwAp7E6R{W!p#6=m65Q_R5RK+A*#Wlrb>QGyAs&{Kp4 zr#Ph+Q3H#sbdsckNuHvoi58sZ8l56~FvWFRA!9*>kI^$E9h~85I!*Qk(|jL2OESS( zo}pEe4XQj#&yiekj_2rkvOhS__tOg`A6(#h^v3X@Xs%wrIG(isuLt4_fbT+|RXG$? zqJ+8u?8U8q0rB9aANqH0>hSO@y)W>>Cpu7z6XYxN%cHs!grBCMplbttcoXx{E!642 z#<%c34)}jCiz~Pf4fPbT($?>xzNYN8pX6^3?l0aG)R2wMuYVOfagL2m`?pIoGt9=>#Y;G^*;t3R2k#C;u9(b{9uiQs9mb? zXnO<({48M*$PVk15#t4kt0Q=HC<0?6_@v~2G=kS8zD9SS^UWA1yYZ`t?{&`kzrj0* z8+iWN?Cy1z5kH9dPjX)q=ORACCh)2n@rwe)_yXHt9f=P>?7ozET(^z!yEqW*d?VMd z$Oqp_{;an9Jl{!vR<0kP2TuC!?#V{u;#)oc>XniU3-!*mmSguE&+(ztZrUF@4d3m7 z->Y|bjqx4n-2l(8H{Q2>w<||;uJ5~TXm+kQJ5ArQTdvzJHE`baG1>Nf%blyY?5^AF z_)hO=yq#DbY{5cKyWVQK4I7v4`OvO6J77DVYuGK~V<>qy+J1cwv)_yILOk-FMITBH zw=G^^X~@4!&!JwtyV`Ia>8q@(59{ah`LNtB=SMIL{m^fT&mM{fqnAu@MeNLfy-fhC zQvb6gigJDy+n5kzJQF2IW2SPvGc7zF&F<|4aUAa(!{UDKrGHlbcX&A_$~>z76ZE^j At^fc4 literal 0 HcmV?d00001 diff --git a/debug/programs/infinite_loop.c b/debug/programs/infinite_loop.c new file mode 100644 index 0000000..460f78a --- /dev/null +++ b/debug/programs/infinite_loop.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include + + +int main() +{ + + volatile int forever = 1; + while (forever); + + return 1; +} diff --git a/debug/targets.py b/debug/targets.py index d49b397..a69f43d 100644 --- a/debug/targets.py +++ b/debug/targets.py @@ -76,14 +76,14 @@ class Spike64Target(SpikeTarget): use_fpu = True def target(self): - return testlib.Spike(self.sim_cmd, halted=True) + return testlib.Spike(self.sim_cmd) class Spike32Target(SpikeTarget): name = "spike32" xlen = 32 def target(self): - return testlib.Spike(self.sim_cmd, halted=True, xlen=32) + return testlib.Spike(self.sim_cmd, xlen=32) class FreedomE300Target(Target): name = "freedom-e300" diff --git a/debug/targets/spike/openocd.cfg b/debug/targets/spike/openocd.cfg index 881d745..29f5040 100644 --- a/debug/targets/spike/openocd.cfg +++ b/debug/targets/spike/openocd.cfg @@ -13,5 +13,6 @@ target create $_TARGETNAME riscv -chain-position $_TARGETNAME -rtos riscv gdb_report_data_abort enable init - halt + +echo "Ready for Remote Connections" \ No newline at end of file diff --git a/debug/testlib.py b/debug/testlib.py index f1f0fe1..a66d59a 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -78,7 +78,7 @@ class Spike(object): cmd += ['--rbb-port', '0'] os.environ['REMOTE_BITBANG_HOST'] = 'localhost' cmd.append("-m32") - cmd.append('pk') + cmd.append('programs/infinite_loop') if binary: cmd.append(binary) logfile = open(self.logname, "w") @@ -195,7 +195,7 @@ class Openocd(object): messaged = False while True: log = open(Openocd.logname).read() - if "OK GO NOW" in log: + if "Ready for Remote Connections" in log: break if not self.process.poll() is None: raise Exception( -- 2.30.2