]> cloudbase.mooo.com Git - z180-stamp.git/blame - avr/Makefile
Remove compiler warnings
[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
f1e16f88 48CDEBUG = -g
8a500c7f 49CWARN = -Wall -Wextra -Wstrict-prototypes -Wredundant-decls
f1e16f88
L
50CTUNING = -fshort-enums -funsigned-bitfields -fpack-struct
51#CTUNING += -funsigned-char
8a500c7f
L
52CTUNING += -mrelax -fno-common
53CTUNING += -fno-move-loop-invariants
54CTUNING += -fno-tree-loop-optimize
55#CTUNING += -fno-split-wide-types
56CEXTRA = -ffunction-sections -fdata-sections
57#CEXTRA += -flto
58CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) $(CTUNING)
59
60
61
62# Linker Options - Create mapfile with cross reference
63LDFLAGS := -Wl,-Map=$(TARGET).map,--cref
64LDFLAGS += -Wl,--gc-sections
65
66# Programming support using avrdude.
67
68AVRDUDE_PROGRAMMER := dragon_isp
69AVRDUDE_PORT := usb
70
71
72# Uncomment the following if you do /not/ wish a verification to be
73# performed after programming the device.
74#AVRDUDE_NO_VERIFY = -V
75
76# Increase verbosity level. Please use this when submitting bug
77# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
78# to submit bug reports.
79#AVRDUDE_VERBOSE = -v -v
80
81#HFUSE = 0xDE
82#LFUSE = 0xFF
83#EFUSE = 0xFD
84
85# Fuse high byte:
86# 0xda = 1 1 0 1 1 1 1 0 <-- BOOTRST (Boot Reset vector Enabled 0x3c00)
87# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
88# | | | | | +-------- BOOTSZ1 (Boot Flash section size 256 words)
89# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
90# | | | +-------------- WDTON (WDT not always on)
91# | | +---------------- SPIEN (allow serial programming)
92# | +------------------ DWEN (debugWIRE is not enabled)
93# +-------------------- RSTDISBL (reset pin is enabled)
94# Fuse low byte:
95# 0x9f = 1 1 1 1 1 1 1 1
96# ^ ^ \ / \--+--/
97# | | | +------- CKSEL 3..0 (Low Power Crystal)
98# | | +--------------- SUT 1..0 (Crystal Osc, slowly rising power)
99# | +------------------ CKOUT (Clock output disabled)
100# +-------------------- CKDIV8 (don't divide clock by 8)
101# Fuse Extended byte:
102# 0x9f = 1 1 1 1 1 1 0 1
103# \-+-/
104# +------ Bodlevel (VCC = 2.7V)
105
106.PHONY: all build
107# Default target.
108all: build
109
110build: elf hex lss
111
112include ../mk/avr.rules.mk