Skip to content

Commit 8132213

Browse files
committed
[debug] Support mcontrol6 in TriggerDmode test
1 parent 355f1fb commit 8132213

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

debug/gdbserver.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ def check_triggers(self, tdata1_lsbs, tdata2):
15041504

15051505
return triggers
15061506

1507-
def test(self):
1507+
def test_trigger(self):
15081508
# If we want this test to run from flash, we can't have any software
15091509
# breakpoints set.
15101510

@@ -1521,6 +1521,21 @@ def test(self):
15211521
self.gdb.command("delete")
15221522
self.exit()
15231523

1524+
class McontrolTest(TriggerDmode):
1525+
def early_applicable(self):
1526+
return self.target.support_mcontrol
1527+
1528+
def test(self):
1529+
self.test_trigger()
1530+
1531+
class Mcontrol6Test(TriggerDmode):
1532+
compile_args = ("-DTRIGGER_TYPE=6", "programs/trigger.S", )
1533+
def early_applicable(self):
1534+
return self.target.support_mcontrol6
1535+
1536+
def test(self):
1537+
self.test_trigger()
1538+
15241539
class RegsTest(GdbSingleHartTest):
15251540
compile_args = ("programs/regs.S", )
15261541
def setup(self):

debug/programs/trigger.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
# define LREG lw
99
# define SREG sw
1010
# define REGBYTES 4
11+
#endif
12+
13+
#ifndef TRIGGER_TYPE
14+
# define TRIGGER_TYPE 2
1115
#endif
1216

1317
.global main
@@ -40,15 +44,15 @@ write_loop:
4044
j main_exit
4145

4246
write_store_trigger:
43-
/* 2<<60 is for RV64. 2<<28 is for RV32. That's safe because on RV64 bits 28 and 29 are 0. */
44-
li a0, (2<<60) | (2<<28) | (1<<6) | (1<<1)
47+
/* TRIGGER_TYPE<<60 is for RV64. TRIGGER_TYPE<<28 is for RV32. That's safe because on RV64 bits 28 and 29 are 0. */
48+
li a0, (TRIGGER_TYPE<<60) | (TRIGGER_TYPE<<28) | (1<<6) | (1<<1)
4549
li a1, 0xdeadbee0
4650
jal write_triggers
4751
la a0, data
4852
jal read_triggers
4953

5054
write_load_trigger:
51-
li a0, (2<<60) | (2<<28) | (1<<6) | (1<<0)
55+
li a0, (TRIGGER_TYPE<<60) | (TRIGGER_TYPE<<28) | (1<<6) | (1<<0)
5256
li a1, 0xfeedac00
5357
jal write_triggers
5458
la a0, data

debug/targets.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ class Target:
148148
# Support set_pmp_deny to create invalid addresses.
149149
support_set_pmp_deny = False
150150

151+
# Supports an address/data match trigger of type 2
152+
support_mcontrol = True
153+
154+
# Supports an address/data match trigger of type 6
155+
support_mcontrol6 = True
156+
151157
# Internal variables:
152158
directory = None
153159
temporary_files = []

0 commit comments

Comments
 (0)