forked from AdamLaurie/CC-Bootloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
111 lines (86 loc) · 3.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#
# CC Debugger
# Fergus Noble (c) 2011
#
CC = sdcc
AS = sdas8051
CFLAGS = --model-small --opt-code-size
LDFLAGS_FLASH = \
--out-fmt-ihx \
--code-loc 0x0000 --code-size 0x1400 \
--xram-loc 0xf000 --xram-size 0x300 \
--iram-size 0x100
ASFLAGS = -plosgff
ifdef DEBUG
CFLAGS += --debug
endif
SRC = \
src/main.c \
src/usb.c \
src/flash.c \
src/intel_hex.c \
src/hal.c \
src/usb_descriptors.c
ASM_SRC = src/start.asm
ADB = $(SRC:.c=.c.adb)
ASM = $(SRC:.c=.c.asm)
LNK = $(SRC:.c=.c.lnk)
LST = $(SRC:.c=.c.lst)
REL = $(SRC:.c=.c.rel)
RST = $(SRC:.c=.c.rst)
SYM = $(SRC:.c=.c.sym)
ASM_ADB = $(ASM_SRC:.asm=.adb)
ASM_LNK = $(ASM_SRC:.asm=.lnk)
ASM_LST = $(ASM_SRC:.asm=.lst)
ASM_REL = $(ASM_SRC:.asm=.rel)
ASM_RST = $(ASM_SRC:.asm=.rst)
ASM_SYM = $(ASM_SRC:.asm=.sym)
PROGS = CCBootloader.hex CCBootloader-rfcat-chronosdongle.hex CCBootloader-rfcat-donsdongle.hex CCBootloader-rfcat-ys1.hex CCBootloader-rfcat-PCdongle.hex
PCDB = $(PROGS:.hex=.cdb)
PLNK = $(PROGS:.hex=.lnk)
PMAP = $(PROGS:.hex=.map)
PMEM = $(PROGS:.hex=.mem)
PAOM = $(PROGS:.hex=)
%.c.rel : %.c
$(CC) -c $(CFLAGS) -o$*.c.rel $<
%.rel : %.asm
$(AS) -c $(ASFLAGS) $<
all: $(PROGS)
CCBootloader.hex: $(REL) $(ASM_REL) Makefile
$(CC) $(LDFLAGS_FLASH) $(CFLAGS) -o CCBootloader.hex $(ASM_REL) $(REL)
CCBootloader-rfcat-chronosdongle.hex: CFLAGS += -DRFCAT -DRFCAT_CHRONOS
CCBootloader-rfcat-chronosdongle.hex: $(REL) $(ASM_REL) Makefile
$(CC) $(LDFLAGS_FLASH) $(CFLAGS) -o CCBootloader-rfcat-chronosdongle.hex $(ASM_REL) $(REL)
CCBootloader-rfcat-donsdongle.hex: CFLAGS += -DRFCAT -DRFCAT_DONSDONGLE
CCBootloader-rfcat-donsdongle.hex: $(REL) $(ASM_REL) Makefile
$(CC) $(LDFLAGS_FLASH) $(CFLAGS) -o CCBootloader-rfcat-donsdongle.hex $(ASM_REL) $(REL)
CCBootloader-rfcat-ys1.hex: CFLAGS += -DRFCAT -DRFCAT_YARDSTICKONE
CCBootloader-rfcat-ys1.hex: $(REL) $(ASM_REL) Makefile
$(CC) $(LDFLAGS_FLASH) $(CFLAGS) -o CCBootloader-rfcat-ys1.hex $(ASM_REL) $(REL)
CCBootloader-rfcat-PCdongle.hex: CFLAGS += -DRFCAT -DRFCAT_PCDONGLE
CCBootloader-rfcat-PCdongle.hex: $(REL) $(ASM_REL) Makefile
$(CC) $(LDFLAGS_FLASH) $(CFLAGS) -o CCBootloader-rfcat-PCdongle.hex $(ASM_REL) $(REL)
clean:
rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
rm -f $(ASM_ADB) $(ASM_LNK) $(ASM_LST) $(ASM_REL) $(ASM_RST) $(ASM_SYM)
rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
install: CCBootloader.hex
goodfet.cc erase
goodfet.cc flash CCBootloader.hex
goodfet.cc verify CCBootloader.hex
installchronosdongle: CCBootloader-rfcat-chronosdongle.hex
goodfet.cc erase
goodfet.cc flash CCBootloader-rfcat-chronosdongle.hex
goodfet.cc verify CCBootloader-rfcat-chronosdongle.hex
installdonsdongle: CCBootloader-rfcat-donsdongle.hex
goodfet.cc erase
goodfet.cc flash CCBootloader-rfcat-donsdongle.hex
goodfet.cc verify CCBootloader-rfcat-donsdongle.hex
installys1dongle: CCBootloader-rfcat-ys1.hex
goodfet.cc erase
goodfet.cc flash CCBootloader-rfcat-ys1.hex
goodfet.cc verify CCBootloader-rfcat-ys1.hex
installpcdongle: CCBootloader-rfcat-PCdongle.hex
goodfet.cc erase
goodfet.cc flash CCBootloader-rfcat-PCdongle.hex
goodfet.cc verify CCBootloader-rfcat-PCdongle.hex