Mario Hüttel
69c00ff3d3
* Add digio module for controlling LEDs, Loudspeaker, and the Digital IOs * General code improvements
113 lines
3.3 KiB
Makefile
113 lines
3.3 KiB
Makefile
################################Shimatta Makefile####################################
|
|
#CPU: STM32F407VET6
|
|
#Compiler: arm-none-eabi
|
|
#####################################################################################
|
|
#Add Files and Folders below#########################################################
|
|
CFILES = main.c syscalls.c cmsis_boot/system_stm32f4xx.c systick.c
|
|
ASFILES = boot/startup_stm32f4xx.S
|
|
INCLUDEPATH = -Icmsis -Iinclude
|
|
|
|
OBJDIR = obj
|
|
target = reflow-controller
|
|
LIBRARYPATH = -L. -Lmathlib
|
|
LIBRARIES = -larm_cortexM4lf_math
|
|
|
|
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4 -DHSE_VALUE=8000000UL
|
|
mapfile = memory-mapping
|
|
|
|
GIT_VER := $(shell git describe --always --dirty --tags)
|
|
DEFINES += -DGIT_VER=$(GIT_VER)
|
|
|
|
ifneq ($(VERBOSE),true)
|
|
QUIET=@
|
|
else
|
|
QUIET=
|
|
endif
|
|
|
|
##Custom Files###
|
|
CFILES += adc-meas.c
|
|
|
|
# Shellmatta
|
|
CFILES += shellmatta/src/shellmatta.c shellmatta/src/shellmatta_autocomplete.c shellmatta/src/shellmatta_escape.c shellmatta/src/shellmatta_history.c shellmatta/src/shellmatta_utils.c shell.c
|
|
INCLUDEPATH += -Ishellmatta/api
|
|
# DEFINES += -DSHELLMATTA_STRIP_PRINTF
|
|
|
|
# RCC Manager
|
|
CFILES += clock-enable-manager.c
|
|
|
|
CFILES += uart/uart.c uart/dma-ring-buffer.c
|
|
|
|
CFILES += digio.c
|
|
|
|
DEFINES += -DDEBUGBUILD
|
|
#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-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 -O0 -g
|
|
|
|
####################################################################################
|
|
|
|
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
|
ASOBJ += $(ASFILES:%.S=$(OBJDIR)/%.S.o)
|
|
|
|
default: $(target).elf
|
|
|
|
%.bin: %.elf
|
|
$(QUIET)$(OBJCOPY) -O binary $^ $@
|
|
%.hex: %.elf
|
|
$(QUIET)$(OBJCOPY) -O ihex $^ $@
|
|
|
|
|
|
#Linking
|
|
$(target).elf: $(OBJ) $(ASOBJ)
|
|
@echo [LD] $@
|
|
$(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
|
|
$(QUIET)$(SIZE) $@
|
|
|
|
#Compiling
|
|
$(OBJ):
|
|
@echo [CC] $@
|
|
$(eval OUTPATH=$(dir $@))
|
|
@mkdir -p $(OUTPATH)
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.c.o=%.c)
|
|
$(ASOBJ):
|
|
@echo [AS] $@
|
|
$(eval OUTPATH=$(dir $@))
|
|
@mkdir -p $(OUTPATH)
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S)
|
|
|
|
|
|
.PHONY: qtproject clean mrproper objcopy disassemble
|
|
|
|
disassemble: $(target).elf
|
|
$(QUIET)$(OBJDUMP) -D -s $< > $(target).lss
|
|
|
|
objcopy: $(target).bin $(target).hex
|
|
|
|
mrproper: clean
|
|
rm -f $(target).pro
|
|
|
|
clean:
|
|
rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(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
|
|
|
|
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|