CPU = cortex-m4 MCU = MK20DX256 MK20DX256 = ../mk20dx256 # Change this to suit TARGET_ARCH = -mcpu=$(CPU) -mthumb AS = arm-none-eabi-as CC = arm-none-eabi-gcc OBJCOPY = arm-none-eabi-objcopy WARNINGS = -Wpointer-arith -Wcast-align -Wformat=2 \ -Wsuggest-attribute=format -Wall \ -Wextra -Wpedantic -Winit-self -Wshadow -Wcast-qual \ -Wstrict-prototypes -Wmissing-prototypes CPPFLAGS = -Ilib CFLAGS = -std=c11 $(WARNINGS) -O2 -flto -MMD -MP -ffreestanding -nostdlib LDFLAGS = -T layout.ld -O2 -flto -ffreestanding -nostdlib ASFLAGS = $(TARGET_ARCH) OBJ := crt0.o vectors.o flashconf.o setup.o fmk.o lib/le.o usb/usb.o \ usb/endpt0.o usb/endpt1.o uart.o include $(MK20DX256)/mk20dx256.mk CPPFLAGS += $(mk20dx256_CPPFLAGS) %.bin: % $(OBJCOPY) -O binary $< $@ debug: all debug: CFLAGS += -Og -ggdb debug: LDFLAGS += -Og -ggdb all: fmk.bin fmk: $(OBJ) flash: fmk.bin hktool -f $< -r $(MCU) clean: $(RM) $(OBJ) $(OBJ:.o=.d) fmk fmk.bin -include $(OBJ:.o=.d) .PHONY: all flash clean