summaryrefslogtreecommitdiff
path: root/avr/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'avr/Makefile')
-rw-r--r--avr/Makefile114
1 files changed, 114 insertions, 0 deletions
diff --git a/avr/Makefile b/avr/Makefile
new file mode 100644
index 0000000..89d13a0
--- /dev/null
+++ b/avr/Makefile
@@ -0,0 +1,114 @@
+
+
+MCU := atmega1281
+F_CPU := 18432000
+DEBUG := 1
+
+TARGET = stamp-monitor
+
+###############################################################################
+
+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
+
+FATFSDIR := ../fatfs/source
+FATFS := $(FATFSDIR)/ff.c $(FATFSDIR)/ffunicode.c
+ZDIR := ../z180
+SRC_Z := $(ZDIR)/hdrom.c $(ZDIR)/cfboot.c $(ZDIR)/cpuinfo.c
+
+# Sources that may depend on Z180 code:
+Z_DEP := $(shell grep -sl 'include[[:blank:]]\+"$(ZDIR)' $(SRC))
+
+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 +=
+
+ifdef DEBUG
+SRC += debug.c
+CDEFS += -DDEBUG=2
+endif
+
+# Place -I options here
+CINCS := -I../include
+
+# Extra C flags
+#TGT_CFLAGS += -funsigned-char
+TGT_CFLAGS += -fno-move-loop-invariants
+TGT_CFLAGS += -fno-tree-loop-optimize
+#TGT_CFLAGS += -fno-split-wide-types
+#TGT_CFLAGS += -flto
+
+
+###############################################################################
+# Programming support using avrdude.
+
+AVRDUDE_PROGRAMMER := dragon_isp
+# Uncomment, if the programmer is /not/ on USB.
+#AVRDUDE_PORT :=
+
+LFUSE = 0x97
+HFUSE = 0xD6
+EFUSE = 0xF5
+
+# Fuse low byte:
+# 0x97 = 1 0 0 1 0 1 1 1
+# ^ ^ \ / \--+--/
+# | | | +------- CKSEL 3..0 (Low Power Crystal)
+# | | +--------------- SUT 1..0 (Crystal Osc, slowly rising power)
+# | +------------------ CKOUT (Clock output enabled)
+# +-------------------- CKDIV8 (don't divide clock by 8)
+# Fuse high byte:
+# 0xd6 = 1 1 0 1 0 1 1 0
+# ^ ^ ^ ^ ^ \+/ ^---- BOOTRST (Boot Reset vector Enabled 0x3c00)
+# | | | | | +------- BOOTSZ 1..0 (Boot Flash section size 512 words)
+# | | | | + --------- EESAVE (Preserve EEPROM over chip erase)
+# | | | +-------------- WDTON (WDT not always on)
+# | | +---------------- SPIEN (allow serial programming)
+# | +------------------ JTAGEN (JTAG disabled)
+# +-------------------- OCDEN (OCD disabled)
+# Fuse Extended byte:
+# 0xf5 = 1 1 1 1 0 1 0 1
+# \-+-/
+# +------ Bodlevel (VCC = 2.7V)
+
+# 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 <http://savannah.nongnu.org/projects/avrdude>
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+###############################################################################
+#.SECONDEXPANSION:
+
+.PHONY: all build
+# Default target.
+all: build
+
+build: hex lss
+
+clean: clean_z
+$(Z_DEP:%.c=%.o): $(SRC_Z)
+
+$(SRC_Z):
+ $(MAKE) -C $(ZDIR) $(@F)
+
+.PHONY: clean_z
+clean_z:
+ $(MAKE) -C $(ZDIR) clean
+
+include ../mk/avr.rules.mk