]> cloudbase.mooo.com Git - z180-stamp.git/blob - avr/Makefile
Remove compiler warnings
[z180-stamp.git] / avr / Makefile
1
2
3 MCU := atmega1281
4 F_CPU := 18432000
5 DEBUG := 1
6
7 TARGET = stamp-monitor
8
9 FATFSDIR := ../fatfs/source
10 FATFS := $(FATFSDIR)/ff.c $(FATFSDIR)/ffunicode.c
11
12 SRC_Z := ../z180/hdrom.c ../z180/cfboot.c ../z180/cpuinfo.c
13
14 SRC := main.c
15 SRC += cli.c cli_readline.c command.c command_tbl.c
16 SRC += cmd_run.c cmd_boot.c cmd_misc.c cmd_cpu.c
17 SRC += cmd_date.c cmd_mem.c cmd_gpio.c cmd_attach.c
18 SRC += cmd_loadihex.c cmd_loadcpm3.c cmd_sd.c cmd_fat.c
19 SRC += env.c con-utils.c print-utils.c getopt-min.c eval_arg.c
20 SRC += timer.c serial.c i2c.c bcd.c pcf8583.c mmc.c strerror.c
21 SRC += background.c z180-serv.c z80-if.c gpio.c
22 SRC += $(FATFS)
23 SRC += $(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
30 CDEFS := -DF_CPU=$(F_CPU)UL
31
32 ifeq ($(MCU),atmega1281)
33 CDEFS += -DMCU_STRING=\"ATmega1281\"
34 else
35 CDEFS += -DMCU_STRING=\"ATmega2561\"
36 endif
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 OPT = s
47 CSTANDARD = -std=gnu11
48 CDEBUG = -g
49 CWARN = -Wall -Wextra -Wstrict-prototypes -Wredundant-decls
50 CTUNING = -fshort-enums -funsigned-bitfields -fpack-struct
51 #CTUNING += -funsigned-char
52 CTUNING += -mrelax -fno-common
53 CTUNING += -fno-move-loop-invariants
54 CTUNING += -fno-tree-loop-optimize
55 #CTUNING += -fno-split-wide-types
56 CEXTRA = -ffunction-sections -fdata-sections
57 #CEXTRA += -flto
58 CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) $(CTUNING)
59
60
61
62 # Linker Options - Create mapfile with cross reference
63 LDFLAGS := -Wl,-Map=$(TARGET).map,--cref
64 LDFLAGS += -Wl,--gc-sections
65
66 # Programming support using avrdude.
67
68 AVRDUDE_PROGRAMMER := dragon_isp
69 AVRDUDE_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.
108 all: build
109
110 build: elf hex lss
111
112 include ../mk/avr.rules.mk