aboutsummaryrefslogtreecommitdiff
path: root/spike_main/spike.cc
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-05-14 11:02:15 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2019-05-29 08:35:12 -0700
commit2af9a7a9e403bee126d78861156019eb94f6b2de (patch)
tree163aafe6ce270eaae8ef81c2d0e021975688b01f /spike_main/spike.cc
parent1946b11d7400c85f5786d016f4b2ac63e18d7e83 (diff)
downloadspike-2af9a7a9e403bee126d78861156019eb94f6b2de.zip
spike-2af9a7a9e403bee126d78861156019eb94f6b2de.tar.gz
spike-2af9a7a9e403bee126d78861156019eb94f6b2de.tar.bz2
Clean up debug module options. (#299)
* Clean up debug module options. 1. Instead of passing each one a few levels deep, create debug_module_config_t which contains them all. 2. Rename all those command line options so they start with --dm for debug module. 3. Add --dm-no-halt-groups to disable halt group support. * Update changelog. Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'spike_main/spike.cc')
-rw-r--r--spike_main/spike.cc56
1 files changed, 31 insertions, 25 deletions
diff --git a/spike_main/spike.cc b/spike_main/spike.cc
index 6be28d0..6341c83 100644
--- a/spike_main/spike.cc
+++ b/spike_main/spike.cc
@@ -41,16 +41,17 @@ static void help(int exit_code = 1)
fprintf(stderr, " --rbb-port=<port> Listen on <port> for remote bitbang connection\n");
fprintf(stderr, " --dump-dts Print device tree string and exit\n");
fprintf(stderr, " --disable-dtb Don't write the device tree blob into memory\n");
- fprintf(stderr, " --progsize=<words> Progsize for the debug module [default 2]\n");
- fprintf(stderr, " --debug-sba=<bits> Debug bus master supports up to "
+ fprintf(stderr, " --dm-progsize=<words> Progsize for the debug module [default 2]\n");
+ fprintf(stderr, " --dm-sba=<bits> Debug bus master supports up to "
"<bits> wide accesses [default 0]\n");
- fprintf(stderr, " --debug-auth Debug module requires debugger to authenticate\n");
+ fprintf(stderr, " --dm-auth Debug module requires debugger to authenticate\n");
fprintf(stderr, " --dmi-rti=<n> Number of Run-Test/Idle cycles "
"required for a DMI access [default 0]\n");
- fprintf(stderr, " --abstract-rti=<n> Number of Run-Test/Idle cycles "
+ fprintf(stderr, " --dm-abstract-rti=<n> Number of Run-Test/Idle cycles "
"required for an abstract command to execute [default 0]\n");
- fprintf(stderr, " --without-hasel Debug module supports hasel\n");
- fprintf(stderr, " --debug-no-abstract-csr Debug module won't support abstract to authenticate\n");
+ fprintf(stderr, " --dm-no-hasel Debug module supports hasel\n");
+ fprintf(stderr, " --dm-no-abstract-csr Debug module won't support abstract to authenticate\n");
+ fprintf(stderr, " --dm-no-halt-groups Debug module won't support halt groups\n");
exit(exit_code);
}
@@ -116,13 +117,16 @@ int main(int argc, char** argv)
const char* varch = DEFAULT_VARCH;
uint16_t rbb_port = 0;
bool use_rbb = false;
- unsigned progsize = 2;
- unsigned max_bus_master_bits = 0;
- bool require_authentication = false;
unsigned dmi_rti = 0;
- unsigned abstract_rti = 0;
- bool support_hasel = true;
- bool support_abstract_csr_access = true;
+ debug_module_config_t dm_config = {
+ .progbufsize = 2,
+ .max_bus_master_bits = 0,
+ .require_authentication = false,
+ .abstract_rti = 0,
+ .support_hasel = true,
+ .support_abstract_csr_access = true,
+ .support_haltgroups = true
+ };
std::vector<int> hartids;
auto const hartids_parser = [&](const char *s) {
@@ -167,19 +171,22 @@ int main(int argc, char** argv)
exit(-1);
}
});
- parser.option(0, "progsize", 1, [&](const char* s){progsize = atoi(s);});
- parser.option(0, "debug-sba", 1,
- [&](const char* s){max_bus_master_bits = atoi(s);});
- parser.option(0, "debug-auth", 0,
- [&](const char* s){require_authentication = true;});
+ parser.option(0, "dm-progsize", 1,
+ [&](const char* s){dm_config.progbufsize = atoi(s);});
+ parser.option(0, "dm-sba", 1,
+ [&](const char* s){dm_config.max_bus_master_bits = atoi(s);});
+ parser.option(0, "dm-auth", 0,
+ [&](const char* s){dm_config.require_authentication = true;});
parser.option(0, "dmi-rti", 1,
[&](const char* s){dmi_rti = atoi(s);});
- parser.option(0, "abstract-rti", 1,
- [&](const char* s){abstract_rti = atoi(s);});
- parser.option(0, "without-hasel", 0,
- [&](const char* s){support_hasel = false;});
- parser.option(0, "debug-no-abstract-csr", 0,
- [&](const char* s){support_abstract_csr_access = false;});
+ parser.option(0, "dm-abstract-rti", 1,
+ [&](const char* s){dm_config.abstract_rti = atoi(s);});
+ parser.option(0, "dm-no-hasel", 0,
+ [&](const char* s){dm_config.support_hasel = false;});
+ parser.option(0, "dm-no-abstract-csr", 0,
+ [&](const char* s){dm_config.support_abstract_csr_access = false;});
+ parser.option(0, "dm-no-halt-groups", 0,
+ [&](const char* s){dm_config.support_haltgroups = false;});
auto argv1 = parser.parse(argv);
std::vector<std::string> htif_args(argv1, (const char*const*)argv + argc);
@@ -190,8 +197,7 @@ int main(int argc, char** argv)
help();
sim_t s(isa, varch, nprocs, halted, start_pc, mems, htif_args, std::move(hartids),
- progsize, max_bus_master_bits, require_authentication,
- abstract_rti, support_hasel, support_abstract_csr_access);
+ dm_config);
std::unique_ptr<remote_bitbang_t> remote_bitbang((remote_bitbang_t *) NULL);
std::unique_ptr<jtag_dtm_t> jtag_dtm(
new jtag_dtm_t(&s.debug_module, dmi_rti));