diff --git a/common.mk b/common.mk index 3e54463c8a..1ae410cb7f 100644 --- a/common.mk +++ b/common.mk @@ -341,7 +341,9 @@ run-binary-debug: check-binary $(BINARY).run.debug run-binaries-debug: check-binaries $(addsuffix .run.debug,$(BINARIES)) %.run.debug: %.check-exists $(SIM_DEBUG_PREREQ) | $(output_dir) +ifeq (1,$(DUMP_BINARY)) if [ "$*" != "none" ]; then riscv64-unknown-elf-objdump -D -S $* > $(call get_sim_out_name,$*).dump ; fi +endif (set -o pipefail && $(NUMA_PREFIX) $(sim_debug) \ $(PERMISSIVE_ON) \ $(call get_common_sim_flags,$*) \ diff --git a/variables.mk b/variables.mk index 5dfee1968f..bbd5a6b576 100644 --- a/variables.mk +++ b/variables.mk @@ -30,7 +30,8 @@ HELP_SIMULATION_VARIABLES = \ " LOADMEM = riscv elf binary that should be loaded directly into simulated DRAM. LOADMEM=1 will load the BINARY elf" \ " LOADARCH = path to a architectural checkpoint directory that should end in .loadarch/, for restoring from a checkpoint" \ " VERBOSE_FLAGS = flags used when doing verbose simulation [$(VERBOSE_FLAGS)]" \ -" TIMEOUT_CYCLES = number of clock cycles before simulator times out, defaults to 10000000" +" TIMEOUT_CYCLES = number of clock cycles before simulator times out, defaults to 10000000" \ +" DUMP_BINARY = set to '1' to disassemble the target binary" # include default simulation rules HELP_COMMANDS = \ @@ -261,6 +262,7 @@ VERBOSE_FLAGS ?= +verbose get_out_name = $(subst $() $(),_,$(notdir $(basename $(1)))) LOADMEM ?= LOADARCH ?= +DUMP_BINARY ?= 1 ifneq ($(LOADARCH),) override BINARY = $(addsuffix /mem.elf,$(LOADARCH))