X-Git-Url: https://git.ucc.asn.au/?p=uccvend-snackrom.git;a=blobdiff_plain;f=ROM2%2FMakefile;h=e9f6e0c7f1e7ff5ec94578b3822fca40c3726d77;hp=58e78bd9ea39e8e689002997d66a5a0df1b8dbef;hb=e32e95e05f80aa8a35f768af4b2b0f0aa92d362a;hpb=81ad17d2164523859d14464b9950a39f87e04937 diff --git a/ROM2/Makefile b/ROM2/Makefile index 58e78bd..e9f6e0c 100644 --- a/ROM2/Makefile +++ b/ROM2/Makefile @@ -2,15 +2,16 @@ OBJS = \ motors.o keypad.o display_basic.o coinmech.o chime.o \ - helpers.o server.o 16550.o main_basic.o \ - vectors.o -INCLUDES = vend.h keypad.h chime.h asm.h display_basic.h ports.h types.h - -CFLAGS = -O3 -m68hc11 -mshort -Wall -Os -g0 \ - -msoft-reg-count=0 -ffixed-z + helpers.o main_basic.o sci.o \ + vectors.o start.o romsrc.o xmodem.o mic.o +INCLUDES = vend.h keypad.h chime.h asm.h display_basic.h ports.h types.h version.h +# debugging doesn't get compiled into the ROM image +CFLAGS = -m68hc11 -mshort -Wall -O1 \ + -msoft-reg-count=0 -ffixed-z -g -fomit-frame-pointer LDFLAGS = -m68hc11 -mshort -Wl,-m,m68hc11elfb \ -nostartfiles \ + -Wl,-defsym,_nvram=0x0800 \ -Wl,-defsym,_io_ports=0x1000 \ -Wl,-defsym,_switch_input=0x1800 \ -Wl,-defsym,_misc_input=0x2000 \ @@ -34,13 +35,18 @@ OBJCOPY = $(DEVC_PREFIX)objcopy OBJDUMP = $(DEVC_PREFIX)objdump LD = $(DEVC_PREFIX)ld -all: rom2.b rom2.elf rom2.s19 +all: rom2.b rom2.elf rom2.s19 crctest -rom2.elf: $(OBJS) memory.x +rom2.elf: $(OBJS) memory.x check-romsrc.pl $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD) + $(SIZE) $@ + @perl -w check-romsrc.pl clean: - rm -f *.o *.elf *.s19 *.b *.a + rm -f *.o *.elf *.s19 *.b *.a rom.tar.bz2 romsrc.s crctab.h m68hc11-gdb gencrctab crctest + +crctest: crctest.c crctab.h + gcc -o $@ $< # # Some useful rules @@ -51,14 +57,21 @@ dump: rom2.elf size: rom2.s19 $(SIZE) $< +rom.tar.bz2: + rm -f romsrc.s crctab.h + tar c README Makefile gdbsimrc *.pl *.c *.h *.s *.x | bzip2 -c -9 > $@ + +romsrc.s: rom.tar.bz2 src2asm.pl + perl -w src2asm.pl < $< > $@ + +xmodem.c: crctab.h + +crctab.h: gencrctab + ./gencrctab > $@ + +gencrctab: gencrctab.c + gcc -o $@ $< -# -# 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: @@ -66,5 +79,12 @@ size: rom2.s19 .elf.b: $(OBJCOPY) --output-target=binary --gap-fill=255 \ - --only-section=.data $(OBJCOPY_FLAGS) $< $*.b - + $(OBJCOPY_FLAGS) $< $*.b + @perl -e '$$sum = 0;while(read STDIN, $$a, 1){$$sum += ord($$a); $$sum = $$sum&0xffff;} printf "Checksum is \%x\n", $$sum' < $@ + +m68hc11-gdb: /usr/bin/m68hc11-gdb + sed -e 's|m68hc11eepr/reg 0xb000 512|m68hc11eepr/reg 0x4000 1 |' < $< > $@ + chmod 755 $@ + +sim: m68hc11-gdb rom2.elf + ./m68hc11-gdb -x gdbsimrc rom2.elf