-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (21 loc) · 595 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
31
32
33
NAME = led_blinker
PART = STM32WB55xx
OBJECTS = main.o startup.o
vpath %.c common $(NAME)
CC = arm-none-eabi-gcc
LD = arm-none-eabi-ld
OBJCOPY = arm-none-eabi-objcopy
CFLAGS = -Wall -Os -mthumb -march=armv7-m -mtune=cortex-m4 \
-fdata-sections -ffunction-sections -D$(PART) -ICMSIS
LDFLAGS = --script ldscript.ld --gc-sections
all: $(NAME).bin
install: $(NAME).elf
openocd -f openocd.cfg -c "program $< verify reset exit"
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
%.elf: $(OBJECTS)
$(LD) $(LDFLAGS) $^ -o $@
%.bin: %.elf
$(OBJCOPY) -O binary -S $< $@
clean:
rm -rf *.o *.elf *.bin