-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
47 lines (39 loc) · 1.41 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
@PHONY: env
projects = sevensegment \
led_example \
morse \
spi_can \
spi_oled \
snake
all: build-all
define template
freedom-e-sdk/software/$(1): freedom-e-sdk/software
cd freedom-e-sdk/software && ln -sd ../../$(1) || true
build-$(1): freedom-e-sdk/software/$(1) env
cd freedom-e-sdk && make software PROGRAM=$(1)
upload-$(1): build-$(1)
cd freedom-e-sdk && make upload PROGRAM=$(1)
sim-$(1): build-$(1)
hifive-vp --disable-inline-oled --wait-for-gpio-connection $(1)/$(1)
endef
$(foreach project,$(projects),$(eval $(call template,$(project))))
pres = $(addprefix pre-, $(projects))
pre: $(pres)
build-all: $(addprefix build-, $(projects))
freedom-e-sdk/software:
git submodule update --init # --recursive
env:
ifneq ("$(shell which riscv64-unknown-elf-gcc)","")
# TODO: Add check if riscv64-compiler is actually multilib
@echo "existing compiler found"
export RISCV_PATH="$(shell dirname $(shell which riscv64-unknown-elf-gcc))/../"
@echo "if this ->$(shell echo $$RISCV_PATH)<- is empty, then just copy/paste the expression into your terminal. Makefiles are hard."
else
@echo "No compiler found, using internal"
git submodule update --init --recursive
cd freedom-e-sdk && make riscv-gnu-toolchain
endif
ifeq ("$(shell which riscv-vp)","")
@echo "No riscv-vp found!"
endif
#export RISCV_OPENOCD="/home/dwd/dev/sifive--hifive1/freedom-e-sdk/work/build/openocd/src/openocd"