2017-07-02 18:38:29 +02:00
|
|
|
################################Shimatta Makefile####################################
|
|
|
|
#CPU: STM32F746ZGT
|
|
|
|
#Compiler: arm-none-eabi
|
|
|
|
#####################################################################################
|
|
|
|
#Add Files and Folders below#########################################################
|
|
|
|
CFILES = main.c syscalls/syscalls.c setup/system_init.c startup/startup_stm32f746.c
|
|
|
|
ASFILES =
|
|
|
|
INCLUDEPATH = -Iinclude
|
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
OBJDIR := obj
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
TARGET = project
|
2017-07-02 18:38:29 +02:00
|
|
|
LIBRARYPATH = -Lstartup -Ldsp
|
|
|
|
LIBRARIES = -larm_cortexM7lfsp_math
|
|
|
|
|
|
|
|
DEFINES = -DSTM32F746xx -DSTM32F7XX -DARM_MATH_CM7
|
|
|
|
mapfile = memmap
|
|
|
|
|
|
|
|
##Custom Files###
|
|
|
|
|
|
|
|
#TODO
|
|
|
|
|
|
|
|
|
|
|
|
###################################################################################
|
|
|
|
CC=arm-none-eabi-gcc
|
|
|
|
OBJCOPY=arm-none-eabi-objcopy
|
|
|
|
OBJDUMP=arm-none-eabi-objdump
|
|
|
|
SIZE=arm-none-eabi-size
|
|
|
|
|
|
|
|
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m7 -mthumb-interwork
|
|
|
|
LFLAGS += -mfloat-abi=hard -mfpu=fpv5-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
|
|
|
LFLAGS += -Tstm32f746zgt-axim.ld -Wl,-Map=$(mapfile).map -Wl,--gc-sections
|
2022-08-01 23:44:55 +02:00
|
|
|
LFLAGS += -Wl,--print-memory-usage
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
CFLAGS = -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m7 -mthumb-interwork
|
2017-07-02 18:38:29 +02:00
|
|
|
CFLAGS += -mfloat-abi=hard -mfpu=fpv5-sp-d16 -nostartfiles -Wall
|
|
|
|
|
|
|
|
####################################################################################
|
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
|
|
|
ASOBJ = $(ASFILES:%.S=$(OBJDIR)/%.S.o)
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
DEPENDENCY_FILES = $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
default: $(TARGET).elf
|
2017-07-02 18:38:29 +02:00
|
|
|
|
|
|
|
%.bin: %.elf
|
|
|
|
$(OBJCOPY) -O binary $^ $@
|
|
|
|
%.hex: %.elf
|
|
|
|
$(OBJCOPY) -O ihex $^ $@
|
|
|
|
|
|
|
|
|
|
|
|
#Linking
|
2022-08-01 23:44:55 +02:00
|
|
|
$(TARGET).elf: $(OBJ) $(ASOBJ)
|
|
|
|
@$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
|
2022-08-01 23:47:40 +02:00
|
|
|
@$(SIZE) $@
|
2017-07-02 18:38:29 +02:00
|
|
|
|
|
|
|
#Compiling
|
2022-08-01 23:44:55 +02:00
|
|
|
$(OBJ):
|
|
|
|
@echo [CC] $@
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
@$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ -c $(@:$(OBJDIR)/%.c.o=%.c)
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
$(ASOBJ):
|
|
|
|
@echo [AS] $@
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
@$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ -c $(@:$(OBJDIR)/%.S.o=%.S)
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
.PHONY: clean mrproper objcopy disassemble
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
disassemble: $(TARGET).elf
|
|
|
|
$(OBJDUMP) -D -s $< > $(TARGET).lss
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
objcopy: $(TARGET).bin $(TARGET).hex
|
2017-07-02 18:38:29 +02:00
|
|
|
|
|
|
|
mrproper:
|
2022-08-01 23:44:55 +02:00
|
|
|
rm -f $(TARGET).pro
|
2017-07-02 18:38:29 +02:00
|
|
|
|
|
|
|
clean:
|
2022-08-01 23:44:55 +02:00
|
|
|
@echo [RM] in $(OBJDIR)
|
|
|
|
@rm -f $(TARGET).elf $(TARGET).bin $(TARGET).hex $(OBJ) $(ASOBJ) $(mapfile).map $(TARGET).lss $(DEPENDENCY_FILES)
|
|
|
|
@rm -rf $(OBJDIR)/*
|
2017-07-02 18:38:29 +02:00
|
|
|
|
2022-08-01 23:44:55 +02:00
|
|
|
# Include dependency files, if available
|
|
|
|
-include $(DEPENDENCY_FILES)
|