From 14e29fb34286ff6a6b92848c23246b38169f5c96 Mon Sep 17 00:00:00 2001 From: bluew Date: Wed, 16 Dec 2020 18:31:07 +0100 Subject: [PATCH] rules: Fail if VSIM_PATH is undefined You might think these are too many checks, but in fact each is needed to cover all possible edge cases. For example you could remove all the VSIM_PATH checks when creating the symlink and force the creation of symlink (-f flag), but this will fail for /boot, since on many machines /boot does actually exist. Removing VSIM_PATH from the run target can cause problems when calling run with a pre-compiled build directory etc. --- rules/pulpos/default_rules.mk | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/rules/pulpos/default_rules.mk b/rules/pulpos/default_rules.mk index 873d1e6..210a7f7 100644 --- a/rules/pulpos/default_rules.mk +++ b/rules/pulpos/default_rules.mk @@ -212,15 +212,31 @@ endif ifeq '$(platform)' 'rtl' $(TARGET_BUILD_DIR)/modelsim.ini: +ifndef VSIM_PATH + $(error "VSIM_PATH is undefined. Either call \ + 'source $$YOUR_HW_DIR/setup/vsim.sh' or set it manually.") +endif ln -s $(VSIM_PATH)/modelsim.ini $@ $(TARGET_BUILD_DIR)/boot: +ifndef VSIM_PATH + $(error "VSIM_PATH is undefined. Either call \ + 'source $$YOUR_HW_DIR/setup/vsim.sh' or set it manually.") +endif ln -s $(VSIM_PATH)/boot $@ $(TARGET_BUILD_DIR)/tcl_files: +ifndef VSIM_PATH + $(error "VSIM_PATH is undefined. Either call \ + 'source $$YOUR_HW_DIR/setup/vsim.sh' or set it manually.") +endif ln -s $(VSIM_PATH)/tcl_files $@ $(TARGET_BUILD_DIR)/waves: +ifndef VSIM_PATH + $(error "VSIM_PATH is undefined. Either call \ + 'source $$YOUR_HW_DIR/setup/vsim.sh' or set it manually.") +endif ln -s $(VSIM_PATH)/waves $@ $(TARGET_BUILD_DIR)/stdout: @@ -232,7 +248,10 @@ $(TARGET_BUILD_DIR)/fs: run: $(TARGET_BUILD_DIR)/modelsim.ini $(TARGET_BUILD_DIR)/boot $(TARGET_BUILD_DIR)/tcl_files \ $(TARGET_BUILD_DIR)/stdout $(TARGET_BUILD_DIR)/fs $(PULPRT_HOME)/bin/stim_utils.py --binary=$(TARGETS) --vectors=$(TARGET_BUILD_DIR)/vectors/stim.txt - +ifndef VSIM_PATH + $(error "VSIM_PATH is undefined. Either call \ + 'source $$YOUR_HW_DIR/setup/vsim.sh' or set it manually.") +endif ifdef gui cd $(TARGET_BUILD_DIR) && export VSIM_RUNNER_FLAGS="+ENTRY_POINT=0x1c008080 -gLOAD_L2=JTAG -dpicpppath /usr/bin/g++ -permit_unmatched_virtual_intf -gBAUDRATE=115200" && export VOPT_ACC_ENA="YES" && vsim -64 -do 'source $(VSIM_PATH)/tcl_files/config/run_and_exit.tcl' -do 'source $(VSIM_PATH)/tcl_files/run.tcl; ' else