-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (58 loc) · 1.38 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
###########################################################
# makefile for $(NAME)
###########################################################
BOARD=stm8s208rb
PROGRAMMER=stlinkv21
CNAME=ch5_c
ANAME=ch5_asm
TNAME=ch5_demo
SDAS=sdasstm8
SDCC=sdcc
SDLD=sdldstm8
LDFLAGS=--out-fmt-ihx
CFLAGS=
FLASH=stm8flash
INC=../inc/
INCLUDES=$(INC)stm8s208.inc
BUILD=build/
LIB_PATH=../lib
CREL=$(BUILD)$(CNAME).rel
AREL=$(BUILD)$(ANAME).rel
OBJECTS=$(CREL) $(AREL)
SYMBOLS=$(OBJECTS:.rel=.sym)
ASMS=$(OBJECTS:.rel=.asm)
LISTS=$(OBJECTS:.rel=.lst)
RSTS=$(OBJECTS:.rel=.rst)
TARGET=$(BUILD)$(TNAME).ihx
MAP=$(TARGET:.ihx=.map)
LK=$(TARGET:.ihx=.lk)
CDB=$(TARGET:.ihx=.cdb)
.PHONY: all flash
all: clean $(TARGET)
flash: $(TARGET)
@echo
@echo "***************"
@echo "flashing device"
@echo "***************"
$(FLASH) -c $(PROGRAMMER) -p $(BOARD) -w $(TARGET)
%.rel: $(ANAME).asm $(CNAME).c $(INC)stm8s208.inc
@echo
@echo "**************"
@echo " assemblage "
@echo "**************"
$(SDAS) -g -l -o $(AREL) $(ANAME).asm
$(SDCC) -c -mstm8 -o $(CREL) $(CNAME).c
$(TARGET): $(OBJECTS) $(INCLUDES)
@echo
@echo "***************"
@echo "linking files"
@echo "***************"
$(SDCC) -mstm8 -L$(LIB_PATH) -lstm8 -luart $(LDFLAGS) -o $@ $(OBJECTS)
@ls -gG $(TARGET)
clean:
@echo
@echo "***************"
@echo "cleaning files"
@echo "***************"
rm -f $(BUILD)*
.PHONY: all clean flash