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