2
0

Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. PROJECT = max80
  2. QU = quartus
  3. .SUFFIXES:
  4. .SECONDARY:
  5. .DELETE_ON_ERROR:
  6. # Common options for all Quartus tools
  7. QPRI = --lower_priority
  8. QCPF = $(QU)_cpf $(QPRI)
  9. QSH = $(QU)_sh $(QPRI)
  10. QSTA = $(QU)_sta $(QPRI)
  11. QPGM = $(QU)_pgm $(QPRI)
  12. # Common options for Quartus in-flow tools
  13. QOPT = --write_settings_files=off $(QPRI)
  14. QMAP = $(QU)_map $(QOPT)
  15. QFIT = $(QU)_fit $(QOPT)
  16. QCDB = $(QU)_cdb $(QOPT)
  17. QASM = $(QU)_asm $(QOPT)
  18. QPOW = $(QU)_pow $(QOPT)
  19. PERL = perl
  20. SRCDIRS = . ip scripts
  21. outdir = output_files
  22. alltarg := sof jic pow.rpt sta.rpt
  23. allout = $(foreach p,$(1),$(foreach o,$(alltarg),$(outdir)/$(p).$(o)))
  24. all: $(call allout,$(PROJECT))
  25. $(outdir)/%.map.rpt: %.qsf
  26. $(QMAP) $*
  27. $(outdir)/%.fit.rpt: $(outdir)/%.map.rpt
  28. $(QFIT) $*
  29. $(outdir)/%.mif_update.rpt: $(outdir)/%.fit.rpt
  30. $(QCDB) --update_mif $*
  31. $(outdir)/%.sof: $(outdir)/%.mif_update.rpt
  32. $(QASM) $*
  33. $(outdir)/%.sta.rpt: $(outdir)/%.fit.rpt | $(outdir)/%.sof
  34. $(QSTA) $*
  35. $(outdir)/%.pow.rpt: $(outdir)/%.sta.rpt
  36. $(QPOW) $*
  37. # XXX: do all .sof -> conversions using quartus_cpf
  38. $(outdir)/%.jic: %jic.cof $(outdir)/%.sof
  39. $(QCPF) --convert $<
  40. # Programming targets. Environment JTAG_CABLE can override the default,
  41. # which is otherwise the first cable found.
  42. rpar := )
  43. JTAG_CABLE ?= $(shell jtagconfig --enum | sed -ne 's/^1$(rpar) //p')
  44. # Transient programming
  45. program:
  46. $(QPGM) -c '$(JTAG_CABLE)' -m JTAG -o 'p;$(outdir)/$(PROJECT).sof'
  47. # Permanent programming in flash
  48. flash:
  49. $(QPGM) -c '$(JTAG_CABLE)' -m JTAG -o 'pvbi;$(outdir)/$(PROJECT).jic'
  50. %.deps: %.qsf scripts/qsfdeps.pl
  51. $(PERL) scripts/qsfdeps.pl $< $* > $@
  52. clean:
  53. rm -rf db incremental_db simulation/modelsim \
  54. greybox_tmp */greybox_tmp \
  55. $(outdir)/*.rpt $(outdir)/*.rpt \
  56. $(outdir)/*.summary $(outdir)/*.smsg \
  57. $(outdir)/*.htm $(outdir)/*.htm_files \
  58. $(outdir)/*.map $(outdir)/*.eqn $(outdir)/*.sld \
  59. $(outdir)/*.done
  60. spotless:
  61. rm -rf $(outdir)
  62. -include $(PROJECT).deps