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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [asm/] [Makefile] - Blame information for rev 202

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 50 dgisselq
################################################################################
2
#
3
# Filename:     Makefile
4
#
5
# Project:      Zip CPU -- a small, lightweight, RISC CPU soft core
6
#
7 202 dgisselq
# Purpose:      To direct and simplify the build of a variety of simple assembly
8
#               language test programs which will use one (or both) of the
9
#       ZipCPU simulators.
10 50 dgisselq
#
11 202 dgisselq
# Targets include:
12
#
13
#       hellosim
14
#               Using the SIM instruction, prints Hello World to the screen.
15
#
16
#       simuart
17
#               Same as hellosim, but without using the SIM instruction.  This
18
#               *should* be able to run successfully on a verilated or
19
#               synthesized hardware, although I hvae yet to test it there.
20
#
21
#       simtest
22
#               A set of simple tests designed to demonstrate if the simulator
23
#               works or not.
24
#
25
#       clean
26
#               Removes the object file directory and any executables that have
27
#               been created.
28
#
29
#       None of the files/targets below have any dependencies, or if they did,
30
#       GCC can't determine them, so thus there is no make depends step.
31
#
32
#       To actually run one of these programs, list the program on the command
33
#       line with the ZipCPU simulator, zsim.
34
#
35
#
36
#
37 50 dgisselq
# Creator:      Dan Gisselquist, Ph.D.
38 69 dgisselq
#               Gisselquist Technology, LLC
39 50 dgisselq
#
40
################################################################################
41
#
42 202 dgisselq
# Copyright (C) 2017, Gisselquist Technology, LLC
43 50 dgisselq
#
44
# This program is free software (firmware): you can redistribute it and/or
45
# modify it under the terms of  the GNU General Public License as published
46
# by the Free Software Foundation, either version 3 of the License, or (at
47
# your option) any later version.
48
#
49
# This program is distributed in the hope that it will be useful, but WITHOUT
50
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
51
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
52
# for more details.
53
#
54 202 dgisselq
# You should have received a copy of the GNU General Public License along
55
# with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
56
# target there if the PDF file isn't present.)  If not, see
57
#  for a copy.
58
#
59 50 dgisselq
# License:      GPL, v3, as defined and found on www.gnu.org,
60
#               http://www.gnu.org/licenses/gpl.html
61
#
62
#
63
################################################################################
64
#
65 202 dgisselq
.PHONY: all
66
all: $(OBJDIR)/ hellosim simtest simuart cmptest
67 41 dgisselq
 
68 202 dgisselq
CC      := zip-gcc
69
CPP     := zip-cpp
70
AS      := zip-as
71
LD      := zip-ld
72
OBJDUMP := zip-objdump
73
OBJDIR := obj-zip
74
CFLAGS := -O3
75
LIBD   := ../../sw/install/cross-tools/zip/lib
76
LIBS   := -L$(LIBD) -lzipbasic
77
LDSCRIPT:= ../zipsim.ld
78 41 dgisselq
 
79 202 dgisselq
$(OBJDIR)/%.o: %.c $(OBJDIR)/
80
        $(CC) $(CFLAGS) -c $< -o $@
81 41 dgisselq
 
82 202 dgisselq
$(OBJDIR)/%.o: %.s $(OBJDIR)/
83
        $(AS) $< -o $@
84 74 dgisselq
 
85 202 dgisselq
%.txt: %
86
        $(OBJDUMP) -dr $< > $@
87 74 dgisselq
 
88 202 dgisselq
#
89
# hellosim
90
#
91
# This is an assembly version of Hello World that uses the new SIM instructions.
92
# It should fail with an illegal instruction error if it is ever tried on an
93
# RTL-synthesized implementation
94
#
95
hellosim: $(OBJDIR)/hellosim.o
96
        $(LD) -T $(LDSCRIPT) $< -o $@
97 41 dgisselq
 
98 202 dgisselq
#
99
# simuart
100
#
101
# This is an assembly version of Hello World that uses the UART in the
102
# process.  It doesn't use newlib or any other support tools, just binutils.
103
#
104
simuart: $(OBJDIR)/simuart.o
105
        $(LD) -T $(LDSCRIPT) $< -o $@
106 41 dgisselq
 
107 202 dgisselq
#
108
# simtest
109
#
110
# This is just a simple series of instruction tests that should be able to be
111
# used to determine whether the simulator has a basic amount of functionality.
112
# Because the test includes #define, #ifdef, and #endif statements, though, it
113
# needs to be run through the C pre-processor before it can go through the
114
# assembler.  Hence the build is a tocuh trickier, but still simple enough.
115
#
116
$(OBJDIR)/simtest.o: simtest.s $(OBJDIR)/
117
        $(CPP) $< > $(OBJDIR)/simtest.s
118
        $(AS) $(OBJDIR)/simtest.s -o $@
119 41 dgisselq
 
120 202 dgisselq
simtest: $(OBJDIR)/simtest.o
121
        $(LD) -T $(LDSCRIPT) $< -o $@
122
 
123
cmptest: $(OBJDIR)/cmptest.o
124
        $(LD) -T $(LDSCRIPT) -Map=map.txt $< -o $@
125
 
126
 
127
$(OBJDIR)/:
128
        @bash -c "if [[ ! -e $(OBJDIR) ]]; then mkdir -p $(OBJDIR)/; fi"
129
 
130
.PHONY: clean
131 41 dgisselq
clean:
132 202 dgisselq
        rm -rf $(OBJDIR)/
133
        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.