From 4155de721b700ea122cfa81058b146a2bd7e5055 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 26 Mar 2021 23:01:58 -0400 Subject: [PATCH] Fix Cygwin example compile issues (#2856). --- Changes | 1 + examples/make_protect_lib/Makefile | 6 ++++++ examples/make_tracing_c/Makefile | 7 ++++++- examples/make_tracing_c/Makefile_obj | 8 ++++++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index a69c14979..d3e675d92 100644 --- a/Changes +++ b/Changes @@ -25,6 +25,7 @@ Verilator 4.201 devel * Fix false TIMESCALEMOD on generate-ignored instances (#2838). [Kaleb Barrett] * Fix --output-split with class extends (#2839). [Iru Cai] * Fix false WIDTHCONCAT on casted constant (#2849). [Rupert Swarbrick] +* Fix Cygwin example compile issues (#2856). [Mark Shaw] Verilator 4.200 2021-03-12 diff --git a/examples/make_protect_lib/Makefile b/examples/make_protect_lib/Makefile index 319ce5c4a..215df0396 100644 --- a/examples/make_protect_lib/Makefile +++ b/examples/make_protect_lib/Makefile @@ -36,6 +36,12 @@ VERILATOR_FLAGS += -cc VERILATOR_FLAGS += -Os -x-assign 0 # Warn abount lint issues; may not want this on less solid designs VERILATOR_FLAGS += -Wall +# This example does not use vl_time_stamp but rather +# VerilatedContext::timeInc(), so to avoid a linker error on cygwin which +# does not support weak symbols, we need to define VL_TIME_CONTEXT *in CPP* +# to not compile in the vl_time_stamp using code. +VERILATOR_FLAGS += -CFLAGS -DVL_TIME_CONTEXT + # Make waveforms TOP_VERILATOR_FLAGS = $(VERILATOR_FLAGS) --trace diff --git a/examples/make_tracing_c/Makefile b/examples/make_tracing_c/Makefile index e16d285fd..01556bc59 100644 --- a/examples/make_tracing_c/Makefile +++ b/examples/make_tracing_c/Makefile @@ -31,7 +31,6 @@ VERILATOR = $(VERILATOR_ROOT)/bin/verilator VERILATOR_COVERAGE = $(VERILATOR_ROOT)/bin/verilator_coverage endif -VERILATOR_FLAGS = # Generate C++ in executable form VERILATOR_FLAGS += -cc --exe # Generate makefile dependencies (not shown as complicates the Makefile) @@ -50,6 +49,12 @@ VERILATOR_FLAGS += --coverage #VERILATOR_FLAGS += --debug # Add this trace to get a backtrace in gdb #VERILATOR_FLAGS += --gdbbt +# This example does not use vl_time_stamp but rather +# VerilatedContext::timeInc(), so to avoid a linker error on cygwin which +# does not support weak symbols, we need to define VL_TIME_CONTEXT *in CPP* +# to not compile in the vl_time_stamp using code. +VERILATOR_FLAGS += -CFLAGS -DVL_TIME_CONTEXT + # Input files for Verilator VERILATOR_INPUT = -f input.vc top.v sim_main.cpp diff --git a/examples/make_tracing_c/Makefile_obj b/examples/make_tracing_c/Makefile_obj index 3177ef188..b757bd8d4 100644 --- a/examples/make_tracing_c/Makefile_obj +++ b/examples/make_tracing_c/Makefile_obj @@ -22,10 +22,13 @@ COMPILE.cc = $(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c ####################################################################### # Compile flags -# Override some default compile flags +# Turn on creating .d make dependency files CPPFLAGS += -MMD -MP + +# Compile in Verilator runtime debugging, so +verilator+debug works CPPFLAGS += -DVL_DEBUG=1 -# Turn on some more flags (when configured appropriately) + +# Turn on some more compiler lint flags (when configured appropriately) # For testing inside Verilator, "configure --enable-ccwarn" will do this # automatically; otherwise you may want this unconditionally enabled ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users @@ -36,6 +39,7 @@ endif # Support class optimizations. This includes the tracing and symbol table. # SystemC takes minutes to optimize, thus it is off by default. OPT_SLOW = + # Fast path optimizations. Most time is spent in these classes. OPT_FAST = -Os -fstrict-aliasing #OPT_FAST = -O