OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [asm/] [Makefile] - Diff between revs 74 and 202

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 74 Rev 202
Line 2... Line 2...
#
#
# Filename:     Makefile
# Filename:     Makefile
#
#
# Project:      Zip CPU -- a small, lightweight, RISC CPU soft core
# Project:      Zip CPU -- a small, lightweight, RISC CPU soft core
#
#
# Purpose:      This makefile builds the various assembler level test benches
# Purpose:      To direct and simplify the build of a variety of simple assembly
#               that exist.
#               language test programs which will use one (or both) of the
 
#       ZipCPU simulators.
 
#
 
# Targets include:
 
#
 
#       hellosim
 
#               Using the SIM instruction, prints Hello World to the screen.
 
#
 
#       simuart
 
#               Same as hellosim, but without using the SIM instruction.  This
 
#               *should* be able to run successfully on a verilated or
 
#               synthesized hardware, although I hvae yet to test it there.
 
#
 
#       simtest
 
#               A set of simple tests designed to demonstrate if the simulator
 
#               works or not.
 
#
 
#       clean
 
#               Removes the object file directory and any executables that have
 
#               been created.
 
#
 
#       None of the files/targets below have any dependencies, or if they did,
 
#       GCC can't determine them, so thus there is no make depends step.
 
#
 
#       To actually run one of these programs, list the program on the command
 
#       line with the ZipCPU simulator, zsim.
 
#
 
#
#
#
# Creator:      Dan Gisselquist, Ph.D.
# Creator:      Dan Gisselquist, Ph.D.
#               Gisselquist Technology, LLC
#               Gisselquist Technology, LLC
#
#
################################################################################
################################################################################
#
#
# Copyright (C) 2015, Gisselquist Technology, LLC
# Copyright (C) 2017, Gisselquist Technology, LLC
#
#
# This program is free software (firmware): you can redistribute it and/or
# This program is free software (firmware): you can redistribute it and/or
# modify it under the terms of  the GNU General Public License as published
# modify it under the terms of  the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or (at
# by the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# your option) any later version.
Line 22... Line 49...
# This program is distributed in the hope that it will be useful, but WITHOUT
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# for more details.
#
#
 
# You should have received a copy of the GNU General Public License along
 
# 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
 
#  for a copy.
 
#
# License:      GPL, v3, as defined and found on www.gnu.org,
# License:      GPL, v3, as defined and found on www.gnu.org,
#               http://www.gnu.org/licenses/gpl.html
#               http://www.gnu.org/licenses/gpl.html
#
#
#
#
################################################################################
################################################################################
#
#
all: zipdhry.z testdiv.z wdt.z halttest.z zipdhry.txt nullpc.txt poptest.txt
.PHONY: all
ZDIR := ../../sw/zasm
all: $(OBJDIR)/ hellosim simtest simuart cmptest
ZASM := $(ZDIR)/zasm
 
ZDMP := $(ZDIR)/zdump
CC      := zip-gcc
LIBS := ../../sw/lib
CPP     := zip-cpp
INCS := -I$(ZDIR)/
AS      := zip-as
 
LD      := zip-ld
dump: zipdhry.txt testdiv.txt
OBJDUMP := zip-objdump
 
OBJDIR := obj-zip
halttest.z: halttest.S
CFLAGS := -O3
        $(ZASM) $(INCS) $^ -o $@
LIBD   := ../../sw/install/cross-tools/zip/lib
zipdhry.z: zipdhry.S $(LIBS)/divs.S $(LIBS)/divu.S stack.S
LIBS   := -L$(LIBD) -lzipbasic
        $(ZASM) $(INCS) $^ -o $@
LDSCRIPT:= ../zipsim.ld
zipdhry.txt: zipdhry.z
 
        $(ZDMP) zipdhry.z > zipdhry.txt
$(OBJDIR)/%.o: %.c $(OBJDIR)/
 
        $(CC) $(CFLAGS) -c $< -o $@
nullpc.z: nullpc.s
 
        $(ZASM) $(INCS) $^ -o $@
$(OBJDIR)/%.o: %.s $(OBJDIR)/
nullpc.txt: nullpc.z
        $(AS) $< -o $@
        $(ZDMP) nullpc.z > nullpc.txt
 
 
%.txt: %
poptest.z: poptest.s
        $(OBJDUMP) -dr $< > $@
        $(ZASM) $(INCS) $^ -o $@
 
poptest.txt: poptest.z
#
        $(ZDMP) poptest.z > poptest.txt
# hellosim
 
#
wdt.z: wdt.S
# This is an assembly version of Hello World that uses the new SIM instructions.
        $(ZASM) $(INCS) $^ -o $@
# It should fail with an illegal instruction error if it is ever tried on an
 
# RTL-synthesized implementation
.PHONY: testdiv
#
testdiv: testdiv.z
hellosim: $(OBJDIR)/hellosim.o
testdiv.z: testdiv.S $(LIBS)/divs.S $(LIBS)/divu.S stack.S
        $(LD) -T $(LDSCRIPT) $< -o $@
        $(ZASM) $(INCS) $^ -o $@
 
 
#
 
# simuart
 
#
 
# This is an assembly version of Hello World that uses the UART in the
 
# process.  It doesn't use newlib or any other support tools, just binutils.
 
#
 
simuart: $(OBJDIR)/simuart.o
 
        $(LD) -T $(LDSCRIPT) $< -o $@
 
 
 
#
 
# simtest
 
#
 
# This is just a simple series of instruction tests that should be able to be
 
# used to determine whether the simulator has a basic amount of functionality.
 
# Because the test includes #define, #ifdef, and #endif statements, though, it
 
# needs to be run through the C pre-processor before it can go through the
 
# assembler.  Hence the build is a tocuh trickier, but still simple enough.
 
#
 
$(OBJDIR)/simtest.o: simtest.s $(OBJDIR)/
 
        $(CPP) $< > $(OBJDIR)/simtest.s
 
        $(AS) $(OBJDIR)/simtest.s -o $@
 
 
 
simtest: $(OBJDIR)/simtest.o
 
        $(LD) -T $(LDSCRIPT) $< -o $@
 
 
 
cmptest: $(OBJDIR)/cmptest.o
 
        $(LD) -T $(LDSCRIPT) -Map=map.txt $< -o $@
 
 
 
 
testdiv.txt: testdiv.z
$(OBJDIR)/:
        $(ZDMP) testdiv.z > testdiv.txt
        @bash -c "if [[ ! -e $(OBJDIR) ]]; then mkdir -p $(OBJDIR)/; fi"
 
 
 
.PHONY: clean
clean:
clean:
        rm -rf *.z zipdhry.txt testdiv.txt
        rm -rf $(OBJDIR)/
 
        rm -rf hellosim simuart simtest

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.