-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
153 lines (132 loc) · 3.88 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
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
BUILD_PATH=./build
BUILD_NAME=top
GATEWARE_BUILD_PATH=$(BUILD_PATH)/gateware
SOFTWARE_BUILD_PATH=$(BUILD_PATH)/software
SOURCE_PATH=./source
GATEWARE_SOURCE_PATH=$(SOURCE_PATH)/gateware
SOFTWARE_SOURCE_PATH=$(SOURCE_PATH)/software
BITSTREAM=$(GATEWARE_BUILD_PATH)/$(BUILD_NAME).bin
FIRMWARE_PATH=$(SOFTWARE_SOURCE_PATH)/firmware
FIRMWARE=$(FIRMWARE_PATH)/firmware.bin
FIRMWARE_FBI=$(FIRMWARE_PATH)/firmware.fbi
IDENTIFIER="Arty-S7 RISC64 v1.0"
IDENTIFIER_VER=true
CSR_JSON=$(BUILD_PATH)/csr.json
CSR_CSV=$(BUILD_PATH)/csr.csv
DEV = "/dev/ttyUSB1"
UART_BAUD=115200
CPU_TYPE="vexriscv"
CPU_VARIANT="linux"
$(BITSTREAM): $(GATEWARE_SOURCE_PATH)/*.py
@./make.py build \
--build_name $(BUILD_NAME) \
--cpu-type $(CPU_TYPE) \
--cpu-variant $(CPU_VARIANT) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH) \
--ident $(IDENTIFIER) \
--ident-version $(IDENTIFIER_VER) \
--uart-baudrate $(UART_BAUD) \
--csr-json $(CSR_JSON) \
--csr-csv $(CSR_CSV)
build-sw:
@./make.py build-sw \
--build_name $(BUILD_NAME) \
--cpu-type $(CPU_TYPE) \
--cpu-variant $(CPU_VARIANT) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH) \
--ident $(IDENTIFIER) \
--ident-version $(IDENTIFIER_VER) \
--csr-json $(CSR_JSON) \
--csr-csv $(CSR_CSV)
build-fpga:
@./make.py build-sw \
--build_name $(BUILD_NAME) \
--cpu-type $(CPU_TYPE) \
--cpu-variant $(CPU_VARIANT) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH) \
--ident $(IDENTIFIER) \
--ident-version $(IDENTIFIER_VER) \
--csr-json $(CSR_JSON) \
--csr-csv $(CSR_CSV)
conv:
@./make.py conv \
--build_name $(BUILD_NAME) \
--cpu-type $(CPU_TYPE) \
--cpu-variant $(CPU_VARIANT) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH) \
--ident $(IDENTIFIER) \
--ident-version $(IDENTIFIER_VER) \
--csr-json $(CSR_JSON) \
--csr-csv $(CSR_CSV)
load: $(BITSTREAM)
@./make.py load \
--build_name $(BUILD_NAME) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH)
reload:
@# Does not check for changes in source files. Just uses existing
@# bitstream.
@./make.py load \
--build_name $(BUILD_NAME) \
--cpu-type $(CPU_TYPE) \
--cpu-variant $(CPU_VARIANT) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH)
flash: $(BITSTREAM)
@./make.py flash \
--build_name $(BUILD_NAME) \
--cpu-type $(CPU_TYPE) \
--cpu-variant $(CPU_VARIANT) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH)
reflash:
@# Does not check for changes in source files. Just uses existing
@# bitstream.
@./make.py flash \
--build_name $(BUILD_NAME) \
--cpu-type $(CPU_TYPE) \
--cpu-variant $(CPU_VARIANT) \
--output-dir $(BUILD_PATH) \
--gateware-dir $(GATEWARE_BUILD_PATH) \
--software-dir $(SOFTWARE_BUILD_PATH)
flash-sw:
@./make.py flash-sw \
--firmware=$(FIRMWARE_FBI)
term:
@litex_term --speed $(UART_BAUD) $(DEV)
load-sw:
@litex_term --kernel $(FIRMWARE) --speed $(UART_BAUD) $(DEV)
SD_CARD = "/media/$(USER)/LITEX"
SD_DEV = $(shell findmnt -n -o SOURCE --target /media/$(USER)/LITEX)
sdcard-init:
ifeq ($(SD_DEV),)
@echo "SD-Card 'LiteX' not found !!!"
else
@echo "Initialize LiteX boot SD-Card on $(SD_DEV)"
-@umount $(SD_DEV)
@sudo mkfs.fat -n LITEX -F 16 $(SD_DEV)
endif
sdcard:
@echo "Copy firmware to SD-Card ($(SD_CARD))"
@if [ -d $(SD_CARD) ]; then \
cp $(FIRMWARE) /media/$(USER)/LITEX/BOOT.BIN; \
else \
echo "SD-Card ($(SD_CARD)) not found !!!"; \
fi
clean:
rm -rf build/*
rm -f vivado.log
rm -f vivado.jou
rm -frd .Xil
.PHONY: clean load load-sw reload flash flash-sw reflash conv term sdcard-init sdcard