From a8e52534606edd6ec1c9f3bd089e3d5a86a73f40 Mon Sep 17 00:00:00 2001 From: Joao D Lopes Date: Wed, 27 Apr 2022 22:28:33 +0100 Subject: [PATCH 1/3] add firmware.bin dependency when run console; fix documents test targets; add general clean target --- Makefile | 44 +++++++++++++++---------------- document/document.mk | 15 +---------- hardware/fpga/fpga.mk | 2 +- hardware/hardware.mk | 10 ++++--- hardware/simulation/simulation.mk | 2 +- 5 files changed, 30 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index 00d78b2c2..b708dad56 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,6 @@ fw-build: fw-clean: make -C $(FIRM_DIR) clean-all - # # EMULATE ON PC # @@ -29,7 +28,6 @@ pc-emul-clean: fw-clean pc-emul-test: pc-emul-clean make -C $(PC_DIR) test - # # SIMULATE RTL # @@ -64,7 +62,6 @@ fpga-clean: fw-clean fpga-test: make -C $(BOARD_DIR) test - # # SYNTHESIZE AND SIMULATE ASIC # @@ -85,6 +82,7 @@ asic-test: # # COMPILE DOCUMENTS # + doc-build: make -C $(DOC_DIR) $(DOC).pdf @@ -94,10 +92,11 @@ doc-clean: doc-test: make -C $(DOC_DIR) test -doc-test-clean: - make -C $(DOC_DIR) test-clean - +# +# CLEAN +# +clean: pc-emul-clean sim-clean fpga-clean doc-clean # # TEST ALL PLATFORMS @@ -132,8 +131,10 @@ test-asic-clean: make asic-clean ASIC_NODE=skywater test-doc: - make fpga-clean-all - make fpga-build-all + make fpga-clean BOARD=CYCLONEV-GT-DK + make fpga-clean BOARD=AES-KU040-DB-G + make fpga-build BOARD=CYCLONEV-GT-DK + make fpga-build BOARD=AES-KU040-DB-G make doc-test DOC=pb make doc-test DOC=presentation @@ -145,25 +146,22 @@ test: test-clean test-pc-emul test-sim test-fpga test-doc test-clean: test-pc-emul-clean test-sim-clean test-fpga-clean test-doc-clean - debug: @echo $(UART_DIR) @echo $(CACHE_DIR) .PHONY: fw-build fw-clean \ - pc-emul-build pc-emul-run pc-emul-clean \ - pc-emul-test pc-emul-test-clean\ - sim-build sim-run sim-clean sim-test sim-test-clean\ - fpga-build fpga-run fpga-clean fpga-test fpga-test-clean\ - asic-synth asic-synth-clean \ - asic-sim-post-synth asic-sim-post-synth-clean \ - asic-test asic-test-clean\ - doc-build doc-clean doc-test doc-test-clean\ - test-pc-emul test-pc-emul-clean\ - test-sim test-sim-clean\ - test-fpga test-fpga-clean\ - test-asic test-asic-clean\ - test-doc test-doc-clean\ - test test-clean + pc-emul-build pc-emul-run pc-emul-clean pc-emul-test \ + sim-build sim-run sim-clean sim-test \ + fpga-build fpga-run fpga-clean fpga-test \ + asic-synth asic-sim-post-synth asic-test \ + doc-build doc-clean doc-test \ + clean \ + test-pc-emul test-pc-emul-clean \ + test-sim test-sim-clean \ + test-fpga test-fpga-clean \ + test-asic test-asic-clean \ + test-doc test-doc-clean \ + test test-clean \ debug diff --git a/document/document.mk b/document/document.mk index 12f07bc20..88408a244 100644 --- a/document/document.mk +++ b/document/document.mk @@ -19,23 +19,10 @@ SWREGS=0 include $(LIB_DIR)/document/document.mk - -test: clean-all -ifeq ($(DOC),pb) - make -C $(ROOT_DIR) fpga-test -endif - make $(DOC).pdf - -$(DOC).pdf: - make doc-build +test: clean-all $(DOC).pdf diff -q $(DOC).aux test.expected clean-all: clean rm -f $(DOC).pdf -test-clean: - make doc-clean DOC=presentation - make doc-clean DOC=pb - .PHONY: test clean-all - diff --git a/hardware/fpga/fpga.mk b/hardware/fpga/fpga.mk index 7a3930f44..cd6ae0d6d 100644 --- a/hardware/fpga/fpga.mk +++ b/hardware/fpga/fpga.mk @@ -28,7 +28,7 @@ endif FORCE ?= 1 -run: +run: firmware.bin ifeq ($(NORUN),0) ifeq ($(BOARD_SERVER),) if [ ! -f $(LOAD_FILE) ]; then touch $(LOAD_FILE); chown $(USER):dialout $(LOAD_FILE); chmod 664 $(LOAD_FILE); fi;\ diff --git a/hardware/hardware.mk b/hardware/hardware.mk index 9479360b4..94aa327d4 100644 --- a/hardware/hardware.mk +++ b/hardware/hardware.mk @@ -68,15 +68,17 @@ system.v: $(SRC_DIR)/system_core.v PYTHON_DIR=$(MEM_DIR)/software/python boot.hex: $(BOOT_DIR)/boot.bin - $(PYTHON_DIR)/makehex.py $(BOOT_DIR)/boot.bin $(BOOTROM_ADDR_W) > boot.hex + $(PYTHON_DIR)/makehex.py $< $(BOOTROM_ADDR_W) > $@ firmware.hex: $(FIRM_DIR)/firmware.bin - $(PYTHON_DIR)/makehex.py $(FIRM_DIR)/firmware.bin $(FIRM_ADDR_W) > firmware.hex + $(PYTHON_DIR)/makehex.py $< $(FIRM_ADDR_W) > $@ $(PYTHON_DIR)/hex_split.py firmware . - cp $(FIRM_DIR)/firmware.bin . + +firmware.bin: $(FIRM_DIR)/firmware.bin + cp $< . #clean general hardware files hw-clean: gen-clean - @rm -f *.v *.hex *.bin $(SRC_DIR)/system.v $(TB_DIR)/system_tb.v *.vh + @rm -f *.v *.vh *.hex *.bin $(SRC_DIR)/system.v $(TB_DIR)/system_tb.v .PHONY: hw-clean diff --git a/hardware/simulation/simulation.mk b/hardware/simulation/simulation.mk index e4de5df36..6f56811f3 100644 --- a/hardware/simulation/simulation.mk +++ b/hardware/simulation/simulation.mk @@ -63,7 +63,7 @@ else bash -c "trap 'make kill-remote-sim' INT TERM KILL; ssh $(SIM_SSH_FLAGS) $(SIM_USER)@$(SIM_SERVER) 'make -C $(REMOTE_ROOT_DIR) sim-build SIMULATOR=$(SIMULATOR) INIT_MEM=$(INIT_MEM) USE_DDR=$(USE_DDR) RUN_EXTMEM=$(RUN_EXTMEM) VCD=$(VCD) TEST_LOG=\"$(TEST_LOG)\"'" endif -run: +run: firmware.bin ifeq ($(SIM_SERVER),) @rm -f soc2cnsl cnsl2soc $(CONSOLE_CMD) $(TEST_LOG) & From cb15e7b64fdccebb5844e6108767438fa0caecc4 Mon Sep 17 00:00:00 2001 From: Joao D Lopes Date: Thu, 28 Apr 2022 11:12:45 +0100 Subject: [PATCH 2/3] remove dummy trap on simulation build target --- hardware/simulation/simulation.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/simulation/simulation.mk b/hardware/simulation/simulation.mk index 6f56811f3..c107b4947 100644 --- a/hardware/simulation/simulation.mk +++ b/hardware/simulation/simulation.mk @@ -56,11 +56,11 @@ endif #RULES build: $(VSRC) $(VHDR) $(HEXPROGS) ifeq ($(SIM_SERVER),) - bash -c "trap 'make kill-sim' INT TERM KILL EXIT; make comp" + make comp else ssh $(SIM_SSH_FLAGS) $(SIM_USER)@$(SIM_SERVER) "if [ ! -d $(REMOTE_ROOT_DIR) ]; then mkdir -p $(REMOTE_ROOT_DIR); fi" rsync -avz --delete --force --exclude .git $(SIM_SYNC_FLAGS) $(ROOT_DIR) $(SIM_USER)@$(SIM_SERVER):$(REMOTE_ROOT_DIR) - bash -c "trap 'make kill-remote-sim' INT TERM KILL; ssh $(SIM_SSH_FLAGS) $(SIM_USER)@$(SIM_SERVER) 'make -C $(REMOTE_ROOT_DIR) sim-build SIMULATOR=$(SIMULATOR) INIT_MEM=$(INIT_MEM) USE_DDR=$(USE_DDR) RUN_EXTMEM=$(RUN_EXTMEM) VCD=$(VCD) TEST_LOG=\"$(TEST_LOG)\"'" + ssh $(SIM_SSH_FLAGS) $(SIM_USER)@$(SIM_SERVER) 'make -C $(REMOTE_ROOT_DIR) sim-build SIMULATOR=$(SIMULATOR) INIT_MEM=$(INIT_MEM) USE_DDR=$(USE_DDR) RUN_EXTMEM=$(RUN_EXTMEM) VCD=$(VCD) TEST_LOG=\"$(TEST_LOG)\"' endif run: firmware.bin From f0880d4fb16cc8e3baf88d37ce10e5ad8a16d930 Mon Sep 17 00:00:00 2001 From: Joao D Lopes Date: Thu, 28 Apr 2022 12:53:33 +0100 Subject: [PATCH 3/3] remove firmware.bin target --- hardware/fpga/fpga.mk | 3 ++- hardware/hardware.mk | 3 --- hardware/simulation/simulation.mk | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hardware/fpga/fpga.mk b/hardware/fpga/fpga.mk index cd6ae0d6d..5e63b922a 100644 --- a/hardware/fpga/fpga.mk +++ b/hardware/fpga/fpga.mk @@ -28,9 +28,10 @@ endif FORCE ?= 1 -run: firmware.bin +run: ifeq ($(NORUN),0) ifeq ($(BOARD_SERVER),) + cp $(FIRM_DIR)/firmware.bin . if [ ! -f $(LOAD_FILE) ]; then touch $(LOAD_FILE); chown $(USER):dialout $(LOAD_FILE); chmod 664 $(LOAD_FILE); fi;\ bash -c "trap 'make queue-out' INT TERM KILL; make queue-in; if [ $(FORCE) = 1 -o \"`head -1 $(LOAD_FILE)`\" != \"$(JOB)\" ];\ then ../prog.sh; echo $(JOB) > $(LOAD_FILE); fi; $(CONSOLE_CMD) $(TEST_LOG); make queue-out;" diff --git a/hardware/hardware.mk b/hardware/hardware.mk index 94aa327d4..eff1fb47f 100644 --- a/hardware/hardware.mk +++ b/hardware/hardware.mk @@ -74,9 +74,6 @@ firmware.hex: $(FIRM_DIR)/firmware.bin $(PYTHON_DIR)/makehex.py $< $(FIRM_ADDR_W) > $@ $(PYTHON_DIR)/hex_split.py firmware . -firmware.bin: $(FIRM_DIR)/firmware.bin - cp $< . - #clean general hardware files hw-clean: gen-clean @rm -f *.v *.vh *.hex *.bin $(SRC_DIR)/system.v $(TB_DIR)/system_tb.v diff --git a/hardware/simulation/simulation.mk b/hardware/simulation/simulation.mk index c107b4947..95d2b06d5 100644 --- a/hardware/simulation/simulation.mk +++ b/hardware/simulation/simulation.mk @@ -63,8 +63,9 @@ else ssh $(SIM_SSH_FLAGS) $(SIM_USER)@$(SIM_SERVER) 'make -C $(REMOTE_ROOT_DIR) sim-build SIMULATOR=$(SIMULATOR) INIT_MEM=$(INIT_MEM) USE_DDR=$(USE_DDR) RUN_EXTMEM=$(RUN_EXTMEM) VCD=$(VCD) TEST_LOG=\"$(TEST_LOG)\"' endif -run: firmware.bin +run: ifeq ($(SIM_SERVER),) + cp $(FIRM_DIR)/firmware.bin . @rm -f soc2cnsl cnsl2soc $(CONSOLE_CMD) $(TEST_LOG) & bash -c "trap 'make kill-sim' INT TERM KILL EXIT; make exec"