-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
123 lines (94 loc) · 3.53 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
###################################################################
# Project Configuration:
#
# Specify the name of the design (project) and the Quartus II
# Settings File (.qsf)
###################################################################
PROJECT = vt100
TOP_LEVEL_ENTITY = vt100
ASSIGNMENT_FILES = $(PROJECT).qpf $(PROJECT).qsf
###################################################################
# Part, Family, Boardfile DE1 or DE2, or A-C8V4
FAMILY = "Cyclone II"
PART = EP2C8Q208C8
BOARDFILE = A-C8V4Pins
###################################################################
###################################################################
# Setup your sources here
SRCS = vt100.vhd vga-controller.vhd vga_textmode.vhd vga-small.vhd \
font_rom.vhd bootrom.vhd displayram.vhd sram.vhd colour-rom.vhd \
components/T16450.vhd \
components/T80s.vhd components/T80_Pack.vhd components/T80.vhd components/T80_ALU.vhd components/T80_Reg.vhd components/T80_MCode.vhd
OTHER_INPUT = rom1.hex charset.hex vga-rom.hex
%.bin: %.asm
# z80asm -v -l -a $<
pasmo -1 -v $< [email protected]
%.hex: %.bin
trunc $< 4096
bin2hex $< $@
SOF = output_files/$(PROJECT).sof
POF = output_files/$(PROJECT).pof
###################################################################
# Main Targets
#
# all: build everything
# clean: remove output files and database
# program: program your device with the compiled design
###################################################################
all: smart.log $(PROJECT).asm.rpt $(PROJECT).sta.rpt $(SOF)
rom1.bin: rom1.asm
clean:
rm -rf *.rpt *.chg smart.log *.htm *.eqn *.pin *.sof *.pof db incremental_db
map: smart.log $(PROJECT).map.rpt
fit: smart.log $(PROJECT).fit.rpt
asm: smart.log $(PROJECT).asm.rpt
sta: smart.log $(PROJECT).sta.rpt
smart: smart.log
###################################################################
# Executable Configuration
###################################################################
MAP_ARGS = --read_settings_files=on $(addprefix --source=,$(SRCS))
FIT_ARGS = --part=$(PART) --read_settings_files=on
ASM_ARGS =
STA_ARGS =
###################################################################
# Target implementations
###################################################################
STAMP = echo done >
$(PROJECT).map.rpt: map.chg $(SOURCE_FILES)
quartus_map $(MAP_ARGS) $(PROJECT)
$(STAMP) fit.chg
$(PROJECT).fit.rpt: fit.chg $(PROJECT).map.rpt
quartus_fit $(FIT_ARGS) $(PROJECT)
$(STAMP) asm.chg
$(STAMP) sta.chg
$(PROJECT).asm.rpt: asm.chg $(PROJECT).fit.rpt
quartus_asm $(ASM_ARGS) $(PROJECT)
$(PROJECT).sta.rpt: sta.chg $(PROJECT).fit.rpt
quartus_sta $(STA_ARGS) $(PROJECT)
smart.log: $(ASSIGNMENT_FILES)
quartus_sh --determine_smart_action $(PROJECT) > smart.log
###################################################################
# Project initialization
###################################################################
$(ASSIGNMENT_FILES):
quartus_sh --prepare -f $(FAMILY) -t $(TOP_LEVEL_ENTITY) $(PROJECT)
-cat $(BOARDFILE) >> $(PROJECT).qsf
map.chg:
$(STAMP) map.chg
fit.chg:
$(STAMP) fit.chg
sta.chg:
$(STAMP) sta.chg
asm.chg:
$(STAMP) asm.chg
###################################################################
# Programming the device
###################################################################
refresh_memory: $(SOF) $(OTHER_INPUT)
quartus_cdb $(PROJECT) -c $(PROJECT) --update_mif
quartus_asm $(PROJECT)
program: $(SOF) $(OTHER_INPUT)
quartus_pgm --no_banner --mode=jtag -o "P;$(SOF)"
programflash: $(POF) $(OTHER_INPUT)
quartus_pgm --no_banner --mode=as -o "P;$(POF)"