2
0

Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 ../fw/testdata.hex
  39. $(QCPF) --convert $<
  40. # Clean out SignalTap
  41. signalclean:
  42. $(PERL) -ne 'print unless (/(SIGNALTAP_FILE\b|\bENABLE_SIGNALTAP\b|\bSLD_FILE\b|SLD_NODE_)/);' < max80.qsf > max80.qsf.tmp
  43. mv -f max80.qsf.tmp max80.qsf
  44. # Programming targets. Environment JTAG_CABLE can override the default,
  45. # which is otherwise the first cable found.
  46. rpar := )
  47. JTAG_CABLE ?= $(shell jtagconfig --enum | sed -ne 's/^1$(rpar) //p')
  48. # Transient programming
  49. program:
  50. $(QPGM) -c '$(JTAG_CABLE)' -m JTAG -o 'p;$(outdir)/$(PROJECT).sof'
  51. # Permanent programming in flash
  52. flash:
  53. $(QPGM) -c '$(JTAG_CABLE)' -m JTAG -o 'pvbi;$(outdir)/$(PROJECT).jic'
  54. %.deps: %.qsf scripts/qsfdeps.pl
  55. $(PERL) scripts/qsfdeps.pl $< $* > $@
  56. clean:
  57. rm -rf db incremental_db simulation/modelsim \
  58. greybox_tmp */greybox_tmp \
  59. $(outdir)/*.rpt $(outdir)/*.rpt \
  60. $(outdir)/*.summary $(outdir)/*.smsg \
  61. $(outdir)/*.htm $(outdir)/*.htm_files \
  62. $(outdir)/*.map $(outdir)/*.eqn $(outdir)/*.sld \
  63. $(outdir)/*.done
  64. spotless:
  65. rm -rf $(outdir)
  66. -include $(PROJECT).deps