Skip to content

Commit 2567e5b

Browse files
committed
Make abstractauto register optional in debug module
Add --dm-no-abstractauto flag to disable support for the optional abstractauto register. When disabled, writes to the register are ignored and the internal state is kept at 0. Currently, neither riscv-openocd nor openocd support batch reads or writes for debug modules that don’t implement abstractauto, as both assume every debug module provides abstractauto support. However, work is underway to remove this dependency.
1 parent 6fc3463 commit 2567e5b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

riscv/debug_module.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,10 +1101,16 @@ bool debug_module_t::dmi_write(unsigned address, uint32_t value)
11011101
return true;
11021102

11031103
case DM_ABSTRACTAUTO:
1104-
abstractauto.autoexecprogbuf = get_field(value,
1105-
DM_ABSTRACTAUTO_AUTOEXECPROGBUF);
1106-
abstractauto.autoexecdata = get_field(value,
1107-
DM_ABSTRACTAUTO_AUTOEXECDATA);
1104+
if (config.support_abstractauto) {
1105+
abstractauto.autoexecprogbuf = get_field(value,
1106+
DM_ABSTRACTAUTO_AUTOEXECPROGBUF);
1107+
abstractauto.autoexecdata = get_field(value,
1108+
DM_ABSTRACTAUTO_AUTOEXECDATA);
1109+
}
1110+
else {
1111+
abstractauto.autoexecprogbuf = 0;
1112+
abstractauto.autoexecdata = 0;
1113+
}
11081114
return true;
11091115
case DM_SBCS:
11101116
sbcs.readonaddr = get_field(value, DM_SBCS_SBREADONADDR);

riscv/debug_module.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct debug_module_config_t {
2424
bool support_abstract_fpr_access = true;
2525
bool support_haltgroups = true;
2626
bool support_impebreak = true;
27+
bool support_abstractauto = true;
2728
};
2829

2930
struct dmcontrol_t {

spike_main/spike.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static void help(int exit_code = 1)
8484
fprintf(stderr, " --dm-no-abstract-fpr Debug module won't support abstract FPR access\n");
8585
fprintf(stderr, " --dm-no-halt-groups Debug module won't support halt groups\n");
8686
fprintf(stderr, " --dm-no-impebreak Debug module won't support implicit ebreak in program buffer\n");
87+
fprintf(stderr, " --dm-no-abstractauto Debug module won't support the abstractauto register\n");
8788
fprintf(stderr, " --blocksz=<size> Cache block size (B) for CMO operations(powers of 2) [default 64]\n");
8889
fprintf(stderr, " --instructions=<n> Stop after n instructions\n");
8990

@@ -434,6 +435,8 @@ int main(int argc, char** argv)
434435
[&](const char UNUSED *s){dm_config.support_abstract_fpr_access = false;});
435436
parser.option(0, "dm-no-halt-groups", 0,
436437
[&](const char UNUSED *s){dm_config.support_haltgroups = false;});
438+
parser.option(0, "dm-no-abstractauto", 0,
439+
[&](const char UNUSED *s){dm_config.support_abstractauto = false;});
437440
parser.option(0, "log-commits", 0,
438441
[&](const char UNUSED *s){log_commits = true;});
439442
parser.option(0, "log", 1,

0 commit comments

Comments
 (0)