From 2a08ca9c7003da92c9788b4dcd74290748fab624 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Fri, 6 Jan 2023 16:48:53 -0800 Subject: [PATCH] Work around old esp-tools --- sims/common-sim-flags.mk | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sims/common-sim-flags.mk b/sims/common-sim-flags.mk index 7b3deea1..642004f6 100644 --- a/sims/common-sim-flags.mk +++ b/sims/common-sim-flags.mk @@ -3,6 +3,17 @@ #---------------------------------------------------------------------------------------- SIM_OPT_CXXFLAGS := -O3 +# Workaround: esp-isa-sim doesn't install libriscv, +# so don't link with libriscv if it doesn't exist +# potentially breaks some configs + +ifeq (,$(wildcard $RISCV/lib/libriscv.so)) +$(warning libriscv not found) +LRISCV="" +else +LRISCV="-lriscv" +endif + SIM_CXXFLAGS = \ $(CXXFLAGS) \ $(SIM_OPT_CXXFLAGS) \ @@ -18,7 +29,7 @@ SIM_LDFLAGS = \ -Wl,-rpath,$(RISCV)/lib \ -L$(sim_dir) \ -L$(dramsim_dir) \ - -lriscv \ + $(LRISCV) \ -lfesvr \ -ldramsim \ $(EXTRA_SIM_LDFLAGS)