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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [tools/] [makefile] - Blame information for rev 413

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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