forked from jamesmunns/teensy3-rs-demo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
68 lines (55 loc) · 1.74 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
# Important!
# Choose your model below by uncommenting the corresponding line.
# There is no need to do any other device specific modifications in the entire project.
#MODEL=TEENSY30
#MODEL=TEENSY31
#MODEL=TEENSY32
#MODEL=TEENSY35
#MODEL=TEENSY36
# Package manager can be selected from Cargo or Cross.
# Use Cargo only if you have installed all dependencies. Dependencies can be found from Dockerfile
PKGMAN=cross
#PKGMAN=cargo
# --------------------------------------------
# The rest of makefile need not to be changed
# --------------------------------------------
# Following definition makes hopefully more understandable error message when
# model is not specified.
ifndef MODEL
MODEL=PLEASE_SPECIFY_YOUR_TEENSY_MODEL_IN_MAKEFILE
endif
TARGET=thumbv7em-none-eabi
# Enable hardware floating point for teensy 3.5 and 3.6
ifeq ($(MODEL), TEENSY35)
TARGET=thumbv7em-none-eabihf
endif
ifeq ($(MODEL), TEENSY36)
TARGET=thumbv7em-none-eabihf
endif
BIN=teensy3-rs-demo
OUTDIR=target/$(TARGET)/release
HEXPATH=$(OUTDIR)/$(BIN).hex
BINPATH=$(OUTDIR)/$(BIN)
all:: $(BINPATH)
.PHONY: $(BINPATH)
$(BINPATH):
$(PKGMAN) build --release --target $(TARGET) --features "$(MODEL)"
.PHONY: debug
debug:
$(PKGMAN) build --target $(TARGET) --features "$(MODEL)" --verbose
# Run clippy linter. Some bad lints are suppressed. Also supress warnings
# generated by Bindgen, which seems to not be clippy compliant
.PHONY: clippy
clippy:
$(PKGMAN) clippy --target $(TARGET) --features "$(MODEL)"
.PHONY: doc
doc:
$(PKGMAN) doc --features TEENSY36 --target "$(TARGET)"
$(HEXPATH): $(BINPATH)
arm-none-eabi-objcopy -O ihex -R .eeprom $(BINPATH) $(HEXPATH)
.PHONY: flash
flash: $(HEXPATH)
teensy_loader_cli -w -s --mcu=$(MODEL) $(HEXPATH) -v
.PHONY: clean
clean:
$(PKGMAN) clean