2021-03-12 18:53:53 +01:00
|
|
|
################################Shimatta Makefile####################################
|
2022-08-02 14:32:30 +02:00
|
|
|
#CPU: STM32F030F4P6
|
2021-03-12 18:53:53 +01:00
|
|
|
#Compiler: arm-none-eabi
|
|
|
|
#####################################################################################
|
|
|
|
|
|
|
|
ifneq ($(VERBOSE),true)
|
|
|
|
QUIET=@
|
|
|
|
else
|
|
|
|
QUIET=
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
#Add Files and Folders below#########################################################
|
|
|
|
CFILES = main.c syscalls/syscalls.c setup/system_init.c startup/startup_stm32f0xx.c
|
2021-04-03 22:48:53 +02:00
|
|
|
CFILES += temp-adc.c
|
2022-06-21 20:33:23 +02:00
|
|
|
CFILES += dmx.c
|
2021-03-12 22:28:00 +01:00
|
|
|
ASFILES = sk6812.S
|
2021-03-12 18:53:53 +01:00
|
|
|
INCLUDEPATH = -Iinclude -Iinclude/cmsis
|
|
|
|
|
|
|
|
OBJDIR=obj
|
|
|
|
target = project
|
|
|
|
LIBRARYPATH = -Lstartup
|
|
|
|
LIBRARIES =
|
|
|
|
|
|
|
|
DEFINES = -DSTM32F030x6 -DSTM32F0XX
|
|
|
|
mapfile = memmap
|
|
|
|
|
|
|
|
##Custom Files###
|
|
|
|
|
|
|
|
#TODO
|
|
|
|
|
|
|
|
|
|
|
|
###################################################################################
|
2022-08-02 14:32:30 +02:00
|
|
|
CROSS_COMPILE ?= arm-none-eabi-
|
|
|
|
CC := $(CROSS_COMPILE)gcc
|
|
|
|
OBJCOPY := $(CROSS_COMPILE)objcopy
|
|
|
|
OBJDUMP := $(CROSS_COMPILE)objdump
|
|
|
|
SIZE := $(CROSS_COMPILE)size
|
2021-03-12 18:53:53 +01:00
|
|
|
|
|
|
|
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m0 -mthumb-interwork
|
|
|
|
LFLAGS += -mfloat-abi=soft --disable-newlib-supplied-syscalls -nostartfiles
|
2022-06-21 20:57:56 +02:00
|
|
|
LFLAGS += -Tstartup/stm32f030.ld -Wl,-Map=$(mapfile).map -Wl,--gc-sections -Wl,--print-memory-usage -g
|
2021-03-12 18:53:53 +01:00
|
|
|
|
|
|
|
CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m0 -mthumb-interwork
|
2021-04-03 22:48:53 +02:00
|
|
|
CFLAGS += -mfloat-abi=soft -nostartfiles -Wall -g3 -O0
|
2021-03-12 18:53:53 +01:00
|
|
|
|
|
|
|
####################################################################################
|
|
|
|
|
|
|
|
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):
|
2022-08-02 14:32:30 +02:00
|
|
|
@echo [CC] $@
|
|
|
|
@mkdir -p $(@D)
|
2021-03-12 18:53:53 +01:00
|
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.c.o=%.c)
|
|
|
|
|
|
|
|
$(ASOBJ):
|
2022-08-02 14:32:30 +02:00
|
|
|
@echo [AS] $@
|
|
|
|
@mkdir -p $(@D)
|
2021-03-12 18:53:53 +01:00
|
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S)
|
|
|
|
|
2022-08-02 14:32:30 +02:00
|
|
|
.PHONY: clean mrproper objcopy disassemble binary
|
2021-03-12 18:53:53 +01:00
|
|
|
|
|
|
|
disassemble: $(target).elf
|
|
|
|
$(OBJDUMP) -D -s $< > $(target).lss
|
|
|
|
|
|
|
|
objcopy: $(target).bin $(target).hex
|
|
|
|
|
|
|
|
mrproper:
|
|
|
|
rm -f $(target).pro
|
|
|
|
|
2022-08-02 14:32:30 +02:00
|
|
|
binary: $(target).bin $(target).hex
|
|
|
|
|
2021-03-12 18:53:53 +01:00
|
|
|
clean:
|
2022-08-02 14:32:30 +02:00
|
|
|
@echo [CLEAN] $(OBJDIR)
|
|
|
|
@rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(target).lss
|
|
|
|
@rm -rf $(OBJDIR)/*
|
2021-03-12 18:53:53 +01:00
|
|
|
|
|
|
|
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
|
|
|
|