From 747a54b103160bcac7c9dcf721ce3b4703577d73 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 23 Aug 2018 16:54:36 -0700 Subject: [PATCH] Add --disable-dtb option to suppress writing the DTB to memory --- riscv/sim.cc | 5 +++-- riscv/sim.h | 4 ++++ spike_main/spike.cc | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/riscv/sim.cc b/riscv/sim.cc index b7080f0..44223a7 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -31,7 +31,7 @@ sim_t::sim_t(const char* isa, size_t nprocs, bool halted, reg_t start_pc, unsigned max_bus_master_bits, bool require_authentication) : htif_t(args), mems(mems), procs(std::max(nprocs, size_t(1))), start_pc(start_pc), current_step(0), current_proc(0), debug(false), - remote_bitbang(NULL), + histogram_enabled(false), dtb_enabled(true), remote_bitbang(NULL), debug_module(this, progsize, max_bus_master_bits, require_authentication) { signal(SIGINT, &handle_signal); @@ -202,7 +202,8 @@ char* sim_t::addr_to_mem(reg_t addr) { void sim_t::reset() { - make_dtb(); + if (dtb_enabled) + make_dtb(); } void sim_t::idle() diff --git a/riscv/sim.h b/riscv/sim.h index 97e9ede..b847bdb 100644 --- a/riscv/sim.h +++ b/riscv/sim.h @@ -32,6 +32,9 @@ public: void set_log(bool value); void set_histogram(bool value); void set_procs_debug(bool value); + void set_dtb_enabled(bool value) { + this->dtb_enabled = value; + } void set_remote_bitbang(remote_bitbang_t* remote_bitbang) { this->remote_bitbang = remote_bitbang; } @@ -62,6 +65,7 @@ private: bool debug; bool log; bool histogram_enabled; // provide a histogram of PCs + bool dtb_enabled; remote_bitbang_t* remote_bitbang; // memory-mapped I/O routines diff --git a/spike_main/spike.cc b/spike_main/spike.cc index e5aecab..f922f24 100644 --- a/spike_main/spike.cc +++ b/spike_main/spike.cc @@ -36,6 +36,7 @@ static void help() fprintf(stderr, " --extlib= Shared library to load\n"); fprintf(stderr, " --rbb-port= Listen on 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= Progsize for the debug module [default 2]\n"); fprintf(stderr, " --debug-sba= Debug bus master supports up to " " wide accesses [default 0]\n"); @@ -81,6 +82,7 @@ int main(int argc, char** argv) bool histogram = false; bool log = false; bool dump_dts = false; + bool dtb_enabled = true; size_t nprocs = 1; reg_t start_pc = reg_t(-1); std::vector> mems; @@ -127,6 +129,7 @@ int main(int argc, char** argv) parser.option(0, "isa", 1, [&](const char* s){isa = s;}); parser.option(0, "extension", 1, [&](const char* s){extension = find_extension(s);}); parser.option(0, "dump-dts", 0, [&](const char *s){dump_dts = true;}); + parser.option(0, "disable-dtb", 0, [&](const char *s){dtb_enabled = false;}); parser.option(0, "extlib", 1, [&](const char *s){ void *lib = dlopen(s, RTLD_NOW | RTLD_GLOBAL); if (lib == NULL) { @@ -156,6 +159,7 @@ int main(int argc, char** argv) remote_bitbang.reset(new remote_bitbang_t(rbb_port, &(*jtag_dtm))); s.set_remote_bitbang(&(*remote_bitbang)); } + s.set_dtb_enabled(dtb_enabled); if (dump_dts) { printf("%s", s.get_dts()); -- 2.30.2