reflow-oven-control-sw/Makefile

80 lines
2.2 KiB
Makefile
Raw Normal View History

2020-01-26 15:27:06 +01:00
################################Shimatta Makefile####################################
#CPU: STM32F407VET6
#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 = reflow-controller
LIBRARYPATH = -L. -Lmathlib
LIBRARIES = # -larm_cortexM4lf_math
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4
mapfile = qttemplate
##Custom Files###
#TODO
###################################################################################
CC=arm-none-eabi-gcc
OBJCOPY=arm-none-eabi-objcopy
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
LFLAGS += -Tstm32f407vet6_flash.ld -Wl,-Map=$(mapfile).map
CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
####################################################################################
OBJ = $(CFILES:%.c=%.o)
OBJ += $(ASFILES:%.S=%.o)
default: $(target).elf
%.bin: %.elf
$(OBJCOPY) -O binary $^ $@
%.hex: %.elf
$(OBJCOPY) -O ihex $^ $@
#Linking
$(target).elf: $(OBJ)
$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
#Compiling
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDEPATH) $(DEFINES) -o $@ $<
.PHONY: qtproject clean mrproper objcopy
objcopy: $(target).bin $(target).hex
mrproper:
rm -f $(target).pro
clean:
rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(mapfile).map
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