blob: d6c2e0f5cd1d201e93d58a8d9586ad0dff1aa6d5 (
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
|
MCU := atmega1281
F_CPU := 18432000
DEBUG := 1
TARGET = stamp-monitor
###############################################################################
SRC := main.c
SRC += cli.c cli_readline.c command.c command_tbl.c
SRC += cmd_run.c cmd_boot.c cmd_misc.c cmd_cpu.c
SRC += cmd_date.c cmd_mem.c cmd_gpio.c cmd_attach.c
SRC += cmd_loadihex.c cmd_loadcpm3.c cmd_sd.c cmd_fat.c
SRC += env.c con-utils.c print-utils.c getopt-min.c eval_arg.c
SRC += timer.c serial.c i2c.c bcd.c pcf8583.c mmc.c strerror.c
SRC += background.c z180-serv.c z80-if.c gpio.c disas_z180.c
FATFSDIR := ../fatfs/source
FATFS := $(FATFSDIR)/ff.c $(FATFSDIR)/ffunicode.c
ZDIR := ../z180
SRC_Z := $(ZDIR)/hdrom.c $(ZDIR)/cfboot.c $(ZDIR)/cpuinfo.c
# Sources that may depend on Z180 code:
Z_DEP := $(shell grep -sl 'include[[:blank:]]\+"$(ZDIR)' $(SRC))
SRC += $(FATFS)
SRC += $(SRC_Z)
#$(FATFS:%.c=%.o): CFLAGS += -fno-strict-aliasing
$(SRC_Z:%.c=%.o): CFLAGS += -D'const=const __flash'
# Place -D or -U options here
#CDEFS +=
ifdef DEBUG
SRC += debug.c
CDEFS += -DDEBUG=2
endif
# Place -I options here
CINCS := -I../include
# Extra C flags
#TGT_CFLAGS += -funsigned-char
TGT_CFLAGS += -fno-move-loop-invariants
TGT_CFLAGS += -fno-tree-loop-optimize
#TGT_CFLAGS += -fno-split-wide-types
#TGT_CFLAGS += -flto
###############################################################################
# Programming support using avrdude.
AVRDUDE_PROGRAMMER := dragon_isp
# Uncomment, if the programmer is /not/ on USB.
#AVRDUDE_PORT :=
LFUSE = 0x97
HFUSE = 0xD6
EFUSE = 0xF5
# Fuse low byte:
# 0x97 = 1 0 0 1 0 1 1 1
# ^ ^ \ / \--+--/
# | | | +------- CKSEL 3..0 (Low Power Crystal)
# | | +--------------- SUT 1..0 (Crystal Osc, slowly rising power)
# | +------------------ CKOUT (Clock output enabled)
# +-------------------- CKDIV8 (don't divide clock by 8)
# Fuse high byte:
# 0xd6 = 1 1 0 1 0 1 1 0
# ^ ^ ^ ^ ^ \+/ ^---- BOOTRST (Boot Reset vector Enabled 0x3c00)
# | | | | | +------- BOOTSZ 1..0 (Boot Flash section size 512 words)
# | | | | + --------- EESAVE (Preserve EEPROM over chip erase)
# | | | +-------------- WDTON (WDT not always on)
# | | +---------------- SPIEN (allow serial programming)
# | +------------------ JTAGEN (JTAG disabled)
# +-------------------- OCDEN (OCD disabled)
# Fuse Extended byte:
# 0xf5 = 1 1 1 1 0 1 0 1
# \-+-/
# +------ Bodlevel (VCC = 2.7V)
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
###############################################################################
#.SECONDEXPANSION:
.PHONY: all build
# Default target.
all: build
build: hex lss
clean: clean_z
$(Z_DEP:%.c=%.o): $(SRC_Z)
$(SRC_Z):
$(MAKE) -C $(ZDIR) $(@F)
.PHONY: clean_z
clean_z:
$(MAKE) -C $(ZDIR) clean
include ../mk/avr.rules.mk
|