blob: 677053acce6d52a249d0b3332576fcd863ddcbc3 (
about) (
plain)
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
|
include Makefile.config
include Makefile.util
# Short C programs
TOOLS := VGAdump2ppm
TEST_TARGETS := $(addprefix test_,$(shell ls tests))
TOOLS_TARGETS := $(addprefix tools/,$(TOOLS))
GENERATED_MEM_FILES := $(shell find design/ -name "*.s.tcl")
GENERATED_MEM_FILES := $(basename $(basename $(GENERATED_MEM_FILES)))
GENERATED_MEM_FILES := $(addsuffix .mem,$(GENERATED_MEM_FILES))
all : design.bin
design.v : design/rom.mem design/*.v
$(IV) -E $(filter %.v,$^) -DROM_WORDS_COUNT=$(call FILE_LINES,$<) -o $@
design.json : design.v design/rom.mem design/font.mem
$(YOSYS) -p 'read_verilog -defer $<' \
-p 'synth_ice40 -top $(TOPMODULE) -json $@'
design.asc : design.json $(PCF)
$(PNR) --hx8k --asc $@ --pcf $(PCF) --json $< --package ct256
design.bin : design.asc
$(ICEPACK) $< $@
timing.rpt : design.asc
$(ICETIME) -d hx8k -mtr $@ $<
prog : design.bin
sudo iceprogduino $<
CALL_TESTS = \
cd tests/; \
for TEST in *; do \
echo "** $$TEST "; \
if ! $(MAKE) -C $$TEST $(1) 3>&1 1>/dev/null 2>&3; then \
FAIL=true; \
fi; \
done; \
[ "$$FAIL" != true ]
test :
$(call CALL_TESTS)
# Will skip VGA tests, because they take loooong time
quicktest :
$(call CALL_TESTS,QUICK_TEST=1)
$(TEST_TARGETS) : test_% :
$(MAKE) -C tests/$*
tools : $(TOOLS_TARGETS)
$(TOOLS_TARGETS) : tools/% : tools/%.c
$(CC) $(CFLAGS) $^ -o $@
clean :
for TEST in tests/*; do $(MAKE) -C $$TEST clean >/dev/null; done
rm $(GENERATED_MEM_FILES) $(TOOLS_TARGETS) 2>/dev/null || true
rm $(addprefix design.,v json asc bin) timing.rpt 2>/dev/null || true
.PHONY : all tools test quicktest $(TEST_TARGETS)
|