-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (26 loc) · 913 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
34
35
36
37
CC=arm-none-eabi-gcc
MPU=cortex-m4
CFLAGS=-c -mcpu=$(MPU) -mthumb -mfloat-abi=soft -std=gnu11 -Wall -O0
LDFLAGS=-mcpu=$(MPU) -mthumb -mfloat-abi=soft -T stm32f407xx.ld -Wl,-Map=blink.map
LDFLAGS_NANO=$(LDFLAGS) --specs=nano.specs
LDFLAGS_SEMI=$(LDFLAGS) --specs=rdimon.specs
all: blink.o startup.o syscalls.o blink.elf
semi: blink.o startup.o syscalls.o blink_semi.elf
clean:
rm -Rf *.o *.elf *.map
startup.o: startup.c
$(CC) $(CFLAGS) -o $@ $^
blink.o: blink.c stm32f407xx.h
$(CC) $(CFLAGS) blink.c
syscalls.o: syscalls.c
$(CC) $(CFLAGS) -o $@ $^
blink.elf: blink.o startup.o syscalls.o
$(CC) $(LDFLAGS_NANO) -o $@ $^
blink_semi.elf: blink.o startup.o
$(CC) $(LDFLAGS_SEMI) -o $@ $^
dump: blink.elf
arm-none-eabi-objdump -h $^
flash:
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg -c "program blink.elf verify reset exit"
debug:
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg