17694c0539392854a45cfa7061aaecf12eaa7aa5
[uccvend-snackrom.git] / ROM2 / Makefile
1 # muchly stolen from m68hc1x's example.tar.gz's Makefile
2
3 OBJS = \
4         motors.o keypad.o display_basic.o coinmech.o chime.o \
5         helpers.o main_basic.o sci.o \
6         vectors.o start.o
7 INCLUDES = vend.h keypad.h chime.h asm.h display_basic.h ports.h types.h
8
9 # debugging doesn't get compiled into the ROM image
10 CFLAGS = -m68hc11 -mshort -Wall -O1 \
11         -msoft-reg-count=0 -ffixed-z -g -fomit-frame-pointer
12
13 LDFLAGS = -m68hc11 -mshort -Wl,-m,m68hc11elfb \
14           -nostartfiles \
15           -Wl,-defsym,_io_ports=0x1000 \
16           -Wl,-defsym,_switch_input=0x1800 \
17           -Wl,-defsym,_misc_input=0x2000 \
18           -Wl,-defsym,_home_sensors=0x2800 \
19           -Wl,-defsym,_changer_output=0x3000 \
20           -Wl,-defsym,_misc_output=0x3800 \
21           -Wl,-defsym,_uart_regs=0x4000
22
23 OBJCOPY_FLAGS=--only-section=.text \
24               --only-section=.rodata \
25               --only-section=.vectors \
26               --only-section=.data
27
28
29 DEVC_PREFIX = m68hc11-
30 CC = $(DEVC_PREFIX)gcc
31 AS = $(DEVC_PREFIX)as
32 AR = $(DEVC_PREFIX)ar
33 SIZE = $(DEVC_PREFIX)size
34 OBJCOPY = $(DEVC_PREFIX)objcopy
35 OBJDUMP = $(DEVC_PREFIX)objdump
36 LD = $(DEVC_PREFIX)ld
37
38 all: rom2.b rom2.elf rom2.s19
39
40 rom2.elf: $(OBJS) memory.x
41         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD)
42
43 clean:
44         rm -f *.o *.elf *.s19 *.b *.a
45
46 #
47 # Some useful rules
48 #
49 dump:   rom2.elf
50         $(OBJDUMP) -d $<
51
52 size:   rom2.s19
53         $(SIZE) $<
54
55
56 #
57 # Implicit rules
58 #
59 # .elf is for the simulator and gdb
60 # .s19 is for some downloader and the simulator
61 # .b   is a binary dump
62 #
63 .SUFFIXES: .elf .s19 .b
64
65 .elf.s19:
66         $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19
67
68 .elf.b:
69         $(OBJCOPY) --output-target=binary --gap-fill=255 \
70                    --only-section=.data $(OBJCOPY_FLAGS) $< $*.b
71                    

UCC git Repository :: git.ucc.asn.au