-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (62 loc) · 2.82 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
# lis3dh-spin Makefile - requires GNU Make, or compatible
# Variables below can be overridden on the command line
# e.g. make IFACE=LIS3DH_SPI LIS3DH-Demo.binary
# P1, P2 device nodes and baudrates
#P1DEV=
P1BAUD=115200
#P2DEV=
P2BAUD=2000000
# Build options
BUILDOPTS=
# P1, P2 compilers
#P1BUILD=flexspin
P1BUILD=flexspin --interp=rom
P2BUILD=flexspin -2
# LIS3DH interface: I2C, SPI
IFACE=LIS3DH_I2C
#IFACE=LIS3DH_SPI
# Paths to spin-standard-library, and p2-spin-standard-library,
# if not specified externally
SPIN1_LIB_PATH=-L ../spin-standard-library/library
SPIN2_LIB_PATH=-L ../p2-spin-standard-library/library
# -- Internal --
SPIN1_DRIVER_FN=sensor.accel.3dof.lis3dh.spin
SPIN2_DRIVER_FN=sensor.accel.3dof.lis3dh.spin2
CORE_FN=core.con.lis3dh.spin
# --
# Build all targets (build only)
all: LIS3DH-Demo.binary LIS3DH-Demo.bin2 LIS3DH-ClickDemo.binary LIS3DH-ClickDemo.bin2
# Load P1 or P2 target (will build first, if necessary)
p1demo: loadp1demo
p1click: loadp1click
p2demo: loadp2demo
p2click: loadp2click
# Build binaries
LIS3DH-Demo.binary: LIS3DH-Demo.spin $(SPIN1_DRIVER_FN) $(CORE_FN)
$(P1BUILD) $(SPIN1_LIB_PATH) -b -D $(IFACE) $(BUILDOPTS) LIS3DH-Demo.spin
LIS3DH-Demo.bin2: LIS3DH-Demo.spin2 $(SPIN2_DRIVER_FN) $(CORE_FN)
$(P2BUILD) $(SPIN2_LIB_PATH) -b -2 -D $(IFACE) $(BUILDOPTS) -o LIS3DH-Demo.bin2 LIS3DH-Demo.spin2
LIS3DH-ClickDemo.binary: LIS3DH-ClickDemo.spin $(SPIN1_DRIVER_FN) $(CORE_FN)
$(P1BUILD) $(SPIN1_LIB_PATH) -b -D $(IFACE) $(BUILDOPTS) LIS3DH-ClickDemo.spin
LIS3DH-ClickDemo.bin2: LIS3DH-ClickDemo.spin2 $(SPIN2_DRIVER_FN) $(CORE_FN)
$(P2BUILD) $(SPIN2_LIB_PATH) -b -2 -D $(IFACE) $(BUILDOPTS) -o LIS3DH-ClickDemo.bin2 LIS3DH-ClickDemo.spin2
LIS3DH-FreeFallDemo.binary: LIS3DH-FreeFallDemo.spin $(SPIN1_DRIVER_FN) $(CORE_FN)
$(P1BUILD) $(SPIN1_LIB_PATH) -b -D $(IFACE) $(BUILDOPTS) LIS3DH-FreeFallDemo.spin
LIS3DH-FreeFallDemo.bin2: LIS3DH-FreeFallDemo.spin2 $(SPIN2_DRIVER_FN) $(CORE_FN)
$(P2BUILD) $(SPIN2_LIB_PATH) -b -2 -D $(IFACE) $(BUILDOPTS) -o LIS3DH-FreeFallDemo.bin2 LIS3DH-FreeFallDemo.spin2
# Load binaries to RAM (will build first, if necessary)
loadp1demo: LIS3DH-Demo.binary
proploader -t -p $(P1DEV) -Dbaudrate=$(P1BAUD) LIS3DH-Demo.binary
loadp1click: LIS3DH-ClickDemo.binary
proploader -t -p $(P1DEV) -Dbaudrate=$(P1BAUD) LIS3DH-ClickDemo.binary
loadp1ffall: LIS3DH-FreeFallDemo.binary
proploader -t -p $(P1DEV) -Dbaudrate=$(P1BAUD) LIS3DH-FreeFallDemo.binary
loadp2demo: LIS3DH-Demo.bin2
loadp2 -SINGLE -p $(P2DEV) -v -b$(P2BAUD) -l$(P2BAUD) LIS3DH-Demo.bin2 -t
loadp2click: LIS3DH-ClickDemo.bin2
loadp2 -SINGLE -p $(P2DEV) -v -b$(P2BAUD) -l$(P2BAUD) LIS3DH-ClickDemo.bin2 -t
loadp2ffall: LIS3DH-FreeFallDemo.bin2
loadp2 -SINGLE -p $(P2DEV) -v -b$(P2BAUD) -l$(P2BAUD) LIS3DH-FreeFallDemo.bin2 -t
# Remove built binaries and assembler outputs
clean:
rm -fv *.binary *.bin2 *.pasm *.p2asm