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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [tools/] [makefile] - Blame information for rev 349

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

Line No. Rev Author Line
1 137 rhoads
# The CC_X86 is for compiling tools on your PC.
2
# The GCC_MIPS is for compiling code on the target.
3 191 rhoads
# Convert_bin changes test.axf into code.txt which is used by the VHDL.
4 290 rhoads
# Convert_bin == "objcopy -I elf32-big -O binary test.axf test.bin"
5 126 rhoads
 
6 179 rhoads
 
7 336 rhoads
ifeq ($(LANG),)
8
 
9 179 rhoads
# Customize for Windows
10 336 rhoads
# The MIPS gcc compiler must use the cygwin1.dll that came with the compiler.
11 243 rhoads
CC_X86 = cl /O1 /nologo
12 179 rhoads
CP = copy
13
RM = del
14 336 rhoads
DWIN32 = -DWIN32
15 193 rhoads
BIN_MIPS = ..\gccmips_elf
16 182 rhoads
VHDL_DIR = ..\vhdl
17 336 rhoads
LINUX_PWD =
18 193 rhoads
GCC_MIPS  = $(BIN_MIPS)\gcc $(CFLAGS)
19
AS_MIPS   = $(BIN_MIPS)\as
20
LD_MIPS   = $(BIN_MIPS)\ld
21
DUMP_MIPS = $(BIN_MIPS)\objdump
22 336 rhoads
CONVERT_BIN = $(LINUX_PWD)convert_bin.exe
23 2 rhoads
 
24 336 rhoads
else
25
 
26
# Customized for Linux
27
# See http://www.opencores.com/projects.cgi/web/mips/linux_tools.htm
28
CC_X86 = gcc -Wall -O -g
29
CP = cp
30
RM = rm -rf
31
DWIN32 =
32
BIN_MIPS =
33
VHDL_DIR = ../vhdl
34
LINUX_PWD = ./
35
GCC_MIPS  = $(BIN_MIPS)mips-elf-gcc $(CFLAGS)
36
AS_MIPS   = $(BIN_MIPS)mips-elf-as
37
LD_MIPS   = $(BIN_MIPS)mips-elf-ld
38
DUMP_MIPS = $(BIN_MIPS)mips-elf-objdump
39
CONVERT_BIN = $(LINUX_PWD)convert_bin.exe
40
#CONVERT_BIN = $(BIN_MIPS)mips-elf-objcopy -I elf32-big -O binary test.axf test.bin
41
 
42
endif
43
 
44 200 rhoads
CFLAGS = -O2 -Wall -c -s
45 47 rhoads
 
46 179 rhoads
all: convert_bin.exe tracehex.exe bintohex.exe ram_image.exe
47 336 rhoads
        @echo make targets = count, opcodes, pi, test, run, tohex, \
48 243 rhoads
        bootldr, toimage, etermip
49 336 rhoads
 
50 137 rhoads
clean:
51 272 rhoads
        -$(RM) *.o *.obj *.map *.lst *.hex *.txt *.exe *.axf
52 137 rhoads
 
53 290 rhoads
#Same as "objcopy -I elf32-big -O binary test.axf test.bin"
54 137 rhoads
convert_bin.exe: convert.c
55
        @$(CC_X86) -o convert_bin.exe convert.c
56
 
57 170 rhoads
convert_le.exe: convert.c
58
        @$(CC_X86) -DLITTLE_ENDIAN -o convert_le.exe convert.c
59
 
60 41 rhoads
mlite.exe: mlite.c
61 336 rhoads
        @$(CC_X86) -o mlite.exe mlite.c $(DWIN32)
62 2 rhoads
 
63 7 rhoads
tracehex.exe: tracehex.c
64 137 rhoads
        @$(CC_X86) -o tracehex.exe tracehex.c
65 2 rhoads
 
66 47 rhoads
bintohex.exe: bintohex.c
67 137 rhoads
        @$(CC_X86) -o bintohex.exe bintohex.c
68 47 rhoads
 
69 137 rhoads
ram_image.exe: ram_image.c
70
        @$(CC_X86) -o ram_image.exe ram_image.c
71 47 rhoads
 
72 243 rhoads
# Terminal program that will download a new image and supports Ethernet
73
# traffic over UART.  Get wpcap.lib from http://www.winpcap.org/.
74
etermip: etermip.c
75
        -@$(CC_X86) -o etermip.exe etermip.c wpcap.lib
76
        @echo Get wpcap.lib from http://www.winpcap.org/
77
 
78 336 rhoads
nomult.exe: nomult.c
79
        -@$(CC_X86) -o nomult.exe nomult.c
80
 
81 243 rhoads
download: etermip
82
        @echo Reset board before downloading code
83
        etermip
84
 
85 179 rhoads
opcodes:
86 137 rhoads
        $(AS_MIPS) -o opcodes.o opcodes.asm
87 191 rhoads
        $(LD_MIPS) -Ttext 0 -eentry -Map test.map -s -N -o test.axf opcodes.o
88
        -@$(DUMP_MIPS) --disassemble test.axf > test.lst
89 336 rhoads
        $(CONVERT_BIN)
90 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
91 7 rhoads
 
92 179 rhoads
opcodes2:
93 137 rhoads
        $(AS_MIPS) -o opcodes.o opcodes.asm
94 191 rhoads
        $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf opcodes.o
95
        -@$(DUMP_MIPS) --disassemble test.axf > test.lst
96 336 rhoads
        $(CONVERT_BIN)
97 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
98 137 rhoads
 
99 179 rhoads
test:
100 137 rhoads
        $(AS_MIPS) -o boot.o boot.asm
101
        $(GCC_MIPS) test.c
102
        $(GCC_MIPS) no_os.c
103 191 rhoads
        $(LD_MIPS) -Ttext 0 -eentry -Map test.map -s -N -o test.axf \
104 137 rhoads
                boot.o test.o no_os.o
105 191 rhoads
        -@$(DUMP_MIPS) --disassemble test.axf > test.lst
106 336 rhoads
        $(CONVERT_BIN)
107 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
108 22 rhoads
 
109 179 rhoads
count:
110 137 rhoads
        $(AS_MIPS) -o boot.o boot.asm
111
        $(GCC_MIPS) count.c
112
        $(GCC_MIPS) no_os.c
113 191 rhoads
        $(LD_MIPS) -Ttext 0 -eentry -Map test.map -s -N -o test.axf \
114 137 rhoads
                boot.o count.o no_os.o
115 191 rhoads
        -$(DUMP_MIPS) --disassemble test.axf > test.lst
116 336 rhoads
        $(CONVERT_BIN)
117 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
118 32 rhoads
 
119 336 rhoads
count_le:
120
        $(AS_MIPS) -EL -o boot.o boot.asm
121
        $(GCC_MIPS) -EL count.c
122
        $(GCC_MIPS) -EL no_os.c
123
        $(LD_MIPS) -EL -Ttext 0 -eentry -Map test.map -s -N -o test.axf \
124
                boot.o count.o no_os.o
125
        -$(DUMP_MIPS) --disassemble test.axf > test.lst
126
        $(CONVERT_BIN)
127
        $(CP) code.txt $(VHDL_DIR)
128
 
129 179 rhoads
count2:
130 137 rhoads
        $(AS_MIPS) -o boot.o boot.asm
131
        $(GCC_MIPS) count.c
132
        $(GCC_MIPS) no_os.c
133 191 rhoads
        $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
134 137 rhoads
                boot.o count.o no_os.o
135 191 rhoads
        -$(DUMP_MIPS) --disassemble test.axf > test.lst
136 336 rhoads
        $(CONVERT_BIN)
137 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
138 137 rhoads
 
139 272 rhoads
count3:
140
        $(AS_MIPS) -o boot.o boot.asm
141
        $(GCC_MIPS) count.c
142
        $(GCC_MIPS) no_os.c
143
        $(LD_MIPS) -Ttext 0x1000 -eentry -Map test.map -s -N -o test.axf \
144
                boot.o count.o no_os.o
145
        -$(DUMP_MIPS) --disassemble test.axf > test.lst
146 336 rhoads
        $(CONVERT_BIN)
147 272 rhoads
        $(CP) code.txt $(VHDL_DIR)
148
 
149 336 rhoads
count5: nomult.exe
150
        $(AS_MIPS) -o boot.o boot.asm
151
        $(AS_MIPS) -o mult_sim.o mult_sim.asm
152
        $(GCC_MIPS) count.c
153
        $(GCC_MIPS) no_os.c
154
        $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
155
                boot.o mult_sim.o count.o no_os.o
156
        -$(DUMP_MIPS) --disassemble test.axf > test.lst
157
        $(CP) test.axf test_old.axf
158
        nomult test.axf test.lst test.map
159
        -$(DUMP_MIPS) --disassemble test.axf > test2.lst
160
        $(CONVERT_BIN)
161
        $(CP) code.txt $(VHDL_DIR)
162
 
163 179 rhoads
pi:
164 137 rhoads
        $(AS_MIPS) -o boot.o boot.asm
165
        $(GCC_MIPS) pi.c
166 191 rhoads
        $(LD_MIPS) -Ttext 0 -eentry -Map test.map -s -N -o test.axf \
167 137 rhoads
                boot.o pi.o
168 191 rhoads
        @$(DUMP_MIPS) --disassemble test.axf > test.lst
169 336 rhoads
        $(CONVERT_BIN)
170 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
171 32 rhoads
 
172 179 rhoads
pi2:
173 137 rhoads
        $(AS_MIPS) -o boot.o boot.asm
174
        $(GCC_MIPS) pi.c
175 191 rhoads
        $(LD_MIPS) -Ttext 0x10000000 -eentry -Map test.map -s -N -o test.axf \
176 137 rhoads
                boot.o pi.o
177 191 rhoads
        @$(DUMP_MIPS) --disassemble test.axf > test.lst
178 336 rhoads
        $(CONVERT_BIN)
179 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
180 137 rhoads
 
181 336 rhoads
pi5: nomult.exe
182
        $(AS_MIPS) -o boot.o boot.asm
183
        $(AS_MIPS) -o mult_sim.o mult_sim.asm
184
        $(GCC_MIPS) pi.c
185
        $(LD_MIPS) -Ttext 0x0 -eentry -Map test.map -s -N -o test.axf \
186
                boot.o mult_sim.o pi.o
187
        @$(DUMP_MIPS) --disassemble test.axf > test.lst
188
        nomult test.axf test.lst test.map
189
        @$(DUMP_MIPS) --disassemble test.axf > test2.lst
190
        $(CONVERT_BIN)
191
        $(CP) code.txt $(VHDL_DIR)
192
 
193 272 rhoads
ddr_test:
194
        $(AS_MIPS) -o boot.o boot.asm
195
        $(GCC_MIPS) ddr_init.c -DDDR_TEST_MAIN
196
        $(GCC_MIPS) no_os.c
197
        $(LD_MIPS) -Ttext 0x0 -eentry -Map test.map -s -N -o test.axf \
198
                boot.o ddr_init.o no_os.o
199
        @$(DUMP_MIPS) --disassemble test.axf > test.lst
200 336 rhoads
        $(CONVERT_BIN)
201 272 rhoads
        $(CP) code.txt $(VHDL_DIR)
202
 
203
memtest:
204
        $(AS_MIPS) -o boot.o boot.asm
205
        $(GCC_MIPS) memtest.c
206
        $(LD_MIPS) -Ttext 0x1000 -eentry -o test.axf boot.o memtest.o
207 336 rhoads
        $(CONVERT_BIN)
208 272 rhoads
 
209
memtest2:
210
        $(AS_MIPS) -o boot.o boot.asm
211
        $(GCC_MIPS) -DINIT_DDR memtest.c
212
        $(GCC_MIPS) ddr_init.c
213
        $(LD_MIPS) -Ttext 0x0 -eentry -o test.axf boot.o memtest.o ddr_init.o
214 336 rhoads
        $(CONVERT_BIN)
215 272 rhoads
 
216 290 rhoads
memtest3:
217
        $(AS_MIPS) -o boot.o boot.asm
218
        $(GCC_MIPS) memtest.c
219
        $(LD_MIPS) -Ttext 0x10000000 -eentry -o test.axf boot.o memtest.o
220 336 rhoads
        $(CONVERT_BIN)
221 290 rhoads
 
222 179 rhoads
bootldr:
223 137 rhoads
        $(AS_MIPS) -o boot.o boot.asm
224
        $(GCC_MIPS) bootldr.c
225
        $(GCC_MIPS) no_os.c
226 272 rhoads
        $(GCC_MIPS) -DDLL_DISABLE ddr_init.c
227 191 rhoads
        $(LD_MIPS) -Ttext 0 -eentry -Map test.map -s -N -o test.axf \
228 272 rhoads
                boot.o bootldr.o no_os.o ddr_init.o
229 191 rhoads
        @$(DUMP_MIPS) --disassemble test.axf > test.lst
230 336 rhoads
        $(CONVERT_BIN)
231 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
232 349 rhoads
        @echo Next do "make toimage" for Xilinx or "make tohex" for Altera.
233 137 rhoads
 
234 290 rhoads
bootldr2:
235
        $(AS_MIPS) -o boot.o boot.asm
236
        $(GCC_MIPS) bootldr.c
237
        $(GCC_MIPS) no_os.c
238
        $(GCC_MIPS) -DDLL_DISABLE ddr_init.c
239
        $(LD_MIPS) -Ttext 0x1000 -eentry -Map test.map -s -N -o test.axf \
240
                boot.o bootldr.o no_os.o ddr_init.o
241
        @$(DUMP_MIPS) --disassemble test.axf > test.lst
242 336 rhoads
        $(CONVERT_BIN)
243 290 rhoads
        $(CP) code.txt $(VHDL_DIR)
244
 
245 179 rhoads
bootldr_little_endian: convert_le.exe
246 170 rhoads
        $(AS_MIPS) -EL -o boot.o boot.asm
247
        $(GCC_MIPS) -EL bootldr.c
248
        $(GCC_MIPS) -EL no_os.c
249 272 rhoads
        $(GCC_MIPS) -EL ddr_init.c
250 191 rhoads
        $(LD_MIPS) -EL -Ttext 0 -eentry -Map test.map -s -N -o test.axf \
251 272 rhoads
                boot.o bootldr.o no_os.o ddr_init.o
252 191 rhoads
        @$(DUMP_MIPS) --disassemble test.axf > test.lst
253 336 rhoads
        $(LINUX_PWD)convert_le.exe
254 182 rhoads
        $(CP) code.txt $(VHDL_DIR)
255 170 rhoads
 
256 137 rhoads
# Run a MIPS opcode simulator
257 41 rhoads
run: mlite.exe
258 336 rhoads
        @$(LINUX_PWD)mlite.exe test.bin
259 22 rhoads
 
260 170 rhoads
run_little_endian: mlite.exe
261 336 rhoads
        @$(LINUX_PWD)mlite.exe test.bin L
262 170 rhoads
 
263 243 rhoads
disassemble: mlite.exe
264 336 rhoads
        $(LINUX_PWD)mlite.exe test.bin BD > test.txt
265 22 rhoads
 
266 137 rhoads
# Used by Altera FPGAs for ram image
267 243 rhoads
tohex: bintohex.exe
268 336 rhoads
        $(LINUX_PWD)bintohex.exe test.bin
269 182 rhoads
        $(CP) code*.hex $(VHDL_DIR)
270 137 rhoads
 
271
# Used by Xilinx FPGAs for ram image
272
toimage:
273 336 rhoads
        $(LINUX_PWD)ram_image.exe ../vhdl/ram_xilinx.vhd ../vhdl/code.txt ../vhdl/ram_image.vhd
274 137 rhoads
 
275
 

powered by: WebSVN 2.1.0

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