Line 1... |
Line 1... |
################################################################################
|
################################################################################
|
##
|
##
|
## Filename: Makefile
|
## Filename: Makefile
|
##
|
##
|
## Project: Wishbone Controlled Quad SPI Flash Controller
|
## Project: A Set of Wishbone Controlled SPI Flash Controllers
|
##
|
##
|
## Purpose: This makefile coordinates the build of the extended quad spi
|
## Purpose: This makefile coordinates the build of the extended quad spi
|
## flash controller (not the normal quad spi flash controller also
|
## flash controller (not the normal quad spi flash controller also
|
## in this directory).
|
## in this directory).
|
##
|
##
|
## Creator: Dan Gisselquist, Ph.D.
|
## Creator: Dan Gisselquist, Ph.D.
|
## Gisselquist Technology, LLC
|
## Gisselquist Technology, LLC
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
## Copyright (C) 2015-2017, Gisselquist Technology, LLC
|
## Copyright (C) 2015-2019, Gisselquist Technology, LLC
|
##
|
##
|
## This program is free software (firmware): you can redistribute it and/or
|
## This file is part of the set of Wishbone controlled SPI flash controllers
|
## modify it under the terms of the GNU General Public License as published
|
## project
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
|
## your option) any later version.
|
|
##
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
## for more details.
|
|
##
|
##
|
## You should have received a copy of the GNU General Public License along
|
## The Wishbone SPI flash controller project is free software (firmware):
|
|
## you can redistribute it and/or modify it under the terms of the GNU Lesser
|
|
## General Public License as published by the Free Software Foundation, either
|
|
## version 3 of the License, or (at your option) any later version.
|
|
##
|
|
## The Wishbone SPI flash controller project is distributed in the hope
|
|
## that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
## warranty of MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
## GNU Lesser General Public License for more details.
|
|
##
|
|
## You should have received a copy of the GNU Lesser General Public License along
|
## with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
## with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
## target there if the PDF file isn't present.) If not, see
|
## target there if the PDF file isn't present.) If not, see
|
## for a copy.
|
## for a copy.
|
##
|
##
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## License: LGPL, v3, as defined and found on www.gnu.org,
|
## http://www.gnu.org/licenses/gpl.html
|
## http://www.gnu.org/licenses/lgpl.html
|
##
|
##
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
##
|
##
|
Line 41... |
Line 44... |
CFLAGS := -Wall -Og -g
|
CFLAGS := -Wall -Og -g
|
OBJDIR := obj-pc
|
OBJDIR := obj-pc
|
RTLD := ../../rtl
|
RTLD := ../../rtl
|
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
|
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
|
VROOT := $(VERILATOR_ROOT)
|
VROOT := $(VERILATOR_ROOT)
|
|
VDEFS := $(shell ./vversion.sh)
|
VINCD := $(VROOT)/include
|
VINCD := $(VROOT)/include
|
INCS := -I$(RTLD)/obj_dir/ -I$(RTLD) -I$(VINCD) -I$(VINCD)/vltstd
|
INCS := -I$(RTLD)/obj_dir/ -I$(RTLD) -I$(VINCD) -I$(VINCD)/vltstd
|
EQSOURCES := eqspiflashsim.cpp eqspiflash_tb.cpp
|
SIMSRCS := flashsim.cpp byteswap.cpp
|
QSOURCES := qspiflashsim.cpp qspiflash_tb.cpp
|
LEGACYSRC := wbqspiflash_tb.cpp $(SIMSRCS)
|
SOURCES := $(EQSOURCES) $(QSOURCES)
|
SPISRC := spixpress_tb.cpp $(SIMSRCS)
|
|
DSPISRC := dualflexpress_tb.cpp $(SIMSRCS)
|
|
QSPISRC := qflexpress_tb.cpp $(SIMSRCS)
|
|
SOURCES := $(wildcard *_tb.cpp) flashsim.cpp
|
VOBJDR := $(RTLD)/obj_dir
|
VOBJDR := $(RTLD)/obj_dir
|
RAWVLIB := verilated.cpp verilated_vcd_c.cpp
|
RAWVLIB := verilated.cpp verilated_vcd_c.cpp
|
VSRCS := $(addprefix $(VROOT)/include/,$(RAWVLIB))
|
VSRCS := $(addprefix $(VROOT)/include/,$(RAWVLIB))
|
VOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(RAWVLIB)))
|
VOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(RAWVLIB)))
|
QOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(QSOURCES))) $(VOBJS)
|
LOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(LEGACYSRC))) $(VOBJS)
|
EQOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(EQSOURCES))) $(VOBJS)
|
SOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SPISRC))) $(VOBJS)
|
SIMSRCS := enetctrlsim.cpp eqspiflashsim.cpp
|
DOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(DSPISRC))) $(VOBJS)
|
all: qspiflash_tb pretest
|
QOBJS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(QSPISRC))) $(VOBJS)
|
|
all: wbqspiflash_tb
|
|
|
$(OBJDIR)/%.o: %.cpp
|
$(OBJDIR)/%.o: %.cpp
|
$(mk-objdir)
|
$(mk-objdir)
|
$(CXX) $(CFLAGS) $(INCS) -c $< -o $@
|
$(CXX) $(CFLAGS) $(VDEFS) $(INCS) -c $< -o $@
|
|
|
$(OBJDIR)/%.o: $(VINCD)/%.cpp
|
$(OBJDIR)/%.o: $(VINCD)/%.cpp
|
$(mk-objdir)
|
$(mk-objdir)
|
$(CXX) $(CFLAGS) $(INCS) -c $< -o $@
|
$(CXX) $(CFLAGS) $(INCS) -c $< -o $@
|
|
|
eqspiflash_tb: $(EQOBJS) $(VOBJDR)/Veqspiflash__ALL.a
|
wbqspiflash_tb: $(LOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a
|
$(CXX) $(CFLAGS) $(INCS) $(EQOBJS) $(VOBJDR)/Veqspiflash__ALL.a -o $@
|
$(CXX) $(CFLAGS) $(INCS) $(LOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a -o $@
|
|
|
|
spixpress_tb: $(SOBJS) $(VOBJDR)/Vspixpress__ALL.a
|
|
$(CXX) $(CFLAGS) $(INCS) $(SOBJS) $(VOBJDR)/Vspixpress__ALL.a -o $@
|
|
|
|
dualflexpress_tb: $(DOBJS) $(VOBJDR)/Vdualflexpress__ALL.a
|
|
$(CXX) $(CFLAGS) $(INCS) $(DOBJS) $(VOBJDR)/Vdualflexpress__ALL.a -o $@
|
|
|
qspiflash_tb: $(QOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a $(VOBJS)
|
qflexpress_tb: $(QOBJS) $(VOBJDR)/Vqflexpress__ALL.a
|
$(CXX) $(CFLAGS) $(INCS) $(QOBJS) $(VOBJDR)/Vwbqspiflash__ALL.a -o $@
|
$(CXX) $(CFLAGS) $(INCS) $(QOBJS) $(VOBJDR)/Vqflexpress__ALL.a -o $@
|
|
|
.PHONY: pretest
|
.PHONY: pretest
|
pretest: qspiflash_tb eqspiflash_tb
|
pretest: spixpress_tb dualflexpress_tb qflexpress_tb
|
@echo "The test bench has been created. Type make test, and look at"
|
@echo "The test bench has been created. Type make test, and look at"
|
@echo "the end of its output to see if it (still) works."
|
@echo "the end of its output to see if it (still) works."
|
|
|
# .PHONY: test
|
# .PHONY: test
|
# test: eqspiflash_tb
|
# test: eqspiflash_tb
|
# ./eqspiflash_tb
|
# ./eqspiflash_tb
|
|
|
.PHONY: test qtest eqtest
|
.PHONY: test stest dtest qtest legacytest
|
test: qtest eqtest
|
test: stest dtest qtest
|
qtest: qspiflash_tb
|
stest: spixpress_tb
|
./qspiflash_tb
|
./spixpress_tb
|
eqtest: eqspiflash_tb qtest
|
dtest: dualflexpress_tb
|
./eqspiflash_tb
|
./dualflexpress_tb
|
|
qtest: qflexpress_tb
|
|
./qflexpress_tb
|
|
legacytest: wbqpiflash_tb
|
|
./wbqpiflash_tb
|
|
|
define mk-objdir
|
define mk-objdir
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
endef
|
endef
|
|
|
Line 104... |
Line 122... |
@echo "Generating tags"
|
@echo "Generating tags"
|
@ctags $(SOURCES) $(HEADERS)
|
@ctags $(SOURCES) $(HEADERS)
|
|
|
.PHONY: clean
|
.PHONY: clean
|
clean:
|
clean:
|
rm -f ./eqspiflash_tb qspiflash_tb
|
rm -f spixpress_tb dualflexpress_tb qflexpress_tb
|
rm -rf $(OBJDIR)/
|
rm -f *.vcd
|
|
rm -rf wbqspiflash_tb $(OBJDIR)/
|
|
|
.PHONY: depends
|
.PHONY: depends
|
depends: tags
|
depends: tags
|
$(build-depends)
|
$(build-depends)
|
|
|
$(OBJDIR)/depends.txt: $(SOURCES) $(HEADERS)
|
$(OBJDIR)/depends.txt: $(SOURCES) $(HEADERS)
|
$(build-depends)
|
$(build-depends)
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
-include $(OBJDIR)/depends.txt
|
-include $(OBJDIR)/depends.txt
|
|
endif
|