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.

device_test.mk 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. elf = $(test).elf
  2. map = $(test).map
  3. ALT_LIBRARY_ROOT_DIR := $(bsp_root_dir)
  4. ABS_BSP_ROOT_DIR := $(shell realpath $(bsp_root_dir))
  5. BSP_INCLUDE_FILE := $(bsp_root_dir)/public.mk
  6. include $(BSP_INCLUDE_FILE)
  7. libbsp = $(bsp_root_dir)/${BSP_LIB}
  8. cross_compile := nios2-elf-
  9. ECHO = echo
  10. LD := $(cross_compile)g++
  11. CC := $(cross_compile)gcc
  12. CXX := $(cross_compile)g++
  13. ldflags += -T$(BSP_LINKER_SCRIPT)
  14. ldflags += -msys-crt0=$(BSP_CRT0)
  15. ldflags += -msys-lib=$(BSP_SYS_LIB)
  16. ldflags += $(addprefix -L,$(ALT_LIBRARY_DIRS))
  17. ldflags += -O2
  18. ldflags += -Wall
  19. ldflags += $(ALT_CFLAGS)
  20. cflags += -O2
  21. cflags += -Wall
  22. cflags += $(ALT_CFLAGS)
  23. include_dirs += $(addprefix -I, $(ALT_INCLUDE_DIRS))
  24. c_objects = $(patsubst %.c,%.o, ${c_sources})
  25. cc_objects = $(patsubst %.cc,%.oo, $(cc_sources))
  26. objects = ${c_objects} ${cc_objects}
  27. execute_on_device_and_read_output = ${scripts}/execute_on_device_and_read_output.sh
  28. check_test_results = ${scripts}/check_test_results.sh
  29. execute_and_highlight = ${scripts}/execute_and_highlight.sh
  30. device_output=device.out
  31. artifacts += ${device_output}
  32. .PHONY: all
  33. all: test remove_device_output
  34. .PHONY: remove_device_output
  35. remove_device_output:
  36. @${RM} -rf ${device_output}
  37. ifdef plot_data
  38. .PHONY: _plot
  39. _plot: ${plot_data} remove_device_output
  40. ${plot_data}: ${device_output}
  41. @cat $< | ${extract_python_data} > $@
  42. endif
  43. .PHONY: test
  44. test: ${device_output}
  45. @$(ECHO) Checking test results
  46. @${check_test_results} $<
  47. ${device_output}: ${elf} ${execute_on_device_and_read_output}
  48. @$(ECHO) Executing $<
  49. @${execute_and_highlight} ${execute_on_device_and_read_output} ${elf} ${device_output}
  50. ${elf}: ${objects} ${linker_script} ${libbsp}
  51. @$(ECHO) Linking $@
  52. @${LD} ${ldflags} ${objects} -o $@
  53. %.oo:%.cc
  54. @$(ECHO) Compiling $<
  55. @${CXX} --std=c++14 ${include_dirs} -c $< -o $@
  56. %.o:%.c
  57. @$(ECHO) Compiling $<
  58. @${CC} $(cflags) ${include_dirs} -c $< -o $@
  59. ${libbsp}:
  60. @$(ECHO) Building $(bsp_root_dir)
  61. @$(MAKE) --no-print-directory -C $(bsp_root_dir)
  62. .PHONY: clean
  63. clean:
  64. @$(ECHO) Cleaning test
  65. @${RM} -rf ${objects} ${elf} ${artifacts}
  66. .PHONY: download
  67. download: $(elf)
  68. @nios2-download -r -g $(elf)