]> cloudbase.mooo.com Git - z180-stamp.git/blame - avr/Makefile
Refactor makefiles
[z180-stamp.git] / avr / Makefile
CommitLineData
8a500c7f
L
1
2
3MCU := atmega1281
4F_CPU := 18432000
5DEBUG := 1
6
7TARGET = stamp-monitor
8
76c082ca 9###############################################################################
8a500c7f
L
10
11SRC := main.c
12SRC += cli.c cli_readline.c command.c command_tbl.c
13SRC += cmd_run.c cmd_boot.c cmd_misc.c cmd_cpu.c
14SRC += cmd_date.c cmd_mem.c cmd_gpio.c cmd_attach.c
15SRC += cmd_loadihex.c cmd_loadcpm3.c cmd_sd.c cmd_fat.c
16SRC += env.c con-utils.c print-utils.c getopt-min.c eval_arg.c
17SRC += timer.c serial.c i2c.c bcd.c pcf8583.c mmc.c strerror.c
18SRC += background.c z180-serv.c z80-if.c gpio.c
76c082ca
L
19
20FATFSDIR := ../fatfs/source
21FATFS := $(FATFSDIR)/ff.c $(FATFSDIR)/ffunicode.c
22ZDIR := ../z180
23SRC_Z := $(ZDIR)/hdrom.c $(ZDIR)/cfboot.c $(ZDIR)/cpuinfo.c
24
25# Sources that may depend on Z180 code:
26Z_DEP := $(shell grep -sl 'include[[:blank:]]\+"$(ZDIR)' $(SRC))
27
8a500c7f
L
28SRC += $(FATFS)
29SRC += $(SRC_Z)
30
31#$(FATFS:%.c=%.o): CFLAGS += -fno-strict-aliasing
32$(SRC_Z:%.c=%.o): CFLAGS += -D'const=const __flash'
33
34
35# Place -D or -U options here
76c082ca 36#CDEFS +=
8a500c7f
L
37
38ifdef DEBUG
39SRC += debug.c
40CDEFS += -DDEBUG=2
41endif
42
43# Place -I options here
44CINCS := -I../include
45
76c082ca
L
46# Extra C flags
47#TGT_CFLAGS += -funsigned-char
48TGT_CFLAGS += -fno-move-loop-invariants
49TGT_CFLAGS += -fno-tree-loop-optimize
50#TGT_CFLAGS += -fno-split-wide-types
51#TGT_CFLAGS += -flto
8a500c7f
L
52
53
76c082ca 54###############################################################################
8a500c7f
L
55# Programming support using avrdude.
56
57AVRDUDE_PROGRAMMER := dragon_isp
76c082ca
L
58# Uncomment, if the programmer is /not/ on USB.
59#AVRDUDE_PORT :=
8a500c7f 60
76c082ca
L
61LFUSE = 0x97
62HFUSE = 0xD6
63EFUSE = 0xF5
64
65# Fuse low byte:
66# 0x97 = 1 0 0 1 0 1 1 1
67# ^ ^ \ / \--+--/
68# | | | +------- CKSEL 3..0 (Low Power Crystal)
69# | | +--------------- SUT 1..0 (Crystal Osc, slowly rising power)
70# | +------------------ CKOUT (Clock output enabled)
71# +-------------------- CKDIV8 (don't divide clock by 8)
72# Fuse high byte:
73# 0xd6 = 1 1 0 1 0 1 1 0
74# ^ ^ ^ ^ ^ \+/ ^---- BOOTRST (Boot Reset vector Enabled 0x3c00)
75# | | | | | +------- BOOTSZ 1..0 (Boot Flash section size 512 words)
76# | | | | + --------- EESAVE (Preserve EEPROM over chip erase)
77# | | | +-------------- WDTON (WDT not always on)
78# | | +---------------- SPIEN (allow serial programming)
79# | +------------------ JTAGEN (JTAG disabled)
80# +-------------------- OCDEN (OCD disabled)
81# Fuse Extended byte:
82# 0xf5 = 1 1 1 1 0 1 0 1
83# \-+-/
84# +------ Bodlevel (VCC = 2.7V)
8a500c7f
L
85
86# Uncomment the following if you do /not/ wish a verification to be
87# performed after programming the device.
88#AVRDUDE_NO_VERIFY = -V
89
90# Increase verbosity level. Please use this when submitting bug
91# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
92# to submit bug reports.
93#AVRDUDE_VERBOSE = -v -v
94
76c082ca
L
95###############################################################################
96#.SECONDEXPANSION:
8a500c7f
L
97
98.PHONY: all build
99# Default target.
100all: build
101
76c082ca
L
102build: hex lss
103
104clean: clean_z
105$(Z_DEP:%.c=%.o): $(SRC_Z)
106
107$(SRC_Z):
108 $(MAKE) -C $(ZDIR) $(@F)
109
110.PHONY: clean_z
111clean_z:
112 $(MAKE) -C $(ZDIR) clean
8a500c7f
L
113
114include ../mk/avr.rules.mk