Allow multiple reset vectors.
authorTim Newsome <tim@sifive.com>
Wed, 20 Sep 2017 00:10:36 +0000 (17:10 -0700)
committerTim Newsome <tim@sifive.com>
Wed, 20 Sep 2017 00:10:36 +0000 (17:10 -0700)
Some boards have jumpers that control the reset vector, and forcing them
one way or another is more annoying than dealing with it in software.

debug/gdbserver.py
debug/targets.py
debug/targets/RISC-V/spike32.py
debug/targets/RISC-V/spike64.py

index d0ad46e553b1afc0c9de7c77e3f153c96138cdfa..135dab82a5ea6c952f385e8482fabebc41d0bf26 100755 (executable)
@@ -217,7 +217,7 @@ class InstantHaltTest(GdbTest):
             self.gdb.thread(t)
             pcs.append(self.gdb.p("$pc"))
         for pc in pcs:
-            assertEqual(self.hart.reset_vector, pc)
+            assertIn(pc, self.hart.reset_vectors)
         # mcycle and minstret have no defined reset value.
         mstatus = self.gdb.p("$mstatus")
         assertEqual(mstatus & (MSTATUS_MIE | MSTATUS_MPRV |
index d661d14a59a4638a3ef2924e142c75699d99ac2e..d09b5764edf51e7c2b922f6c70bf0ad8c83a42e5 100644 (file)
@@ -34,6 +34,11 @@ class Hart(object):
     # Defaults to target-<index>
     name = None
 
+    # When reset, the PC must be at one of the values listed here.
+    # This is a list because on some boards the reset vector depends on
+    # jumpers.
+    reset_vectors = []
+
     def extensionSupported(self, letter):
         # target.misa is set by testlib.ExamineTarget
         if self.misa:
index 665d7e99a56c6ae73e7364a60ef11a33f80b14f5..bcb58927bc0e55205dffa7997edbfafdf94c05f6 100644 (file)
@@ -6,7 +6,7 @@ class spike32_hart(targets.Hart):
     ram = 0x10000000
     ram_size = 0x10000000
     instruction_hardware_breakpoint_count = 4
-    reset_vector = 0x1000
+    reset_vectors = [0x1000]
     link_script_path = "spike32.lds"
 
 class spike32(targets.Target):
index 6e3da896ef01b79a454893fe964def2da1c441ab..9c37f877e544f3d081e8d6b0578ed3125728ad45 100644 (file)
@@ -6,7 +6,7 @@ class spike64_hart(targets.Hart):
     ram = 0x1212340000
     ram_size = 0x10000000
     instruction_hardware_breakpoint_count = 4
-    reset_vector = 0x1000
+    reset_vectors = [0x1000]
     link_script_path = "spike64.lds"
 
 class spike64(targets.Target):