~ruther/stm32h747i-disco-usb-image-viewer

ref: 99242d8cf1d78fcece091151b4a79d4e5ad52ac1 stm32h747i-disco-usb-image-viewer/Makefile -rw-r--r-- 1.3 KiB
99242d8c — Rutherther feat: toggle led on exti interrupt push button 7 months ago
                                                                                
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
DEVICE?=stm32h747
TARGET?=stm32h7x
CPU?=cortex-m7

APP=blink.elf

BINDIR=bin
SRCDIR=src
INCDIR=include
OBJDIR=obj

DEVICEDIR=devices/$(DEVICE)
GENERALDIR=devices/general

PROJSRCS=$(wildcard $(SRCDIR)/*.c)
GENERALSRCS=$(wildcard $(GENERALDIR)/*.c)
DEVICESRCS=$(wildcard $(DEVICEDIR)/*.c)

SRCS=$(PROJSRCS) $(GENERALSRCS) $(DEVICESRCS)
OBJS=$(patsubst %.c,obj/%.o,$(SRCS))

CFLAGS=-I$(INCDIR) \
				-I$(DEVICEDIR)/$(INCDIR) \
				-Ilibs/CMSIS_6/CMSIS/Core/Include \
				-Ilibs/cmsis_device_h7/Include \
				-mthumb -mcpu=$(CPU) -nostdlib -g \
				-DCORE_CM7
LDFLAGS=-T$(DEVICEDIR)/linker_script.ld -nostdlib

CC=arm-none-eabi-gcc
LD=arm-none-eabi-ld
OPENOCD=openocd

$(BINDIR)/$(APP): $(OBJS)
	mkdir -p $(BINDIR)
	$(LD) $^ -o $@ $(LDFLAGS)

$(OBJDIR)/src/%.o: $(SRCDIR)/%.c
	mkdir -p "$(OBJDIR)/src"
	$(CC) -c $< -o $@ $(CFLAGS)

$(OBJDIR)/$(DEVICEDIR)/%.o: $(DEVICEDIR)/%.c
	mkdir -p "$(OBJDIR)/$(DEVICEDIR)"
	$(CC) -c $< -o $@ $(CFLAGS)

$(OBJDIR)/$(GENERALDIR)/%.o: $(GENERALDIR)/%.c
	mkdir -p "$(OBJDIR)/$(GENERALDIR)"
	$(CC) -c $< -o $@ $(CFLAGS)

.PHONY: openocd flash clean
openocd:
	$(OPENOCD) -f interface/stlink.cfg -f target/$(TARGET).cfg

flash: $(BINDIR)/$(APP)
	$(OPENOCD) -f interface/stlink.cfg -f target/$(TARGET).cfg -c "program $(BINDIR)/$(APP) verify reset exit"

clean:
	rm -rf $(OBJDIR) $(BINDIR)
Do not follow this link