################################Shimatta Makefile#################################### #CPU: STM32F030F4P6 #Compiler: arm-none-eabi ##################################################################################### ifneq ($(VERBOSE),true) QUIET=@ else QUIET= endif #Add Files and Folders below######################################################### CFILES := main.c setup/system_init.c startup/startup_stm32f0xx.c systick.c CFILES += i2c.c CFILES += dmx.c CFILES += poti.c CFILES += gamma.c CFILES += pca9555.c CFILES += animation.c ASFILES = INCLUDEPATH = -Iinclude -Iinclude/cmsis OBJDIR=obj target = remote LIBRARYPATH = -Lstartup LIBRARIES = DEFINES = -DSTM32F030x6 -DSTM32F0XX mapfile = memmap ##Custom Files### #TODO ################################################################################### CROSS_COMPILE ?= arm-none-eabi- CC := $(CROSS_COMPILE)gcc OBJCOPY := $(CROSS_COMPILE)objcopy OBJDUMP := $(CROSS_COMPILE)objdump SIZE := $(CROSS_COMPILE)size LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m0 LFLAGS += -mfloat-abi=soft --disable-newlib-supplied-syscalls -nostartfiles LFLAGS += -Tstartup/stm32f030.ld -Wl,-Map=$(mapfile).map -Wl,--gc-sections -Wl,--print-memory-usage -g CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m0 CFLAGS += -mfloat-abi=soft -nostartfiles -Wall -Wextra -g3 -O0 #################################################################################### OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o) ASOBJ = $(ASFILES:%.S=$(OBJDIR)/%.S.o) default: $(target).elf %.bin: %.elf $(OBJCOPY) -O binary $^ $@ %.hex: %.elf $(OBJCOPY) -O ihex $^ $@ #Linking $(target).elf: $(OBJ) $(ASOBJ) @echo Linking $@ $(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES) $(QUIET)$(SIZE) $@ #Compiling $(OBJ): @echo [CC] $@ @mkdir -p $(@D) $(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.c.o=%.c) $(ASOBJ): @echo [AS] $@ @mkdir -p $(@D) $(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S) .PHONY: clean mrproper objcopy disassemble binary disassemble: $(target).elf $(OBJDUMP) -D -s $< > $(target).lss objcopy: $(target).bin $(target).hex mrproper: rm -f $(target).pro binary: $(target).bin $(target).hex clean: @echo [CLEAN] $(OBJDIR) @rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(target).lss @rm -rf $(OBJDIR)/* -include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)