Newer
Older
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
LDSCRIPT = asf/flash.ld
BOOTUP = asf/startup_same70.o asf/system_same70.o
MCUTYPE=__SAME70Q21B__
OBJS=$(BOOTUP) template.o
# Tools
CC=arm-none-eabi-gcc
LD=arm-none-eabi-gcc
AR=arm-none-eabi-ar
AS=arm-none-eabi-as
ELF=template.elf
LDFLAGS+= -T$(LDSCRIPT) -mthumb -mcpu=cortex-m7 -Wl,--gc-sections
CFLAGS+= -mcpu=cortex-m7 -mthumb -g -Og
CFLAGS+= -I asf -I asf/include -I asf/cmsis -I .
CFLAGS+= -D$(MCUTYPE)
$(ELF): $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
# compile and generate dependency info
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
$(CC) -MM $(CFLAGS) $< > $*.d
%.o: %.s
$(AS) $< -o $@
clean:
rm -f $(OBJS) $(OBJS:.o=.d) $(ELF) startup_stm32f* $(CLEANOTHER)
debug: $(ELF)
arm-none-eabi-gdb -iex "target extended-remote localhost:3333" $(ELF)
# pull in dependencies
-include $(OBJS:.o=.d)