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

Subversion Repositories zipcpu

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 50 dgisselq
################################################################################
2 209 dgisselq
##
3
## Filename:    Makefile
4
##
5
## Project:     Zip CPU -- a small, lightweight, RISC CPU soft core
6
##
7
## 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
##
11
## 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
## Creator:     Dan Gisselquist, Ph.D.
38
##              Gisselquist Technology, LLC
39
##
40 50 dgisselq
################################################################################
41 209 dgisselq
##
42
## Copyright (C) 2017, Gisselquist Technology, LLC
43
##
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
## 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
## License:     GPL, v3, as defined and found on www.gnu.org,
60
##              http://www.gnu.org/licenses/gpl.html
61
##
62
##
63 50 dgisselq
################################################################################
64 209 dgisselq
##
65
##
66 202 dgisselq
.PHONY: all
67 209 dgisselq
all:
68
PROGRAMS := hellosim simuart simtest cmptest
69
all: $(PROGRAMS)
70 41 dgisselq
 
71 202 dgisselq
CC      := zip-gcc
72
CPP     := zip-cpp
73
AS      := zip-as
74
LD      := zip-ld
75
OBJDUMP := zip-objdump
76
OBJDIR := obj-zip
77
CFLAGS := -O3
78
LIBD   := ../../sw/install/cross-tools/zip/lib
79
LIBS   := -L$(LIBD) -lzipbasic
80 209 dgisselq
LDSCRIPT:= ./simscript.ld
81 41 dgisselq
 
82 209 dgisselq
$(OBJDIR)/%.o: %.c
83
        $(mk-objdir)
84 202 dgisselq
        $(CC) $(CFLAGS) -c $< -o $@
85 41 dgisselq
 
86 209 dgisselq
$(OBJDIR)/%.o: %.s
87
        $(mk-objdir)
88 202 dgisselq
        $(AS) $< -o $@
89 74 dgisselq
 
90 202 dgisselq
%.txt: %
91
        $(OBJDUMP) -dr $< > $@
92 74 dgisselq
 
93 202 dgisselq
#
94
# hellosim
95
#
96
# This is an assembly version of Hello World that uses the new SIM instructions.
97
# It should fail with an illegal instruction error if it is ever tried on an
98
# RTL-synthesized implementation
99
#
100
hellosim: $(OBJDIR)/hellosim.o
101
        $(LD) -T $(LDSCRIPT) $< -o $@
102 41 dgisselq
 
103 202 dgisselq
#
104
# simuart
105
#
106
# This is an assembly version of Hello World that uses the UART in the
107
# process.  It doesn't use newlib or any other support tools, just binutils.
108
#
109
simuart: $(OBJDIR)/simuart.o
110
        $(LD) -T $(LDSCRIPT) $< -o $@
111 41 dgisselq
 
112 202 dgisselq
#
113
# simtest
114
#
115
# This is just a simple series of instruction tests that should be able to be
116
# used to determine whether the simulator has a basic amount of functionality.
117
# Because the test includes #define, #ifdef, and #endif statements, though, it
118
# needs to be run through the C pre-processor before it can go through the
119
# assembler.  Hence the build is a tocuh trickier, but still simple enough.
120
#
121 209 dgisselq
$(OBJDIR)/simtest.o: simtest.s
122
        $(mk-objdir)
123 202 dgisselq
        $(CPP) $< > $(OBJDIR)/simtest.s
124
        $(AS) $(OBJDIR)/simtest.s -o $@
125 41 dgisselq
 
126 202 dgisselq
simtest: $(OBJDIR)/simtest.o
127
        $(LD) -T $(LDSCRIPT) $< -o $@
128
 
129
cmptest: $(OBJDIR)/cmptest.o
130
        $(LD) -T $(LDSCRIPT) -Map=map.txt $< -o $@
131
 
132
 
133 209 dgisselq
define  mk-objdir
134 202 dgisselq
        @bash -c "if [[ ! -e $(OBJDIR) ]]; then mkdir -p $(OBJDIR)/; fi"
135 209 dgisselq
endef
136 202 dgisselq
 
137 209 dgisselq
tags: $(wildcard *.c) $(wildcard *.h) $(wildcard *.cpp)
138
        @echo "Generating tags"
139
        @ctags $(wildcard *.c) $(wildcard *.h)
140
 
141 202 dgisselq
.PHONY: clean
142 41 dgisselq
clean:
143 202 dgisselq
        rm -rf $(OBJDIR)/
144 209 dgisselq
        rm -rf $(PROGRAMS)

powered by: WebSVN 2.1.0

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