-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathMakefile
79 lines (64 loc) · 1.64 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
include $(abs_top_srcdir)/Makefrag
tests = \
test \
mlp1 \
mlp2 \
mlp3 \
mlp4 \
mlp1_32 \
mlp2_32 \
mlp3_32 \
mlp4_32
tests_baremetal = $(tests:=-baremetal)
runs_baremetal = $(addsuffix .run,$(tests_baremetal))
ifdef BAREMETAL_ONLY
tests_linux =
tests_pk =
else
tests_linux = $(tests:=-linux)
tests_pk = $(tests:=-pk)
endif
BENCH_COMMON = $(abs_top_srcdir)/riscv-tests/benchmarks/common
GEMMINI_HEADERS = $(abs_top_srcdir)/include/gemmini.h $(abs_top_srcdir)/include/gemmini_params.h $(abs_top_srcdir)/include/gemmini_nn.h $(abs_top_srcdir)/include/gemmini_testutils.h
CFLAGS := $(CFLAGS) \
-DPREALLOCATE=1 \
-DMULTITHREAD=1 \
-mcmodel=medany \
-std=gnu99 \
-O2 \
-ffast-math \
-fno-common \
-fno-builtin-printf \
-fno-tree-loop-distribute-patterns \
-march=rv64gc -Wa,-march=rv64gc \
-lm \
-lgcc \
-I$(abs_top_srcdir)/riscv-tests \
-I$(abs_top_srcdir)/riscv-tests/env \
-I$(abs_top_srcdir) \
-I$(BENCH_COMMON) \
-DID_STRING=$(ID_STRING) \
CFLAGS_PK := \
$(CFLAGS) \
-static \
-DBAREMETAL=1 \
CFLAGS_BAREMETAL := \
$(CFLAGS) \
-nostdlib \
-nostartfiles \
-static \
-T $(BENCH_COMMON)/test.ld \
-DBAREMETAL=1 \
all: $(tests_baremetal) $(tests_linux) $(tests_pk)
vpath %.c $(src_dir)
%-baremetal: %.c $(GEMMINI_HEADERS)
$(CC_BAREMETAL) $(CFLAGS_BAREMETAL) $< $(LFLAGS) -o $@ \
$(wildcard $(BENCH_COMMON)/*.c) $(wildcard $(BENCH_COMMON)/*.S) $(LIBS)
%-linux: %.c $(GEMMINI_HEADERS)
$(CC_LINUX) $(CFLAGS) $< $(LFLAGS) -o $@
%-pk: %.c $(GEMMINI_HEADERS)
$(CC_LINUX) $(CFLAGS_PK) $< $(LFLAGS) -o $@
run-baremetal: $(runs_baremetal)
%-baremetal.run: %-baremetal
$(RUNNER)$^
junk += $(tests_baremetal) $(tests_linux) $(tests_pk)