]>
Commit | Line | Data |
---|---|---|
81dcfdfd | 1 | PWD := $(shell pwd) |
2 | ||
3 | #auto|lpt1|lpt2|lpt3|com1|com2|com3|com4|usb0|usb1|usb2|usb21|ttya|ttyb|tty00|tty01 | |
4 | CABLE ?= auto | |
5 | ||
bd0f9a9a | 6 | #DRIVER = /home/michael/Raggedstone/usb-driver/libusb-driver.so |
7 | ||
81dcfdfd | 8 | INTSTYLE := silent |
9 | ||
f5e6af20 | 10 | SOURCES := $(shell find . -wholename './tmp' -prune -o -name "*.vhd" -print) $(shell find . -wholename './tmp' -prune -o -name "*.v" -print) |
f026519d | 11 | PART ?= xc3s1500-fg456-4 |
12 | TARGET ?= bit | |
e5c60270 | 13 | CLEANFILES ?= |
81dcfdfd | 14 | |
bd0f9a9a | 15 | ifdef DRIVER |
16 | PRELOAD = LD_PRELOAD=$(DRIVER) | |
17 | endif | |
18 | ||
f026519d | 19 | all: $(PROJECT).$(TARGET) final |
81dcfdfd | 20 | |
21 | log: | |
22 | time make all &>build.log | |
23 | ||
24 | xst: $(PROJECT).ngc | |
25 | ||
26 | ngdbuild: $(PROJECT).ngd | |
27 | ||
f026519d | 28 | $(PROJECT).ngc: $(SOURCES) $(PROJECT).prj $(PROJECT).ucf $(PROJECT).xst |
81dcfdfd | 29 | @# echo synclib > $(PROJECT).lso # hmm. things are different in ise 9.1 |
30 | echo work > $(PROJECT).lso | |
31 | xst -intstyle $(INTSTYLE) -ifn $(PROJECT).xst -ofn $(PROJECT).syr | |
6e019098 | 32 | @touch $(PROJECT).ngc |
81dcfdfd | 33 | @#cat $(PROJECT).syr |
34 | ||
35 | $(PROJECT).ngd: $(PROJECT).ngc | |
f026519d | 36 | ngdbuild -intstyle $(INTSTYLE) -dd "$(PWD)/_ngo" -nt timestamp -uc $(PROJECT).ucf -p $(PART) $(PROJECT).ngc $(PROJECT).ngd |
81dcfdfd | 37 | |
38 | $(PROJECT)_map.ngm $(PROJECT).pcf: $(PROJECT).ngd | |
f026519d | 39 | map -intstyle $(INTSTYLE) -p $(PART) -cm area -pr b -k 4 -c 100 -o $(PROJECT)_map.ncd $(PROJECT).ngd $(PROJECT).pcf |
81dcfdfd | 40 | |
41 | $(PROJECT).ncd: $(PROJECT)_map.ngm $(PROJECT).pcf | |
42 | @#par -w -intstyle $(INTSTYLE) -ol std -n 4 -t 1 $(PROJECT)_map.ncd $(PROJECT).dir $(PROJECT).pcf | |
43 | par -w -intstyle $(INTSTYLE) -ol std -t 1 $(PROJECT)_map.ncd $(PROJECT).ncd $(PROJECT).pcf | |
44 | ||
45 | $(PROJECT).twx: $(PROJECT).ncd | |
46 | trce -intstyle $(INTSTYLE) -e 3 -l 3 -s 4 -xml $(PROJECT) $(PROJECT).ncd -o $(PROJECT).twr $(PROJECT).pcf | |
47 | @#cat $(PROJECT).twr | |
48 | ||
49 | $(PROJECT).bit: $(PROJECT).ncd | |
50 | bitgen -intstyle $(INTSTYLE) -f $(PROJECT).ut $(PROJECT).ncd | |
51 | @# cp $(PROJECT).bit ../jcarr_last.bit | |
52 | @#cat $(PROJECT).drc | |
53 | @#cat $(PROJECT).bgn | |
54 | ||
f026519d | 55 | $(PROJECT).vm6: $(PROJECT).ngd |
56 | cpldfit -intstyle $(INTSTYLE) -p $(PART) -ofmt vhdl -optimize speed -loc on -slew fast -init low -inputs 54 -pterms 25 -unused float -power std -terminate keeper $(PROJECT).ngd | |
57 | ||
58 | $(PROJECT).jed: $(PROJECT).vm6 | |
59 | hprep6 -intstyle $(INTSTYLE) -s IEEE1149 -n $(PROJECT) -i $(PROJECT) | |
60 | ||
81dcfdfd | 61 | $(PROJECT)-xcf02s.mcs $(PROJECT)-xcf04s.mcs: $(PROJECT).bit |
62 | promgen -intstyle $(INTSTYLE) -w -p mcs -u 0 $(PROJECT) -o $(PROJECT)-xcf02s $(PROJECT)-xcf04s -x xcf02s xcf04s | |
63 | ||
64 | final: | |
65 | -@grep -A 8 -B 1 ^Selected\ Device $(PROJECT).syr | |
66 | -@grep -A 8 -B 1 ^Timing\ Summary $(PROJECT).syr | |
67 | -@grep -A 21 -B 1 ^Design\ Summary $(PROJECT)_map.map | |
68 | ||
69 | burn: $(PROJECT).bit | |
70 | xc3sprog $(PROJECT).bit | |
71 | ||
72 | load: $(PROJECT).bit | |
b983c58b | 73 | @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xc3s1500.batch >xc3s1500.batch.tmp |
bd0f9a9a | 74 | $(PRELOAD) impact -batch xc3s1500.batch.tmp |
81dcfdfd | 75 | @rm xc3s1500.batch.tmp |
76 | ||
27e073b6 | 77 | flash: |
78 | @echo "NO" | |
79 | ||
80 | i-really-want-to-flash: $(PROJECT)-xcf02s.mcs $(PROJECT)-xcf04s.mcs | |
b983c58b | 81 | @sed -e "s|%CABLE%|$(CABLE)|g" -e "s|%PROJECT%|$(PROJECT)|g" ../common/xcf.batch >xcf.batch.tmp |
bd0f9a9a | 82 | $(PRELOAD) impact -batch xcf.batch.tmp |
81dcfdfd | 83 | @rm xcf.batch.tmp |
84 | ||
8f897de7 | 85 | analyzer: |
86 | $(CHIPSCOPE)/bin/lin/analyzer.sh -project $(PWD)/$(PROJECT).cpj | |
87 | ||
81dcfdfd | 88 | clean: |
70bd1927 | 89 | @rm -rf *.bit *.bgn *.mcs *.prm *.bld *.drc *.mcs *.ncd *.ngc *.ngd *.edn *.ncf *.ngo *.cdc \ |
81dcfdfd | 90 | *.ngr *.pad *.par *.pcf *.prm *.syr *.twr *.twx *.xpi *.lso *.prm *.mcs _impact* \ |
e5c60270 | 91 | *.vm6 *.jed *.gyd *.mfd *.pnx *.rpt *.err *.log \ |
81dcfdfd | 92 | $(PROJECT)_map.* $(PROJECT)_pad.* \ |
93 | _ngo xst \ | |
94 | build.log \ | |
e5c60270 | 95 | $(PROJECT).unroutes *.xml $(CLEANFILES) |
81dcfdfd | 96 | |
27e073b6 | 97 | .PHONY: all final burn load flash clean xst ngdbuild log analyzer i-really-want-to-flash |