2023-01-17 21:26:02 +01:00
|
|
|
################################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_stm32l0xx.c
|
|
|
|
|
|
|
|
|
|
|
|
ASFILES =
|
2023-01-17 23:00:21 +01:00
|
|
|
INCLUDEPATH = -Iinclude
|
2023-01-17 21:26:02 +01:00
|
|
|
|
|
|
|
OBJDIR=obj
|
|
|
|
target = remote
|
|
|
|
LIBRARYPATH = -Lstartup
|
|
|
|
LIBRARIES =
|
|
|
|
|
|
|
|
DEFINES = -DSTM32L010x4 -DSTM32L0XX
|
|
|
|
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-m0plus
|
|
|
|
LFLAGS += -mfloat-abi=soft --disable-newlib-supplied-syscalls -nostartfiles
|
|
|
|
LFLAGS += -Tstartup/stm32l010x4.ld -Wl,-Map=$(mapfile).map -Wl,--gc-sections -Wl,--print-memory-usage -g
|
|
|
|
|
|
|
|
CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m0plus
|
|
|
|
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 [LD] $@
|
|
|
|
$(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)
|
|
|
|
|