aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/Makefile
blob: c1fc1a42a3d0b8a1956cbd0adfe4ad09aa32fefc (plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Build configuration:

# Target device. May be one of:
#	t13	=> ATTiny13
#	t25	=> ATTiny25
#	t45	=> ATTiny45
#	t85	=> ATTiny85
#	m328p	=> ATMega328P
DEV			:= t85

# Load pulse configuration (all values in milliseconds):

# Minimum length of high-phase:
CONF_HIGH_MIN_MS	:= 4
# Maximum length of high-phase:
CONF_HIGH_MAX_MS	:= 6
# Minimum length of low-phase:
CONF_LOW_MIN_MS		:= 40000
# Maximum length of low-phase:
CONF_LOW_MAX_MS		:= 55000


##############################################################################
##############################################################################
##############################################################################

$(info	DEV=$(DEV) \
	CONF_HIGH_MIN_MS=$(CONF_HIGH_MIN_MS) \
	CONF_HIGH_MAX_MS=$(CONF_HIGH_MAX_MS) \
	CONF_LOW_MIN_MS=$(CONF_LOW_MIN_MS) \
	CONF_LOW_MAX_MS=$(CONF_LOW_MAX_MS))

# Project name
NAME			:= pbwake

# Project source files
SRCS			:= \
			bitops.c \
			load.c \
			main.c \
			shr3.c \
			watchdog.c

GEN_SRCS		:=

# Bootloader source files
BOOT_SRCS		:=
BOOT_GEN_SRCS		:=
BOOT_OFFSET		:=

ifeq ($(DEV),t13)
# ATTiny 13
# 128 kHz, SUT 64 ms, BOD 2.7 V, WDT on, SPIEN
F_CPU			:= 128000UL
LFUSE			:= 0x5B
HFUSE			:= 0xFB
EFUSE			:=
endif

ifeq ($(DEV),t25)
# ATTiny 25
# 128 kHz, SUT 64 ms, BOD 2.7 V, WDT on, SPIEN
F_CPU			:= 128000UL
LFUSE			:= 0xE4
HFUSE			:= 0xCD
EFUSE			:= 0xFF
endif

ifeq ($(DEV),t45)
# ATTiny 45
# 128 kHz, SUT 64 ms, BOD 2.7 V, WDT on, SPIEN
F_CPU			:= 128000UL
LFUSE			:= 0xE4
HFUSE			:= 0xCD
EFUSE			:= 0xFF
endif

ifeq ($(DEV),t85)
# ATTiny 85
# 128 kHz, SUT 64 ms, BOD 2.7 V, WDT on, SPIEN
F_CPU			:= 128000UL
LFUSE			:= 0xE4
HFUSE			:= 0xCD
EFUSE			:= 0xFF
endif

ifeq ($(DEV),m328p)
# ATMega 328P
# 128 kHz, SUT 65 ms, BOD 2.7 V, WDT on, SPIEN
F_CPU			:= 128000UL
LFUSE			:= 0xE3
HFUSE			:= 0xC9
EFUSE			:= 0xFD
endif

# Architecture configuration
GCC_ARCH		:= $(subst m,atmega,$(subst t,attiny,$(DEV)))
AVRDUDE_ARCH		:= $(DEV)
FUNC_STACK_LIMIT	:=

# Programmer selection.
# Values can be:  avrisp2, mysmartusb
PROGRAMMER		:= avrisp2
AVRDUDE_SPEED		:= 50
AVRDUDE_SLOW_SPEED	:= 200

# Instrumentation
INSTRUMENT_FUNC		:=
BOOT_INSTRUMENT_FUNC	:=

# Additional compiler flags
CFLAGS			:= -DCONF_HIGH_MIN_MS="$(CONF_HIGH_MIN_MS)" \
			   -DCONF_HIGH_MAX_MS="$(CONF_HIGH_MAX_MS)" \
			   -DCONF_LOW_MIN_MS="$(CONF_LOW_MIN_MS)" \
			   -DCONF_LOW_MAX_MS="$(CONF_LOW_MAX_MS)"
BOOT_CFLAGS		:= $(CFLAGS)
LDFLAGS			:=

# Additional "clean" and "distclean" target files
CLEAN_FILES		:=
DISTCLEAN_FILES		:=


streq = $(and $(filter 1,$(words $2)),$(filter $1,$(firstword $2)))
deveq = $(call streq,$1,$(DEV))

ifeq ($(strip $(call deveq,t13)\
	      $(call deveq,t25)\
	      $(call deveq,t45)\
	      $(call deveq,t85)\
	      $(call deveq,m328p)),)
$(error "DEV=$(DEV) is not supported.")
endif

include avrmakelib.mk
bues.ch cgit interface