-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (31 loc) · 1.1 KB
/
Copy pathMakefile
File metadata and controls
44 lines (31 loc) · 1.1 KB
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
PROJECT := Roberto
DEBUG_PORT ?= 4242
BUILD_DIR ?= cmake-build-debug
SOURCES += $(shell find . -name '*.c' -o -name '*.h')
EXCLUDE_DIRS += ./stm32f4/%
EXCLUDE_DIRS += ./include/stm32f4/%
EXCLUDE_DIRS += ./$(BUILD_DIR)/%
default_target: all
.PHONY: _flash flash debug-server debug build format lint all
all: format lint build
format:
clang-format -i $(filter-out $(EXCLUDE_DIRS), $(SOURCES))
lint:
clang-tidy --extra-arg="-Iinclude" $(filter-out $(EXCLUDE_DIRS), $(SOURCES))
${BUILD_DIR}:
cmake -S . -B ${BUILD_DIR}
build: cmake-build-debug
cmake --build ${BUILD_DIR} --target ${PROJECT} -- -j 12
arm-none-eabi-objcopy -O binary cmake-build-debug/${PROJECT} ${PROJECT}.bin
_flash: build
st-flash write ${PROJECT}.bin 0x8000000
flash:
# flash sometimes fails the first time.
${MAKE} _flash || ${MAKE} _flash
debug: flash
st-util -p ${DEBUG_PORT} &
gdb-multiarch -ex "target remote localhost:${DEBUG_PORT}" -ex "symbol-file ${BUILD_DIR}/${PROJECT}"
debug-client:
gdb-multiarch -ex "target remote localhost:${DEBUG_PORT}" -ex "symbol-file ${BUILD_DIR}/${PROJECT}"
debug-server:
st-util -p ${DEBUG_PORT}