]> cloudbase.mooo.com Git - z180-stamp.git/blob - avr/Makefile
Adaptions for fatfs R0.15
[z180-stamp.git] / avr / Makefile
1
2
3 MCU := atmega1281
4 F_CPU := 18432000
5 DEBUG := 1
6
7 TARGET = stamp-monitor
8
9 ###############################################################################
10
11 SRC := main.c
12 SRC += cli.c cli_readline.c command.c command_tbl.c
13 SRC += cmd_run.c cmd_boot.c cmd_misc.c cmd_cpu.c
14 SRC += cmd_date.c cmd_mem.c cmd_gpio.c cmd_attach.c
15 SRC += cmd_loadihex.c cmd_loadcpm3.c cmd_sd.c cmd_fat.c
16 SRC += env.c con-utils.c print-utils.c getopt-min.c eval_arg.c
17 SRC += timer.c serial.c i2c.c bcd.c pcf8583.c mmc.c strerror.c
18 SRC += background.c z180-serv.c z80-if.c gpio.c
19
20 FATFSDIR := ../fatfs/source
21 FATFS := $(FATFSDIR)/ff.c $(FATFSDIR)/ffunicode.c
22 ZDIR := ../z180
23 SRC_Z := $(ZDIR)/hdrom.c $(ZDIR)/cfboot.c $(ZDIR)/cpuinfo.c
24
25 # Sources that may depend on Z180 code:
26 Z_DEP := $(shell grep -sl 'include[[:blank:]]\+"$(ZDIR)' $(SRC))
27
28 SRC += $(FATFS)
29 SRC += $(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
36 #CDEFS +=
37
38 ifdef DEBUG
39 SRC += debug.c
40 CDEFS += -DDEBUG=2
41 endif
42
43 # Place -I options here
44 CINCS := -I../include
45
46 # Extra C flags
47 #TGT_CFLAGS += -funsigned-char
48 TGT_CFLAGS += -fno-move-loop-invariants
49 TGT_CFLAGS += -fno-tree-loop-optimize
50 #TGT_CFLAGS += -fno-split-wide-types
51 #TGT_CFLAGS += -flto
52
53
54 ###############################################################################
55 # Programming support using avrdude.
56
57 AVRDUDE_PROGRAMMER := dragon_isp
58 # Uncomment, if the programmer is /not/ on USB.
59 #AVRDUDE_PORT :=
60
61 LFUSE = 0x97
62 HFUSE = 0xD6
63 EFUSE = 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)
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
95 ###############################################################################
96 #.SECONDEXPANSION:
97
98 .PHONY: all build
99 # Default target.
100 all: build
101
102 build: hex lss
103
104 clean: clean_z
105 $(Z_DEP:%.c=%.o): $(SRC_Z)
106
107 $(SRC_Z):
108 $(MAKE) -C $(ZDIR) $(@F)
109
110 .PHONY: clean_z
111 clean_z:
112 $(MAKE) -C $(ZDIR) clean
113
114 include ../mk/avr.rules.mk