]> cloudbase.mooo.com Git - z180-stamp.git/blame - avr/Makefile
Add makefiles (replace Tup)
[z180-stamp.git] / avr / Makefile
CommitLineData
8a500c7f
L
1
2
3MCU := atmega1281
4F_CPU := 18432000
5DEBUG := 1
6
7TARGET = stamp-monitor
8
9FATFSDIR := ../fatfs/source
10FATFS := $(FATFSDIR)/ff.c $(FATFSDIR)/ffunicode.c
11
12SRC_Z := ../z180/hdrom.c ../z180/cfboot.c ../z180/cpuinfo.c
13
14SRC := main.c
15SRC += cli.c cli_readline.c command.c command_tbl.c
16SRC += cmd_run.c cmd_boot.c cmd_misc.c cmd_cpu.c
17SRC += cmd_date.c cmd_mem.c cmd_gpio.c cmd_attach.c
18SRC += cmd_loadihex.c cmd_loadcpm3.c cmd_sd.c cmd_fat.c
19SRC += env.c con-utils.c print-utils.c getopt-min.c eval_arg.c
20SRC += timer.c serial.c i2c.c bcd.c pcf8583.c mmc.c strerror.c
21SRC += background.c z180-serv.c z80-if.c gpio.c
22SRC += $(FATFS)
23SRC += $(SRC_Z)
24
25#$(FATFS:%.c=%.o): CFLAGS += -fno-strict-aliasing
26$(SRC_Z:%.c=%.o): CFLAGS += -D'const=const __flash'
27
28
29# Place -D or -U options here
30CDEFS := -DF_CPU=$(F_CPU)UL
31
32ifeq ($(MCU),atmega1281)
33 CDEFS += -DMCU_STRING=\"ATmega1281\"
34else
35 CDEFS += -DMCU_STRING=\"ATmega2561\"
36endif
37
38ifdef DEBUG
39SRC += debug.c
40CDEFS += -DDEBUG=2
41endif
42
43# Place -I options here
44CINCS := -I../include
45
46OPT = s
47CSTANDARD = -std=gnu11
48CDEBUG =
49CWARN = -Wall -Wextra -Wstrict-prototypes -Wredundant-decls
50CTUNING = -funsigned-char -fshort-enums -funsigned-bitfields -fpack-struct
51CTUNING += -mrelax -fno-common
52CTUNING += -fno-move-loop-invariants
53CTUNING += -fno-tree-loop-optimize
54#CTUNING += -fno-split-wide-types
55CEXTRA = -ffunction-sections -fdata-sections
56#CEXTRA += -flto
57CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) $(CTUNING)
58
59
60
61# Linker Options - Create mapfile with cross reference
62LDFLAGS := -Wl,-Map=$(TARGET).map,--cref
63LDFLAGS += -Wl,--gc-sections
64
65# Programming support using avrdude.
66
67AVRDUDE_PROGRAMMER := dragon_isp
68AVRDUDE_PORT := usb
69
70
71# Uncomment the following if you do /not/ wish a verification to be
72# performed after programming the device.
73#AVRDUDE_NO_VERIFY = -V
74
75# Increase verbosity level. Please use this when submitting bug
76# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
77# to submit bug reports.
78#AVRDUDE_VERBOSE = -v -v
79
80#HFUSE = 0xDE
81#LFUSE = 0xFF
82#EFUSE = 0xFD
83
84# Fuse high byte:
85# 0xda = 1 1 0 1 1 1 1 0 <-- BOOTRST (Boot Reset vector Enabled 0x3c00)
86# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
87# | | | | | +-------- BOOTSZ1 (Boot Flash section size 256 words)
88# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
89# | | | +-------------- WDTON (WDT not always on)
90# | | +---------------- SPIEN (allow serial programming)
91# | +------------------ DWEN (debugWIRE is not enabled)
92# +-------------------- RSTDISBL (reset pin is enabled)
93# Fuse low byte:
94# 0x9f = 1 1 1 1 1 1 1 1
95# ^ ^ \ / \--+--/
96# | | | +------- CKSEL 3..0 (Low Power Crystal)
97# | | +--------------- SUT 1..0 (Crystal Osc, slowly rising power)
98# | +------------------ CKOUT (Clock output disabled)
99# +-------------------- CKDIV8 (don't divide clock by 8)
100# Fuse Extended byte:
101# 0x9f = 1 1 1 1 1 1 0 1
102# \-+-/
103# +------ Bodlevel (VCC = 2.7V)
104
105.PHONY: all build
106# Default target.
107all: build
108
109build: elf hex lss
110
111include ../mk/avr.rules.mk