MCU := atmega1281 F_CPU := 18432000 DEBUG := 1 TARGET = stamp-monitor FATFSDIR := ../fatfs/source FATFS := $(FATFSDIR)/ff.c $(FATFSDIR)/ffunicode.c SRC_Z := ../z180/hdrom.c ../z180/cfboot.c ../z180/cpuinfo.c 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 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 := -DF_CPU=$(F_CPU)UL ifeq ($(MCU),atmega1281) CDEFS += -DMCU_STRING=\"ATmega1281\" else CDEFS += -DMCU_STRING=\"ATmega2561\" endif ifdef DEBUG SRC += debug.c CDEFS += -DDEBUG=2 endif # Place -I options here CINCS := -I../include OPT = s CSTANDARD = -std=gnu11 CDEBUG = -g CWARN = -Wall -Wextra -Wstrict-prototypes -Wredundant-decls CTUNING = -fshort-enums -funsigned-bitfields -fpack-struct #CTUNING += -funsigned-char CTUNING += -mrelax -fno-common CTUNING += -fno-move-loop-invariants CTUNING += -fno-tree-loop-optimize #CTUNING += -fno-split-wide-types CEXTRA = -ffunction-sections -fdata-sections #CEXTRA += -flto CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) $(CTUNING) # Linker Options - Create mapfile with cross reference LDFLAGS := -Wl,-Map=$(TARGET).map,--cref LDFLAGS += -Wl,--gc-sections # Programming support using avrdude. AVRDUDE_PROGRAMMER := dragon_isp AVRDUDE_PORT := usb # 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 # to submit bug reports. #AVRDUDE_VERBOSE = -v -v #HFUSE = 0xDE #LFUSE = 0xFF #EFUSE = 0xFD # Fuse high byte: # 0xda = 1 1 0 1 1 1 1 0 <-- BOOTRST (Boot Reset vector Enabled 0x3c00) # ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 # | | | | | +-------- BOOTSZ1 (Boot Flash section size 256 words) # | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) # | | | +-------------- WDTON (WDT not always on) # | | +---------------- SPIEN (allow serial programming) # | +------------------ DWEN (debugWIRE is not enabled) # +-------------------- RSTDISBL (reset pin is enabled) # Fuse low byte: # 0x9f = 1 1 1 1 1 1 1 1 # ^ ^ \ / \--+--/ # | | | +------- CKSEL 3..0 (Low Power Crystal) # | | +--------------- SUT 1..0 (Crystal Osc, slowly rising power) # | +------------------ CKOUT (Clock output disabled) # +-------------------- CKDIV8 (don't divide clock by 8) # Fuse Extended byte: # 0x9f = 1 1 1 1 1 1 0 1 # \-+-/ # +------ Bodlevel (VCC = 2.7V) .PHONY: all build # Default target. all: build build: elf hex lss include ../mk/avr.rules.mk