Skip to content
Makefile 823 B
Newer Older
nats's avatar
nats committed
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)