-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (68 loc) · 1.92 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
HEX := kitchen_timer
CHIP := 12F683
SRCDIR := src
SRCS := $(shell find $(SRCDIR) -type f -name *.c)
OUTDIR := build
BIN := $(OUTDIR)/$(HEX).hex
LOGS := log.* MPLABXLog.xml*
# Set writing shell script path
IPE := ./tool/ipecmd.sh
# Set writing TOOL (Pickit3)
TOOL := PPK3
# Power target from TOOL
VDD := 5.0
# Compiler
CC := xc8-cc
CFLAGS := -mwarn=-9
.PHONY: rebuild clean
.PHONY: write erase verify blank
.PHONY: writew erasew verifyw blankw
# Build
$(BIN): $(SRCS)
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
$(CC) -mcpu=$(CHIP) $(CFLAGS) -o $@ $^
# Clean and Build
rebuild: clean $(BIN)
# Delete OUTDIR and LOGS
clean:
rm -rf $(OUTDIR)
# Write BIN in CHIP using TOOL
write:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -F$(BIN) -M
@mv $(LOGS) $(OUTDIR)
# Erase Flash Device
erase:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -E
@mv $(LOGS) $(OUTDIR)
# Verify Device
verify:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -F$(BIN) -Y
@mv $(LOGS) $(OUTDIR)
# Blank Check Device
blank:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -C
@mv $(LOGS) $(OUTDIR)/
# Write BIN in CHIP using TOOL. Power target from TOOL
writew:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -F$(BIN) -M -W$(VDD)
@mv $(LOGS) $(OUTDIR)
# Erase Flash Device. Power target from TOOL
erasew:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -E -W$(VDD)
@mv $(LOGS) $(OUTDIR)
# Verify Device. Power target from TOOL
verifyw:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -F$(BIN) -Y -W$(VDD)
@mv $(LOGS) $(OUTDIR)
# Blank Check Device. Power target from TOOL
blankw:
@if [ ! -e $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
-$(IPE) -P$(CHIP) -T$(TOOL) -C -W$(VDD)
@mv $(LOGS) $(OUTDIR)