Skip to content

Commit

Permalink
Merge pull request #503 from lz-bro/dis_timer
Browse files Browse the repository at this point in the history
Disable timer interrupt to fix some bugs
  • Loading branch information
timsifive authored Oct 11, 2023
2 parents 9905a43 + ecf4fde commit 34fb040
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions debug/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,8 +1039,10 @@ def test(self):
local = self.gdb.p("local")
if interrupt_count > 1000 and \
local > 1000:
self.disable_timer()
return

self.disable_timer()
assertGreater(interrupt_count, 1000)
assertGreater(local, 1000)

Expand Down Expand Up @@ -1191,6 +1193,8 @@ def test(self):
time.sleep(1)
self.gdb.p("buf", fmt="")

self.disable_timer(interrupt=True)

class MulticoreRtosSwitchActiveHartTest(GdbTest):
compile_args = ("programs/multicore.c", "-DMULTICORE")

Expand Down Expand Up @@ -1220,6 +1224,8 @@ def test(self):
assertIn("set_trap_handler", output)
assertNotIn("received signal SIGTRAP", output)

self.disable_timer()

class SmpSimultaneousRunHalt(GdbTest):
compile_args = ("programs/run_halt_timing.S", "-DMULTICORE")

Expand Down
7 changes: 7 additions & 0 deletions debug/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,13 @@ def disable_pmp(self):
# PMP registers are optional
pass

def disable_timer(self, interrupt=False):
for hart in self.target.harts:
self.gdb.select_hart(hart)
if interrupt:
self.gdb.interrupt()
self.gdb.p("$mie=$mie & ~0x80")

def exit(self, expected_result=10):
self.gdb.command("delete")
self.gdb.b("_exit")
Expand Down

0 comments on commit 34fb040

Please sign in to comment.