-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
166 lines (141 loc) · 3.86 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#
# Makefile for Leros build
#
# cleanup
EXTENSIONS=class rbf rpt sof pin summary ttf qdf dat wlf done qws
#
# Set USB to true for an FTDI chip based board (dspio, usbmin, lego)
#
USB=true
USB=false
# Assembler files
APP=test
APP=muvium
# Java application
JAPP=Blink
JAPP_PKG=.
# Target Java compiler
# muvium has issues with the current Oracle javac,
# so we use jikes
JAVAC_TARG=jikes/jikes
# JAVAC_TARG=javac
# Altera FPGA configuration cable
#BLASTER_TYPE=ByteBlasterMV
BLASTER_TYPE=USB-Blaster
ifeq ($(WINDIR),)
USBRUNNER=./USBRunner
S=:
else
USBRUNNER=USBRunner.exe
S=\;
endif
# The VHDL project for Quartus
QPROJ=dspio
QPROJ=altde2-70
# Some shortcuts
MUVIUM=LerosMuviumSDK
MUVIUM_CP=./$(S)./lib/Muvium-Leros.jar$(S)./MUVIUM_CP=./$(S)./lib/jdom.jar$(S)./lib/jaxen.jar$(S).
# We need paths to the JDK and the main application
# Java packages are at the moment ignored, maybe do it JOP like
# Redefine TARGET_SRC to put your sources somewhere else
JDK_SRC=java/target/src
TARGET_SRC=java/target/src
SOURCE_PATH=$(JDK_SRC)$(S)$(TARGET_SRC)
all: directories tools rom
make lerosusb
make config
directories:
-mkdir rbf
tools:
-rm -rf rbf
-rm -rf java/tools/classes
-rm -rf java/tools/lib
-rm -rf java/tools/src/leros/asm/generated
mkdir rbf
mkdir java/tools/classes
mkdir java/tools/lib
mkdir java/tools/src/leros/asm/generated
java -classpath lib/antlr-3.3-complete.jar org.antlr.Tool \
-fo java/tools/src/leros/asm/generated \
java/tools/src/grammar/Leros.g
javac -classpath lib/antlr-3.3-complete.jar -d java/tools/classes java/tools/src/leros/asm/generated/*.java java/tools/src/leros/asm/*.java
javac -d java/tools/classes -sourcepath java/tools/src java/tools/src/leros/sim/*.java
cd java/tools/classes && jar cf ../lib/leros-tools.jar *
java_app:
-rm -rf java/target/classes
mkdir java/target/classes
$(JAVAC_TARG) -target 1.5 -g -d java/target/classes \
-sourcepath $(SOURCE_PATH) $(TARGET_SRC)/$(JAPP).java
cd $(MUVIUM); java -cp $(MUVIUM_CP)$(S)../java/target/classes \
MuviumMetal $(JAPP) config.xml ../asm/muvium.asm
japp:
make java_app
make rom -e APP=muvium
make lerosusb
make config
rom:
-rm -rf vhdl/generated
mkdir vhdl/generated
java -cp java/tools/lib/leros-tools.jar$(S)lib/antlr-3.3-complete.jar leros.asm.LerosAsm -s asm -d vhdl/generated $(APP).asm
jsim: rom
java -cp java/tools/lib/leros-tools.jar -Dlog=false \
leros.sim.LerosSim rom.txt
sim: rom
cd modelsim; make
# configure the FPGA
config:
ifeq ($(USB),true)
make config_usb
else
ifeq ($(XFPGA),true)
make config_xilinx
else
make config_byteblaster
endif
endif
lerosusb:
@echo $(QPROJ)
for target in $(QPROJ); do \
make qsyn -e QBT=$$target || exit; \
cd quartus/$$target && quartus_cpf -c leros.sof ../../rbf/$$target.rbf; \
done
#
# Quartus build process
# called by jopser, jopusb,...
#
qsyn:
echo $(QBT)
echo "building $(QBT)"
-rm -rf quartus/$(QBT)/db
-rm -f quartus/$(QBT)/leros.sof
-rm -f jbc/$(QBT).jbc
-rm -f rbf/$(QBT).rbf
quartus_map quartus/$(QBT)/leros
quartus_fit quartus/$(QBT)/leros
quartus_asm quartus/$(QBT)/leros
quartus_sta quartus/$(QBT)/leros
config_byteblaster:
cd quartus/$(QPROJ) && quartus_pgm -c $(BLASTER_TYPE) -m JTAG leros.cdf
config_usb:
cd rbf && ../$(USBRUNNER) $(QPROJ).rbf
# TODO: no Xilinx Makefiles available yet
config_xilinx:
cd xilinx/$(XPROJ) && make config
clean:
for ext in $(EXTENSIONS); do \
find `ls` -name \*.$$ext -print -exec rm -r -f {} \; ; \
done
-find `ls` -name leros.pof -print -exec rm -r -f {} \;
-find `ls` -name db -print -exec rm -r -f {} \;
-find `ls` -name incremental_db -print -exec rm -r -f {} \;
-find `ls` -name leros_description.txt -print -exec rm -r -f {} \;
-rm -rf asm/generated
-rm -f vhdl/*.vhd
-rm -rf $(TOOLS)/dist
-rm -rf $(PCTOOLS)/dist
-rm -rf $(TARGET)/dist
-rm -rf modelsim/work
-rm -rf modelsim/transcript
-rm -rf modelsim/gaisler
-rm -rf modelsim/grlib
-rm -rf modelsim/techmap