2017-10-31 16:22:22 +01:00
|
|
|
################################Shimatta Makefile####################################
|
|
|
|
#CPU: STM32F407VGT6
|
|
|
|
#Compiler: arm-none-eabi
|
|
|
|
#####################################################################################
|
|
|
|
#Add Files and Folders below#########################################################
|
|
|
|
CFILES = main.c syscalls/syscalls.c uart/uart.c startup/system_stm32f4xx.c
|
2017-10-31 17:04:38 +01:00
|
|
|
ASFILES = boot/startup_stm32f4xx.S hardfault/hardfault_prehandler.S
|
2017-10-31 16:22:22 +01:00
|
|
|
INCLUDEPATH = -Iinclude
|
|
|
|
|
|
|
|
|
|
|
|
target = stm32f4sdio
|
|
|
|
LIBRARYPATH = -L. -Lmathlib
|
|
|
|
LIBRARIES = -larm_cortexM4lf_math
|
|
|
|
|
|
|
|
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4
|
|
|
|
mapfile = dafuqishappening
|
|
|
|
|
|
|
|
##Custom Files###
|
2018-11-07 17:18:24 +01:00
|
|
|
ifneq ($(VERBOSE),true)
|
|
|
|
QUIET=@
|
|
|
|
else
|
|
|
|
QUIET=
|
|
|
|
endif
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
CFILES += fatfs/option/syscall.c fatfs/option/ccsbcs.c fatfs/diskio.c fatfs/ff.c fatfs/shimatta_sdio_driver/shimatta_sdio.c
|
|
|
|
|
|
|
|
###################################################################################
|
|
|
|
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-m4 -mthumb-interwork
|
|
|
|
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
|
|
|
LFLAGS += -Tstm32f407vgt6_flash.ld -Wl,-Map=$(mapfile).map -Wl,--gc-sections
|
|
|
|
|
|
|
|
CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
2017-10-31 17:04:38 +01:00
|
|
|
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -Wall -O0 -g3
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
####################################################################################
|
|
|
|
|
2018-11-07 17:18:24 +01:00
|
|
|
OBJ = $(CFILES:%.c=%.o)
|
|
|
|
ASOBJ = $(ASFILES:%.S=%.o)
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
default: $(target).elf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%.bin: %.elf
|
2018-11-07 17:18:24 +01:00
|
|
|
$(QUIET)$(OBJCOPY) -O binary $^ $@
|
2017-10-31 16:22:22 +01:00
|
|
|
%.hex: %.elf
|
2018-11-07 17:18:24 +01:00
|
|
|
$(QUIET)$(OBJCOPY) -O ihex $^ $@
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
#Linking
|
|
|
|
$(target).elf: $(OBJ) $(ASOBJ)
|
2018-11-07 17:18:24 +01:00
|
|
|
@echo !!! Calling linker $@
|
|
|
|
$(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
|
|
|
|
$(QUIET)$(SIZE) $@
|
|
|
|
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
#Compiling
|
2018-11-07 17:18:24 +01:00
|
|
|
$(OBJ):
|
|
|
|
@echo !!! Calling Compiler $@
|
|
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:%.o=%.c)
|
2017-10-31 16:22:22 +01:00
|
|
|
|
2018-11-07 17:18:24 +01:00
|
|
|
$(ASOBJ):
|
|
|
|
@echo !!! Calling Assembler $@
|
|
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:%.o=%.S)
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
.PHONY: qtproject clean mrproper objcopy disassemble
|
|
|
|
|
|
|
|
disassemble: $(target).elf
|
2018-11-07 17:18:24 +01:00
|
|
|
$(QUIET)$(OBJDUMP) -D -s $< > $(target).lss
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
objcopy: $(target).bin $(target).hex
|
|
|
|
|
|
|
|
mrproper:
|
2018-11-07 17:18:24 +01:00
|
|
|
$(QUIET)rm -f $(target).pro
|
2017-10-31 16:22:22 +01:00
|
|
|
|
|
|
|
clean:
|
2018-11-07 17:18:24 +01:00
|
|
|
@echo cleaning up
|
|
|
|
$(QUIET)rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(target).lss $(CFILES:%.c=%.d) $(ASFILES:%.S=%.d)
|
2017-10-31 16:22:22 +01:00
|
|
|
qtproject:
|
|
|
|
echo -e "TEMPLATE = app\nCONFIG -= console app_bundle qt" > $(target).pro
|
|
|
|
echo -e "SOURCES += $(CFILES) $(ASFILES)" >> $(target).pro
|
|
|
|
echo -ne "INCLUDEPATH += " >> $(target).pro
|
|
|
|
echo "$(INCLUDEPATH)" | sed "s!-I!./!g" >> $(target).pro
|
|
|
|
echo -ne "HEADERS += " >> $(target).pro
|
|
|
|
find -name "*.h" | tr "\\n" " " >> $(target).pro
|
|
|
|
echo -ne "\nDEFINES += " >> $(target).pro
|
|
|
|
echo "$(DEFINES)" | sed "s/-D//g" >> $(target).pro
|
|
|
|
|
2018-11-07 17:18:24 +01:00
|
|
|
-include $(CFILES:%.c=%.d) $(ASFILES:%.S=%.d)
|
2017-10-31 16:22:22 +01:00
|
|
|
|