Automatisation avec make :
MCU = cortex-m0plus
MFREQ = 48000000
CC = arm-none-eabi-gcc
LD = arm-none-eabi-gcc
FLAGS = -mcpu=$(MCU) -mthumb
CFLAGS += -Wall --std=gnu99 -Os
CFLAGS += -fno-diagnostics-show-caret
CFLAGS += -fdata-sections -ffunction-sections
CFLAGS += -funsigned-char -funsigned-bitfields
CFLAGS += $(FLAGS) -DF_CPU=$(MFREQ) -I include
CFLAGS += -MD -MP
CFLAGS += -D__SAMD21G18A__ -DDONT_USE_CMSIS_INIT
LDFLAGS += $(FLAGS)
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--script=linker/samd21.ld
TARGET = blink
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)
all: $(TARGET)
clean:
rm -f *.o *.d $(TARGET).hex $(TARGET)
$(TARGET): $(OBJECTS)