]> cloudbase.mooo.com Git - z180-stamp.git/blob - avr/Makefile
Add makefiles (replace Tup)
[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 =
49 CWARN = -Wall -Wextra -Wstrict-prototypes -Wredundant-decls
50 CTUNING = -funsigned-char -fshort-enums -funsigned-bitfields -fpack-struct
51 CTUNING += -mrelax -fno-common
52 CTUNING += -fno-move-loop-invariants
53 CTUNING += -fno-tree-loop-optimize
54 #CTUNING += -fno-split-wide-types
55 CEXTRA = -ffunction-sections -fdata-sections
56 #CEXTRA += -flto
57 CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) $(CTUNING)
58
59
60
61 # Linker Options - Create mapfile with cross reference
62 LDFLAGS := -Wl,-Map=$(TARGET).map,--cref
63 LDFLAGS += -Wl,--gc-sections
64
65 # Programming support using avrdude.
66
67 AVRDUDE_PROGRAMMER := dragon_isp
68 AVRDUDE_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.
107 all: build
108
109 build: elf hex lss
110
111 include ../mk/avr.rules.mk