From 309ab68e79b9212963ee8e72e7966af043946ea2 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Thu, 6 May 2021 00:55:57 -0700 Subject: [PATCH 1/5] Use .sbtopts file --- .sbtopts | 2 ++ variables.mk | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .sbtopts diff --git a/.sbtopts b/.sbtopts new file mode 100644 index 0000000000..2358d78748 --- /dev/null +++ b/.sbtopts @@ -0,0 +1,2 @@ +-Dsbt.sourcemode=true +-Dsbt.workspace=$PWD/tools diff --git a/variables.mk b/variables.mk index 2843e53e54..b83693e62d 100644 --- a/variables.mk +++ b/variables.mk @@ -152,7 +152,10 @@ JAVA_OPTS ?= -Xmx$(JAVA_HEAP_SIZE) -Xss8M -XX:MaxPermSize=256M -Djava.io.tmpdir= # default sbt launch command ######################################################################################### # by default build chisel3/firrtl and other subprojects from source -override SBT_OPTS += -Dsbt.sourcemode=true -Dsbt.workspace=$(base_dir)/tools +SBT_OPTS_FILE := $(base_dir)/.sbtopts +ifneq (,$(wildcard $(SBT_OPTS_FILE))) +override SBT_OPTS += $(subst $$PWD,$(base_dir),$(shell cat $(SBT_OPTS_FILE))) +endif SCALA_BUILDTOOL_DEPS = $(SBT_SOURCES) From f9957b2ce34d1774a9fbdcf4b165d87c55f8ac07 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Thu, 6 May 2021 00:56:14 -0700 Subject: [PATCH 2/5] Check for BINARY flag when doing run-* --- common.mk | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common.mk b/common.mk index 89e998bdaf..3535261283 100644 --- a/common.mk +++ b/common.mk @@ -162,16 +162,21 @@ verilog: $(sim_vsrcs) ######################################################################################### .PHONY: run-binary run-binary-fast run-binary-debug run-fast +check-binary: +ifndef BINARY + $(error BINARY variable is not set. Set it to the simulation binary) +endif + # run normal binary with hardware-logged insn dissassembly -run-binary: $(output_dir) $(sim) +run-binary: $(output_dir) $(sim) $(check-binary) (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(SEED_FLAG) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $(BINARY) >(spike-dasm > $(sim_out_name).out) | tee $(sim_out_name).log) # run simulator as fast as possible (no insn disassembly) -run-binary-fast: $(output_dir) $(sim) +run-binary-fast: $(output_dir) $(sim) $(check-binary) (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(SEED_FLAG) $(PERMISSIVE_OFF) $(BINARY) >(spike-dasm > $(sim_out_name).out) | tee $(sim_out_name).log) run-fast: run-asm-tests-fast run-bmark-tests-fast @@ -182,16 +187,19 @@ run-fast: run-asm-tests-fast run-bmark-tests-fast $(binary_hex): $(output_dir) $(BINARY) $(base_dir)/scripts/smartelf2hex.sh $(BINARY) > $(binary_hex) +run-binary-hex: $(check-binary) run-binary-hex: $(output_dir) $(sim) $(binary_hex) run-binary-hex: run-binary run-binary-hex: override LOADMEM_ADDR = 80000000 run-binary-hex: override LOADMEM = $(binary_hex) run-binary-hex: override SIM_FLAGS += +loadmem=$(LOADMEM) +loadmem_addr=$(LOADMEM_ADDR) +run-binary-debug-hex: $(check-binary) run-binary-debug-hex: $(output_dir) $(sim) $(binary_hex) run-binary-debug-hex: run-binary-debug run-binary-debug-hex: override LOADMEM_ADDR = 80000000 run-binary-debug-hex: override LOADMEM = $(binary_hex) run-binary-debug-hex: override SIM_FLAGS += +loadmem=$(LOADMEM) +loadmem_addr=$(LOADMEM_ADDR) +run-binary-fast-hex: $(check-binary) run-binary-fast-hex: $(output_dir) $(sim) $(binary_hex) run-binary-fast-hex: run-binary-fast run-binary-fast-hex: override LOADMEM_ADDR = 80000000 From 365e2ea81e3a24ffbf3ef32780fcdf726617fbd6 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Thu, 6 May 2021 01:11:30 -0700 Subject: [PATCH 3/5] Fix BINARY check --- common.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common.mk b/common.mk index 3535261283..ac80af91a7 100644 --- a/common.mk +++ b/common.mk @@ -163,20 +163,20 @@ verilog: $(sim_vsrcs) .PHONY: run-binary run-binary-fast run-binary-debug run-fast check-binary: -ifndef BINARY +ifeq (,$(BINARY)) $(error BINARY variable is not set. Set it to the simulation binary) endif # run normal binary with hardware-logged insn dissassembly -run-binary: $(output_dir) $(sim) $(check-binary) +run-binary: $(output_dir) $(sim) check-binary (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(SEED_FLAG) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $(BINARY) >(spike-dasm > $(sim_out_name).out) | tee $(sim_out_name).log) # run simulator as fast as possible (no insn disassembly) -run-binary-fast: $(output_dir) $(sim) $(check-binary) +run-binary-fast: $(output_dir) $(sim) check-binary (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(SEED_FLAG) $(PERMISSIVE_OFF) $(BINARY) >(spike-dasm > $(sim_out_name).out) | tee $(sim_out_name).log) run-fast: run-asm-tests-fast run-bmark-tests-fast @@ -187,19 +187,19 @@ run-fast: run-asm-tests-fast run-bmark-tests-fast $(binary_hex): $(output_dir) $(BINARY) $(base_dir)/scripts/smartelf2hex.sh $(BINARY) > $(binary_hex) -run-binary-hex: $(check-binary) +run-binary-hex: check-binary run-binary-hex: $(output_dir) $(sim) $(binary_hex) run-binary-hex: run-binary run-binary-hex: override LOADMEM_ADDR = 80000000 run-binary-hex: override LOADMEM = $(binary_hex) run-binary-hex: override SIM_FLAGS += +loadmem=$(LOADMEM) +loadmem_addr=$(LOADMEM_ADDR) -run-binary-debug-hex: $(check-binary) +run-binary-debug-hex: check-binary run-binary-debug-hex: $(output_dir) $(sim) $(binary_hex) run-binary-debug-hex: run-binary-debug run-binary-debug-hex: override LOADMEM_ADDR = 80000000 run-binary-debug-hex: override LOADMEM = $(binary_hex) run-binary-debug-hex: override SIM_FLAGS += +loadmem=$(LOADMEM) +loadmem_addr=$(LOADMEM_ADDR) -run-binary-fast-hex: $(check-binary) +run-binary-fast-hex: check-binary run-binary-fast-hex: $(output_dir) $(sim) $(binary_hex) run-binary-fast-hex: run-binary-fast run-binary-fast-hex: override LOADMEM_ADDR = 80000000 From 7195c0cbd1041338021c0813cd96a74940dca43b Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Thu, 6 May 2021 14:05:59 -0700 Subject: [PATCH 4/5] Check for thin client flag | Bump SBT to 1.4.9 --- common.mk | 9 +++++++-- project/build.properties | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common.mk b/common.mk index ac80af91a7..a4cb26f298 100644 --- a/common.mk +++ b/common.mk @@ -247,12 +247,17 @@ SBT_COMMAND ?= shell launch-sbt: cd $(base_dir) && $(SBT_NON_THIN) "$(SBT_COMMAND)" +check-thin-client: +ifeq (,$(ENABLE_SBT_THIN_CLIENT)) + $(error ENABLE_SBT_THIN_CLIENT not set.) +endif + .PHONY: shutdown-sbt-server -shutdown-sbt-server: +shutdown-sbt-server: check-thin-client cd $(base_dir) && $(SBT) "shutdown" .PHONY: start-sbt-server -start-sbt-server: +start-sbt-server: check-thin-client cd $(base_dir) && $(SBT) "exit" ######################################################################################### diff --git a/project/build.properties b/project/build.properties index 7de0a9382f..dbae93bcfd 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.4 +sbt.version=1.4.9 From aa4eff3407e117deae5035d091386ba6c4273a90 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Thu, 6 May 2021 14:08:47 -0700 Subject: [PATCH 5/5] Add small comments about thin client --- common.mk | 2 +- variables.mk | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common.mk b/common.mk index a4cb26f298..1278e03132 100644 --- a/common.mk +++ b/common.mk @@ -18,7 +18,7 @@ HELP_COMPILATION_VARIABLES += \ " EXTRA_SIM_LDFLAGS = additional LDFLAGS for building simulators" \ " EXTRA_SIM_SOURCES = additional simulation sources needed for simulator" \ " EXTRA_SIM_REQS = additional make requirements to build the simulator" \ -" ENABLE_SBT_THIN_CLIENT = if set, use sbt's experimental thin client" +" ENABLE_SBT_THIN_CLIENT = if set, use sbt's experimental thin client (works best with sbtn or sbt script)" EXTRA_GENERATOR_REQS ?= EXTRA_SIM_CXXFLAGS ?= diff --git a/variables.mk b/variables.mk index b83693e62d..d892c8e4c3 100644 --- a/variables.mk +++ b/variables.mk @@ -164,6 +164,7 @@ SBT_THIN_CLIENT_TIMESTAMP = $(base_dir)/project/target/active.json ifdef ENABLE_SBT_THIN_CLIENT override SCALA_BUILDTOOL_DEPS += $(SBT_THIN_CLIENT_TIMESTAMP) # enabling speeds up sbt loading +# use with sbt script or sbtn to bypass error code issues SBT_CLIENT_FLAG = --client endif