OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [software/] [makefile] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
# architecture: mips or riscv
2
ARCH=mips
3
 
4
# board specific parameters
5
BAUDRATE=57600
6
F_CLK=25000000
7
SERIAL_DEV=/dev/ttyUSB0
8
 
9
# compiler flags
10
CFLAGS_STRIP = -fdata-sections -ffunction-sections
11
LDFLAGS_STRIP = --gc-sections
12
 
13
CFLAGS_NO_HW_MULDIV = -mnohwmult -mnohwdiv -ffixed-lo -ffixed-hi
14
GCC_mips = mips-elf-gcc -O2 -c -mips1 -mpatfree -mfix-r4000 -mno-check-zero-division -msoft-float -fshort-double -ffreestanding -nostdlib -fomit-frame-pointer -G 0 -I ./include -DCPU_SPEED=${F_CLK} -DBIG_ENDIAN $(CFLAGS_STRIP) $(CFLAGS_NO_HW_MULDIV) # -DDEBUG_PORT
15
 
16
AS_mips = mips-elf-as -mips1 -msoft-float
17
LD_mips = mips-elf-ld -mips1 $(LDFLAGS_STRIP)
18
DUMP_mips = mips-elf-objdump
19
READ_mips = mips-elf-readelf
20
OBJ_mips = mips-elf-objcopy
21
SIZE_mips = mips-elf-size
22
 
23
GCC_riscv = riscv64-unknown-elf-gcc -march=RV32I -O2 -c -msoft-float -fshort-double -ffreestanding -nostdlib -ffixed-s10 -ffixed-s11 -I ./include -DCPU_SPEED=${F_CLK} -DLITTLE_ENDIAN $(CFLAGS_STRIP) #-ffixed-s10 -ffixed-s11 -mrvc -fPIC -DDEBUG_PORT
24
AS_riscv = riscv64-unknown-elf-as -m32 -msoft-float #-fPIC
25
LD_riscv = riscv64-unknown-elf-ld -melf32lriscv $(LDFLAGS_STRIP)
26
DUMP_riscv = riscv64-unknown-elf-objdump -Mno-aliases
27
READ_riscv = riscv64-unknown-elf-readelf
28
OBJ_riscv = riscv64-unknown-elf-objcopy
29
SIZE_riscv = riscv64-unknown-elf-size
30
 
31
all:
32
 
33
serial:
34
        stty ${BAUDRATE} raw cs8 -parenb -crtscts clocal cread ignpar ignbrk -ixon -ixoff -ixany -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -F ${SERIAL_DEV}
35
 
36
load: serial
37
        cp code.bin ${SERIAL_DEV}
38
 
39
debug: serial
40
        cat ${SERIAL_DEV}
41
 
42
monitor:
43
        $(AS_$(ARCH)) -o boot_rom.o lib/$(ARCH)/boot_rom.s
44
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
45
        $(GCC_$(ARCH)) -o monitor.o boot/monitor.c
46
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc_bootloader.ld -Map test.map -N -o test.axf \
47
                boot_rom.o libc.o monitor.o
48
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
49
        $(DUMP_$(ARCH)) -h test.axf > test.sec
50
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
51
        $(OBJ_$(ARCH)) -O binary test.axf test.bin --pad-to 4096
52
        $(SIZE_$(ARCH)) test.axf
53
        mv test.axf code.axf
54
        mv test.bin code.bin
55
        mv test.lst code.lst
56
        mv test.sec code.sec
57
        mv test.cnt code.cnt
58
        mv test.map code.map
59
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > boot.txt
60
        xxd -b -c 4 code.bin | awk '{print $$2 $$3 $$4 $$5}' > boot_bin.txt
61
        ./../tools/xilinx/ram_image ./../tools/xilinx/ram_xilinx.vhd boot.txt boot_ram.vhd
62
 
63
boot_sim:
64
        $(AS_$(ARCH)) -o boot_rom.o lib/$(ARCH)/boot_rom.s
65
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
66
        $(GCC_$(ARCH)) -o bootloader_sim.o boot/bootloader_sim.c
67
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc_bootloader.ld -Map test.map -N -o test.axf \
68
                boot_rom.o libc.o bootloader_sim.o
69
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
70
        $(DUMP_$(ARCH)) -h test.axf > test.sec
71
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
72
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
73
        $(SIZE_$(ARCH)) test.axf
74
        mv test.axf code.axf
75
        mv test.bin code.bin
76
        mv test.lst code.lst
77
        mv test.sec code.sec
78
        mv test.cnt code.cnt
79
        mv test.map code.map
80
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > boot.txt
81
 
82
eeprom_sim:
83
        echo "b16b00b5" > eeprom.txt
84
        printf "%08x\n" `stat -L -c %s code.txt` >> eeprom.txt
85
        cat code.txt >> eeprom.txt
86
 
87
hello:
88
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
89
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
90
        $(GCC_$(ARCH)) -o hello.o app/hello.c
91
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
92
                crt0.o libc.o hello.o
93
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
94
        $(DUMP_$(ARCH)) -h test.axf > test.sec
95
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
96
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
97
        $(SIZE_$(ARCH)) test.axf
98
        mv test.axf code.axf
99
        mv test.bin code.bin
100
        mv test.lst code.lst
101
        mv test.sec code.sec
102
        mv test.cnt code.cnt
103
        mv test.map code.map
104
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
105
 
106
fib:
107
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
108
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
109
        $(GCC_$(ARCH)) -o fib.o app/fib.c
110
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
111
                crt0.o libc.o fib.o
112
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
113
        $(DUMP_$(ARCH)) -h test.axf > test.sec
114
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
115
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
116
        $(SIZE_$(ARCH)) test.axf
117
        mv test.axf code.axf
118
        mv test.bin code.bin
119
        mv test.lst code.lst
120
        mv test.sec code.sec
121
        mv test.cnt code.cnt
122
        mv test.map code.map
123
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
124
 
125
interrupt_test:
126
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
127
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
128
        $(GCC_$(ARCH)) -o interrupt_test.o app/interrupt_test.c
129
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
130
                crt0.o libc.o interrupt_test.o
131
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
132
        $(DUMP_$(ARCH)) -h test.axf > test.sec
133
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
134
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
135
        $(SIZE_$(ARCH)) test.axf
136
        mv test.axf code.axf
137
        mv test.bin code.bin
138
        mv test.lst code.lst
139
        mv test.sec code.sec
140
        mv test.cnt code.cnt
141
        mv test.map code.map
142
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
143
 
144
sort:
145
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
146
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
147
        $(GCC_$(ARCH)) -o sort.o app/sort.c
148
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
149
                crt0.o libc.o sort.o
150
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
151
        $(DUMP_$(ARCH)) -h test.axf > test.sec
152
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
153
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
154
        $(SIZE_$(ARCH)) test.axf
155
        mv test.axf code.axf
156
        mv test.bin code.bin
157
        mv test.lst code.lst
158
        mv test.sec code.sec
159
        mv test.cnt code.cnt
160
        mv test.map code.map
161
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
162
 
163
test64:
164
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
165
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
166
        $(GCC_$(ARCH)) -o test64.o app/test64.c
167
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
168
                crt0.o libc.o test64.o
169
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
170
        $(DUMP_$(ARCH)) -h test.axf > test.sec
171
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
172
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
173
        $(SIZE_$(ARCH)) test.axf
174
        mv test.axf code.axf
175
        mv test.bin code.bin
176
        mv test.lst code.lst
177
        mv test.sec code.sec
178
        mv test.cnt code.cnt
179
        mv test.map code.map
180
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
181
 
182
test_crc:
183
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
184
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
185
        $(GCC_$(ARCH)) -o test_crc.o app/test_crc.c
186
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
187
                crt0.o libc.o test_crc.o
188
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
189
        $(DUMP_$(ARCH)) -h test.axf > test.sec
190
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
191
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
192
        $(SIZE_$(ARCH)) test.axf
193
        mv test.axf code.axf
194
        mv test.bin code.bin
195
        mv test.lst code.lst
196
        mv test.sec code.sec
197
        mv test.cnt code.cnt
198
        mv test.map code.map
199
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
200
 
201
xtea:
202
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
203
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
204
        $(GCC_$(ARCH)) -o xtea.o app/xtea.c
205
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
206
                crt0.o libc.o xtea.o
207
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
208
        $(DUMP_$(ARCH)) -h test.axf > test.sec
209
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
210
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
211
        $(SIZE_$(ARCH)) test.axf
212
        mv test.axf code.axf
213
        mv test.bin code.bin
214
        mv test.lst code.lst
215
        mv test.sec code.sec
216
        mv test.cnt code.cnt
217
        mv test.map code.map
218
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
219
 
220
xtea_hw:
221
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
222
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
223
        $(GCC_$(ARCH)) -o xtea_hw.o app/xtea_hw.c
224
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
225
                crt0.o libc.o xtea_hw.o
226
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
227
        $(DUMP_$(ARCH)) -h test.axf > test.sec
228
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
229
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
230
        $(SIZE_$(ARCH)) test.axf
231
        mv test.axf code.axf
232
        mv test.bin code.bin
233
        mv test.lst code.lst
234
        mv test.sec code.sec
235
        mv test.cnt code.cnt
236
        mv test.map code.map
237
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
238
 
239
test_spi:
240
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
241
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
242
        $(GCC_$(ARCH)) -o spi.o lib/spi.c
243
        $(GCC_$(ARCH)) -o test_spi.o app/test_spi.c
244
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
245
                crt0.o libc.o spi.o test_spi.o
246
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
247
        $(DUMP_$(ARCH)) -h test.axf > test.sec
248
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
249
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
250
        $(SIZE_$(ARCH)) test.axf
251
        mv test.axf code.axf
252
        mv test.bin code.bin
253
        mv test.lst code.lst
254
        mv test.sec code.sec
255
        mv test.cnt code.cnt
256
        mv test.map code.map
257
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
258
 
259
exp_io:
260
        $(AS_$(ARCH)) -o crt0.o lib/$(ARCH)/crt0.s
261
        $(GCC_$(ARCH)) -o libc.o lib/libc.c
262
        $(GCC_$(ARCH)) -o spi.o lib/spi.c
263
        $(GCC_$(ARCH)) -o mcp23s17.o lib/mcp23s17.c
264
        $(GCC_$(ARCH)) -o exp_io.o app/exp_io.c
265
        $(LD_$(ARCH)) -Tlib/$(ARCH)/hf-risc.ld -Map test.map -N -o test.axf \
266
                crt0.o libc.o spi.o mcp23s17.o exp_io.o
267
        $(DUMP_$(ARCH)) --disassemble --reloc test.axf > test.lst
268
        $(DUMP_$(ARCH)) -h test.axf > test.sec
269
        $(DUMP_$(ARCH)) -s test.axf > test.cnt
270
        $(OBJ_$(ARCH)) -O binary test.axf test.bin
271
        $(SIZE_$(ARCH)) test.axf
272
        mv test.axf code.axf
273
        mv test.bin code.bin
274
        mv test.lst code.lst
275
        mv test.sec code.sec
276
        mv test.cnt code.cnt
277
        mv test.map code.map
278
        hexdump -v -e '4/1 "%02x" "\n"' code.bin > code.txt
279
 
280
clean:
281
        -rm -rf *~ *.o *.axf *.map *.lst *.sec *.cnt *.txt *.bin *.vhd
282
        -rm -rf app/*~
283
        -rm -rf boot/*~
284
        -rm -rf include/*~
285
        -rm -rf lib/*~

powered by: WebSVN 2.1.0

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