Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Target device.
  2. # May be one of: m88, m88p, m328p
  3. DEV := m88p
  4. # Target hardware.
  5. # May be one of: legacy, smd
  6. HW := smd
  7. streq = $(and $(filter 1,$(words $2)),$(filter $1,$(firstword $2)))
  8. deveq = $(call streq,$1,$(DEV))
  9. hweq = $(call streq,$1,$(HW))
  10. ifeq ($(strip $(call deveq,m88)$(call deveq,m88p)$(call deveq,m328p)),)
  11. $(error "$$DEV:=$(DEV) is not supported")
  12. endif
  13. ifeq ($(strip $(call hweq,legacy)$(call hweq,smd)),)
  14. $(error "$$HW:=$(HW) is not supported")
  15. endif
  16. # Build configuration
  17. CONF_DEBUG := $(if $(call deveq,m328p),1,0)
  18. CONF_BOOST := 0
  19. CONF_IDLE := 1
  20. CONF_IDLETOGGLE := $(if $(call hweq,legacy),1,0)
  21. CONF_PRESETS := 1
  22. CONF_EERING := 1
  23. CONF_ADJ := 1
  24. CONF_KCONF := $(if $(call deveq,m328p),1,0)
  25. CONF_CURRCUTOFFHYST := 0.1
  26. CONF_CURRCUTOFF := 1.8
  27. # Project name
  28. NAME := xytronic-lf
  29. # Project source files
  30. SRCS := bitmap.c \
  31. buttons.c \
  32. controller_current.c \
  33. controller_temp.c \
  34. $(if $(call streq,1,$(CONF_DEBUG)),debug_uart.c) \
  35. display.c \
  36. filter.c \
  37. fixpt.c \
  38. main.c \
  39. measure.c \
  40. measure_current.c \
  41. measure_temp.c \
  42. menu.c \
  43. pid.c \
  44. presets.c \
  45. pwm_current.c \
  46. ring.c \
  47. settings.c \
  48. scale.c \
  49. sseg.c \
  50. timer.c \
  51. util.c
  52. GEN_SRCS :=
  53. # Bootloader source files
  54. BOOT_SRCS :=
  55. BOOT_GEN_SRCS :=
  56. BOOT_OFFSET :=
  57. # Project fuse bits
  58. # 8 MHz, BOD 2.7 V, WDT on
  59. M88_LFUSE := 0xE2
  60. M88_HFUSE := 0xCD
  61. M88_EFUSE := 0xF9
  62. M88P_LFUSE := 0xE2
  63. M88P_HFUSE := 0xCD
  64. M88P_EFUSE := 0xF9
  65. M328P_LFUSE := 0xE2
  66. M328P_HFUSE := 0xC9
  67. M328P_EFUSE := 0xFD
  68. ifeq ($(DEV),m88)
  69. LFUSE := $(M88_LFUSE)
  70. HFUSE := $(M88_HFUSE)
  71. EFUSE := $(M88_EFUSE)
  72. endif
  73. ifeq ($(DEV),m88p)
  74. LFUSE := $(M88P_LFUSE)
  75. HFUSE := $(M88P_HFUSE)
  76. EFUSE := $(M88P_EFUSE)
  77. endif
  78. ifeq ($(DEV),m328p)
  79. LFUSE := $(M328P_LFUSE)
  80. HFUSE := $(M328P_HFUSE)
  81. EFUSE := $(M328P_EFUSE)
  82. endif
  83. # CPU speed, in Hz
  84. F_CPU := 8000000UL
  85. # Architecture configuration
  86. GCC_ARCH := $(patsubst m%,atmega%,$(DEV))
  87. AVRDUDE_ARCH := $(DEV)
  88. FUNC_STACK_LIMIT :=
  89. # Programmer selection.
  90. # Values can be: avrisp2, mysmartusb
  91. PROGRAMMER := avrisp2
  92. # Instrumentation
  93. INSTRUMENT_FUNC :=
  94. BOOT_INSTRUMENT_FUNC :=
  95. # Additional compiler flags
  96. CFLAGS := $(if $(call hweq,legacy),-DHW_LEGACY) \
  97. $(if $(call hweq,smd),-DHW_SMD) \
  98. -DCONF_DEBUG=$(CONF_DEBUG) \
  99. -DCONF_BOOST=$(CONF_BOOST) \
  100. -DCONF_IDLE=$(CONF_IDLE) \
  101. -DCONF_IDLETOGGLE=$(CONF_IDLETOGGLE) \
  102. -DCONF_PRESETS=$(CONF_PRESETS) \
  103. -DCONF_EERING=$(CONF_EERING) \
  104. -DCONF_ADJ=$(CONF_ADJ) \
  105. -DCONF_KCONF=$(CONF_KCONF) \
  106. -DCONF_CURRCUTOFF=$(CONF_CURRCUTOFF) \
  107. -DCONF_CURRCUTOFFHYST=$(CONF_CURRCUTOFFHYST)
  108. LDFLAGS :=
  109. # Additional "clean" and "distclean" target files
  110. CLEAN_FILES :=
  111. DISTCLEAN_FILES :=
  112. include avrmakelib.mk
  113. tests: all
  114. $(MAKE) -C tests clean
  115. $(MAKE) -C tests all
  116. .PHONY: tests