forked from gvsoc/gvsoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
174 lines (137 loc) · 5.44 KB
/
Makefile
File metadata and controls
174 lines (137 loc) · 5.44 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
include test.mk
CMAKE_FLAGS ?= -j 16
CMAKE ?= cmake
TARGETS ?= rv64 \
rv64_untimed \
pulp-open \
pulp-open-nn \
pulp-open:chip/cluster/redmule=True \
pulp.spatz.spatz \
snitch_spatz \
occamy \
siracusa \
snitch \
ara \
spatz \
snitch:core_type=fast \
pulp.snitch.snitch_cluster_single \
chimera \
snitch_testbench \
magia \
mempool
ifndef BUILDDIR
ifdef GVSOC_WORKDIR
BUILDDIR = $(GVSOC_WORKDIR)/build
else
BUILDDIR = build
endif
endif
ifndef INSTALLDIR
ifdef GVSOC_WORKDIR
INSTALLDIR = $(GVSOC_WORKDIR)/install
else
INSTALLDIR = install
endif
endif
export PATH:=$(CURDIR)/gapy/bin:$(PATH)
all: checkout build
checkout:
git submodule update --recursive --init
.PHONY: build
ifdef DEBUG
BUILD_TYPE = RelWithDebInfo
else
BUILD_TYPE = Release
endif
gvrun.build:
$(CMAKE) -S gvrun -B $(BUILDDIR)/gvrun -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_INSTALL_PREFIX=$(INSTALLDIR)
cmake --build $(BUILDDIR)/gvrun $(CMAKE_FLAGS)
cmake --install $(BUILDDIR)/gvrun
build: gvrun.build
# Change directory to curdir to avoid issue with symbolic links
cd $(CURDIR) && $(CMAKE) -S . -B $(BUILDDIR) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_INSTALL_PREFIX=$(INSTALLDIR) \
-DGVSOC_MODULES="$(CURDIR)/core/models;$(CURDIR)/pulp;$(CURDIR)/gvrun/python;$(MODULES)" \
-DGVSOC_TARGETS="${TARGETS}" \
-DCMAKE_SKIP_INSTALL_RPATH=false
cd $(CURDIR) && $(CMAKE) --build $(BUILDDIR) $(CMAKE_FLAGS)
cd $(CURDIR) && $(CMAKE) --install $(BUILDDIR)
clean:
rm -rf $(BUILDDIR) $(INSTALLDIR)
github.test:
gvtest --testset testset-github.cfg --max-timeout 120 --no-fail run table junit
riscv:
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.01.17/riscv64-elf-ubuntu-22.04-gcc-nightly-2025.01.17-nightly.tar.xz
tar xvf riscv64-elf-ubuntu-22.04-gcc-nightly-2025.01.17-nightly.tar.xz
test.withbuild: riscv
PATH=$(CURDIR)/riscv/bin:$(PATH) && gvtest --testset testset_withbuild.cfg --thread 1 --no-fail run table junit
doc:
cd core/docs/user_manual && make html
cd core/docs/developer_manual && make html
@echo
@echo "User documentation: core/docs/user_manual/_build/html/index.html"
@echo "Developper documentation: core/docs/developer_manual/_build/html/index.html"
######################################################################
## Make Targets for DRAMSys Integration ##
######################################################################
SYSTEMC_VERSION := 2.3.3
SYSTEMC_GIT_URL := https://github.com/accellera-official/systemc.git
SYSTEMC_INSTALL_DIR := $(PWD)/third_party/systemc_install
drmasys_apply_patch:
git submodule update --init --recursive
if cd core && git apply --check ../add_dramsyslib_patches/gvsoc_core.patch; then \
git apply ../add_dramsyslib_patches/gvsoc_core.patch;\
fi
if cd pulp && git apply --check ../add_dramsyslib_patches/gvsoc_pulp.patch; then \
git apply ../add_dramsyslib_patches/gvsoc_pulp.patch;\
fi
build-systemc: third_party/systemc_install/lib64/libsystemc.so
third_party/systemc_install/lib64/libsystemc.so:
mkdir -p $(SYSTEMC_INSTALL_DIR)
cd third_party && \
git clone $(SYSTEMC_GIT_URL) && \
cd systemc && git fetch --tags && git checkout $(SYSTEMC_VERSION) && \
mkdir build && cd build && \
$(CMAKE) -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=$(SYSTEMC_INSTALL_DIR) -DCMAKE_INSTALL_LIBDIR=lib64 .. && \
make && make install
build-dramsys: build-systemc third_party/DRAMSys/libDRAMSys_Simulator.so
third_party/DRAMSys/libDRAMSys_Simulator.so:
mkdir -p third_party/DRAMSys
cp add_dramsyslib_patches/libDRAMSys_Simulator.so third_party/DRAMSys/
echo "Check Library Functionality"
cd add_dramsyslib_patches/build_dynlib_from_github_dramsys5/dynamic_load/ && \
gcc main.c -ldl
@if add_dramsyslib_patches/build_dynlib_from_github_dramsys5/dynamic_load/a.out ; then \
echo "Test libaray succeeded"; \
rm add_dramsyslib_patches/build_dynlib_from_github_dramsys5/dynamic_load/a.out; \
rm DRAMSysRecordable* ; \
else \
rm add_dramsyslib_patches/build_dynlib_from_github_dramsys5/dynamic_load/a.out; \
rm third_party/DRAMSys/libDRAMSys_Simulator.so; \
echo "Test libaray failed, We need to rebuild the library, tasks around 40 min"; \
echo -n "Do you want to proceed? (y/n) "; \
read -t 30 -r user_input; \
if [ "$$user_input" = "n" ]; then echo "oops, I see, your time is precious, see you next time"; exit 1; fi; \
echo "Go Go Go!" ; \
cd add_dramsyslib_patches/build_dynlib_from_github_dramsys5 && make all; \
cp DRAMSys/build/lib/libDRAMSys_Simulator.so ../../third_party/DRAMSys/ ; \
make clean; \
fi
build-configs: core/models/memory/dramsys_configs
core/models/memory/dramsys_configs:
cp -rf add_dramsyslib_patches/dramsys_configs core/models/memory/
dramsys_preparation: build-systemc build-dramsys build-configs
clean_dramsys_preparation:
rm -rf third_party
######################################################################
## Snitch cluster testsuite ##
######################################################################
snitch_cluster.checkout:
git clone git@github.com:pulp-platform/snitch_cluster.git -b gvsoc-ci
cd snitch_cluster && git submodule update --recursive --init
snitch_cluster.build:
cd snitch_cluster/target/snitch_cluster && make DEBUG=ON OPENOCD_SEMIHOSTING=ON sw
snitch_cluster.test:
cd snitch_cluster/target/snitch_cluster && GVSOC_TARGET=$(TARGETS) ./util/run.py sw/run.yaml --simulator gvsoc -j
snitch_cluster: snitch_cluster.checkout snitch_cluster.build snitch_cluster.test