-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (20 loc) · 875 Bytes
/
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
OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
OBJS += $(patsubst src/%.c,src/%.o,$(wildcard src/*.c))
OBJS += $(patsubst target/%.c,target/%.o,$(wildcard target/*.c))
OBJS += $(patsubst printf/%.c,printf/%.o,$(wildcard printf/*.c))
OPENCM3_DIR = ./libopencm3
DEVICE = stm32f103c8t6
CFLAGS += -Os -ggdb3 -std=c99
CPPFLAGS += -MD
LDFLAGS += -static -nostartfiles
LDLIBS += -Wl,--start-group -lm -lc -lgcc -lnosys -Wl,--end-group
include $(OPENCM3_DIR)/mk/genlink-config.mk
include $(OPENCM3_DIR)/mk/gcc-config.mk
.PHONY: clean all
all: binary.elf binary.hex
clean:
$(Q)$(RM) -rf binary.* *.o src/*.o src/*.d generated.*.ld
include $(OPENCM3_DIR)/mk/genlink-rules.mk
include $(OPENCM3_DIR)/mk/gcc-rules.mk
upload: binary.hex
openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c "program binary.hex verify reset exit"