debug: Don't halt out of reset. It's unrealistic. Use a program which loops (actually...
authorMegan Wachs <megan@sifive.com>
Tue, 18 Apr 2017 22:09:55 +0000 (15:09 -0700)
committerMegan Wachs <megan@sifive.com>
Tue, 18 Apr 2017 22:09:55 +0000 (15:09 -0700)
debug/programs/infinite_loop [new file with mode: 0755]
debug/programs/infinite_loop.c [new file with mode: 0644]
debug/targets.py
debug/targets/spike/openocd.cfg
debug/testlib.py

diff --git a/debug/programs/infinite_loop b/debug/programs/infinite_loop
new file mode 100755 (executable)
index 0000000..628fd24
Binary files /dev/null and b/debug/programs/infinite_loop differ
diff --git a/debug/programs/infinite_loop.c b/debug/programs/infinite_loop.c
new file mode 100644 (file)
index 0000000..460f78a
--- /dev/null
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+
+int main()
+{
+
+  volatile int forever = 1;
+  while (forever);
+
+  return 1;
+}
index d49b3970670598768fe7cac5dd56bbae79dd7b4f..a69f43d91463924ccee841d7f9aaaac640710a7b 100644 (file)
@@ -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"
index 881d74517976cf6a18d0da64e69443786cabfd55..29f504063de034aa26f9a7e8694f3f1727455bea 100644 (file)
@@ -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
index f1f0fe1606d42b3fa02027a1d25aa679cad640fd..a66d59a7b450baf63e7b99aa6c50ef6e0ded3fec 100644 (file)
@@ -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(