stm32f4-sdio/Makefile

89 lines
2.6 KiB
Makefile
Raw Normal View History

################################Shimatta Makefile####################################
#CPU: STM32F407VGT6
#Compiler: arm-none-eabi
#####################################################################################
#Add Files and Folders below#########################################################
CFILES = main.c syscalls.c UART/uart.c cmsis_boot/system_stm32f4xx.c
ASFILES = boot/startup_stm32f4xx.S
INCLUDEPATH = -Iboot -Imathlib -Icmsis -Icmsis_boot -IUART
target = stm32f4sdio
LIBRARYPATH = -L. -Lmathlib
LIBRARIES = -larm_cortexM4lf_math
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4
2016-01-10 20:51:59 +01:00
mapfile = dafuqishappening
##Custom Files###
#TODO
CFILES += FATFS/option/syscall.c FATFS/option/ccsbcs.c FATFS/diskio.c FATFS/ff.c FATFS/shimatta_sdio_driver/shimatta_sdio-driver.c
INCLUDEPATH += -IFATFS -IFATFS/shimatta_sdio_driver
###################################################################################
CC=arm-none-eabi-gcc
OBJCOPY=arm-none-eabi-objcopy
2015-12-08 21:31:41 +01:00
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
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
####################################################################################
2016-08-24 21:15:51 +02:00
OBJ = $(CFILES:%.c=%.c.o)
ASOBJ = $(ASFILES:%.S=%.S.o)
default: $(target).elf
%.bin: %.elf
$(OBJCOPY) -O binary $^ $@
%.hex: %.elf
$(OBJCOPY) -O ihex $^ $@
#Linking
2016-08-24 21:15:51 +02:00
$(target).elf: $(OBJ) $(ASOBJ)
$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
$(SIZE) $@
#Compiling
2016-08-24 21:15:51 +02:00
%.c.o: %.c
$(CC) $(CFLAGS) $(INCLUDEPATH) $(DEFINES) -o $@ $<
2016-08-24 21:15:51 +02:00
%.S.o: %.S
$(CC) $(CFLAGS) $(INCLUDEPATH) $(DEFINES) -o $@ $<
2015-12-08 21:31:41 +01:00
.PHONY: qtproject clean mrproper objcopy disassemble
disassemble: $(target).elf
$(OBJDUMP) -D -s $< > $(target).lss
objcopy: $(target).bin $(target).hex
mrproper:
rm -f $(target).pro
clean:
2016-08-24 21:15:51 +02:00
rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(target).lss
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