X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=ROM2%2FMakefile;h=7a4421e8f8fd08dc5e9d0c02506fb14bf6c15116;hb=c9763dcb182398266bae1c6a7a848beec1cba35d;hp=efec0a7f492bc0236a6a8aa56c9ddde8df4db2e5;hpb=4f35424978e202fff48c2331eee9fd01e3da244f;p=uccvend-snackrom.git diff --git a/ROM2/Makefile b/ROM2/Makefile index efec0a7..7a4421e 100644 --- a/ROM2/Makefile +++ b/ROM2/Makefile @@ -1,11 +1,69 @@ -CFLAGS = -g -O2 -Wall -CC = m68hc11-gcc +# muchly stolen from m68hc1x's example.tar.gz's Makefile -OBJS = motors.o keypad.o display.o coinmech.o helpers.o +OBJS = \ + motors.o keypad.o display.o coinmech.o helpers.o main.o \ + vectors.o +INCLUDES = vend.h -all: rom -rom: $(OBJS) +CFLAGS = -O3 -Wall -m68hc11 -mshort -Wall -Os -g0 \ + -msoft-reg-count=0 -ffixed-z + +LDFLAGS = -m68hc11 -mshort -Wl,-m,m68hc11elfb \ + -nostartfiles \ + -Wl,-defsym,_io_ports=0x1000 \ + -Wl,-defsym,_switch_input=0x1800 \ + -Wl,-defsym,_misc_input=0x2000 \ + -Wl,-defsym,_home_sensors=0x2800 \ + -Wl,-defsym,_changer_output=0x3000 \ + -Wl,-defsym,_misc_output=0x3800 + +OBJCOPY_FLAGS=--only-section=.text \ + --only-section=.rodata \ + --only-section=.vectors \ + --only-section=.data + + +DEVC_PREFIX = m68hc11- +CC = $(DEVC_PREFIX)gcc +AS = $(DEVC_PREFIX)as +AR = $(DEVC_PREFIX)ar +SIZE = $(DEVC_PREFIX)size +OBJCOPY = $(DEVC_PREFIX)objcopy +OBJDUMP = $(DEVC_PREFIX)objdump +LD = $(DEVC_PREFIX)ld + +all: rom2.b rom2.elf rom2.s19 + +rom2.elf: $(OBJS) memory.x + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD) clean: - rm -f $(OBJS) + rm -f $(OBJS) *.elf *.s19 *.b *.a + +# +# Some useful rules +# +dump: rom2.elf + $(OBJDUMP) -d $< + +size: rom2.s19 + $(SIZE) $< + + +# +# Implicit rules +# +# .elf is for the simulator and gdb +# .s19 is for some downloader and the simulator +# .b is a binary dump +# +.SUFFIXES: .elf .s19 .b + +.elf.s19: + $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19 + +.elf.b: + $(OBJCOPY) --output-target=binary --gap-fill=255 \ + --only-section=.data $(OBJCOPY_FLAGS) $< $*.b +