-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile.template
69 lines (50 loc) · 1.1 KB
/
Makefile.template
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
#
# Template build file for Formula Slug FS-2
#
PROJECT := template
MBED_TOOLCHAIN ?= GCC_ARM
MBED_TARGET ?= LPC1768
MBED_BUILD_PROFILE ?= release
BUILD_DIR := cmake_build
DEPENDENCIES := mbed-os
.PHONY: all
all: build-release
#
# Dependency pulling
#
.PHONY: deps
deps: $(DEPENDENCIES)
$(DEPENDENCIES):
mbed-tools deploy
#
# Build profiles
#
$(BUILD_DIR):
mbed-tools configure -t $(MBED_TOOLCHAIN) -m $(MBED_TARGET) -b $(MBED_BUILD_PROFILE)
.PHONY: build
build: deps $(BUILD_DIR)
mbed-tools compile -t $(MBED_TOOLCHAIN) -m $(MBED_TARGET) -b $(MBED_BUILD_PROFILE)
.PHONY: build-debug
build-debug: MBED_BUILD_PROFILE=debug
build-debug: build
.PHONY: build-release
build-release: MBED_BUILD_PROFILE=release
build-release: build
#
# Flashing to devices
#
.PHONY: flash
flash: deps $(BUILD_DIR)
mbed-tools compile -t $(MBED_TOOLCHAIN) -m $(MBED_TARGET) -b $(MBED_BUILD_PROFILE) -f
#
# STM32 F303 debug
#
.PHONY: debug
debug: build-debug
arm-none-eabi-gdb -x .gdbinit ./$(BUILD_DIR)/$(MBED_TARGET)/$(MBED_BUILD_PROFILE)/$(MBED_TOOLCHAIN)/$(PROJECT).elf
#
# Utilities
#
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)