Studentenversion des ESY6/A Praktikums "signal_processing".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # Check for the required nios2-download command
  2. # The command is only available in nios2_command_shell
  3. ifeq (, $(shell which nios2-download))
  4. $(error "This makefile must be executed within the nios2_command_shell")
  5. endif
  6. uname = $(shell uname -r)
  7. ifneq (,$(findstring Microsoft,${uname}))
  8. exe_suffix=.exe
  9. endif
  10. # Programm pathes
  11. quartus_root ?= ${QUARTUS_ROOTDIR}
  12. intel_root ?= $(quartus_root)/..
  13. sopc_root = $(quartus_root)/sopc_builder
  14. # Tools
  15. qsys_generate = $(sopc_root)/bin/qsys-generate$(exe_suffix)
  16. niosii_bsp = $(intel_root)/nios2eds/sdk2/bin/nios2-bsp
  17. quartus_map = quartus_map$(exe_suffix)
  18. quartus_fit = quartus_fit$(exe_suffix)
  19. quartus_asm = quartus_asm$(exe_suffix)
  20. quartus_sta = quartus_sta$(exe_suffix)
  21. nios2_bsp_generate_files = nios2-bsp-generate-files$(exe_suffix)
  22. quartus_pgm = quartus_pgm$(exe_suffix)
  23. nios2_download = nios2-download$(exe_suffix)
  24. nios2_terminal = nios2-terminal$(exe_suffix)
  25. # Directories
  26. niosii_dir = niosII
  27. bsp_dir = software/signal_processing_bsp
  28. app_dir = software/signal_processing
  29. hw_test_dir = tests/hardware
  30. sw_test_dir = tests/software
  31. # Settings
  32. quartus_project = signal_processing
  33. signal_processing_qsf = signal_processing.qsf
  34. # Sources
  35. niosii_qsys = niosII.qsys
  36. # Targets
  37. niosii_qip = $(niosii_dir)/synthesis/niosII.qip
  38. niosii_info = niosII.sopcinfo
  39. bsp_settings = $(bsp_dir)/settings.bsp
  40. bsp_makefile = $(bsp_dir)/Makefile
  41. # VHDL source files
  42. hdl_src += \
  43. hardware/system/sync_ff.vhd \
  44. hardware/system/sync_rst.vhd \
  45. hardware/system/pll/pll_main.vhd \
  46. hardware/system/reg32.vhd \
  47. hardware/system/avalon_slave_transitions.vhd \
  48. hardware/system/avalon_slave.vhd \
  49. hardware/system/data_sink_mux.vhd \
  50. hardware/system/fifo.vhd \
  51. hardware/system/data_source_mux.vhd \
  52. hardware/system/data_channel_control.vhd \
  53. hardware/system/data_channel.vhd \
  54. hardware/system/hardware_timestamp.vhd \
  55. hardware/system/task.vhd \
  56. hardware/system/float.vhd \
  57. hardware/system/hardware_task_control.vhd \
  58. hardware/system/hardware_task.vhd \
  59. hardware/system/float_add.vhd \
  60. hardware/signal_processing/add.vhd \
  61. hardware/system/task_add.vhd \
  62. hardware/signal_processing/rand.vhd \
  63. hardware/system/task_rand.vhd \
  64. hardware/system/cordic_pkg.vhd \
  65. hardware/system/cordic.vhd \
  66. hardware/system/fixed_sine.vhd \
  67. hardware/system/float_sine.vhd \
  68. hardware/signal_processing/sine.vhd \
  69. hardware/system/task_sine.vhd \
  70. hardware/system/Butterfly.v \
  71. hardware/system/DelayBuffer.v \
  72. hardware/system/FFT1024_32B.v \
  73. hardware/system/Multiply.v \
  74. hardware/system/SdfUnit2.v \
  75. hardware/system/SdfUnit.v \
  76. hardware/system/Twiddle1024_32B.v \
  77. hardware/system/squareRoot_pipe.vhd \
  78. hardware/system/fft_magnitude_calc.vhd \
  79. hardware/signal_processing/fft.vhd \
  80. hardware/system/task_fft.vhd \
  81. hardware/signal_processing/crc.vhd \
  82. hardware/system/task_crc.vhd \
  83. hardware/signal_processing/signal_processing.vhd \
  84. #
  85. clean_items += \
  86. $(niosii_dir) \
  87. $(niosii_info) \
  88. .map \
  89. .fitter \
  90. .assembler \
  91. .sta \
  92. .qsys_edit/ \
  93. db/ \
  94. incremental_db/ \
  95. output_files/ \
  96. .PHONY: all \
  97. niosII \
  98. fpga \
  99. program \
  100. clean \
  101. app \
  102. download \
  103. run \
  104. tests \
  105. all: run
  106. #------------------------------------------------------------------------------
  107. # Create the NiosII system from the description file
  108. niosII: $(niosii_info)
  109. # Create the NiosII sources from the description file
  110. $(niosii_qip): $(niosii_qsys)
  111. @echo Generating the NiosII system from $< ...
  112. @$(qsys_generate) -syn=VHDL $<
  113. # The NiosII system information file is created in parallel to the .qip file.
  114. $(niosii_info): $(niosii_qip)
  115. #------------------------------------------------------------------------------
  116. # Quartus FPGA toolchain contains the mapper, fitter, assembler and static
  117. # timing analysis (sta).
  118. #
  119. fpga: .sta
  120. # Anaylze and synthesis of the QuartusII project
  121. .map: $(hdl_src) $(niosii_info) $(signal_processing_qsf)
  122. @rm -f $@
  123. @$(quartus_map) --read_settings_files=on --write_settings_files=off $(quartus_project) -c $(quartus_project) && date > $@
  124. # Run the quartus fitter on the project
  125. .fitter: .map $(sdc_src) $(signal_processing_qsf)
  126. @rm -f $@
  127. @$(quartus_fit) --read_settings_files=on --write_settings_files=off $(quartus_project) -c $(quartus_project) && date > $@
  128. .assembler: .fitter
  129. @rm -f $@
  130. @$(quartus_asm) --read_settings_files=off --write_settings_files=off $(quartus_project) -c $(quartus_project)&& date > $@
  131. .sta: .assembler
  132. @rm -f $@
  133. @$(quartus_sta) $(quartus_project) -c $(quartus_project) && date > $@
  134. output_files/signal_processing_time_limited.sof: .sta
  135. # Create the BSP from the sopc description
  136. bsp: ${bsp_makefile}
  137. $(bsp_settings): $(niosii_info)
  138. @echo Generating the NiosII BSP from $< ...
  139. @$(niosii_bsp) hal $(bsp_dir) $<
  140. $(bsp_makefile): $(bsp_settings)
  141. @$(nios2_bsp_generate_files) --settings software/signal_processing_bsp/settings.bsp --bsp-dir software/signal_processing_bsp/
  142. app: $(bsp_makefile)
  143. ${MAKE} -C $(app_dir)
  144. # Programme the FPGA design
  145. program: output_files/signal_processing_time_limited.sof
  146. @$(quartus_pgm) signal_processing.cdf
  147. # Programme the NiosII software design
  148. download: app
  149. @$(nios2-download) $(app_dir)/signal_processing.elf -g
  150. # Programme the NiosII software design
  151. run: fpga download
  152. @$(nios2-terminal)
  153. sw_tests:
  154. @${MAKE} -C tests/software
  155. hw_tests:
  156. @${MAKE} -C tests/hardware
  157. device_tests:
  158. @${MAKE} -C tests/device
  159. tests: sw_tests hw_tests device_tests
  160. clean:
  161. @rm -rf $(clean_items)
  162. @${MAKE} -C ${hw_test_dir} clean
  163. @${MAKE} -C ${sw_test_dir} clean
  164. @${MAKE} -C ${app_dir} clean
  165. @${MAKE} -C ${bsp_dir} clean