2020-01-26 15:27:06 +01:00
|
|
|
################################Shimatta Makefile####################################
|
|
|
|
#CPU: STM32F407VET6
|
|
|
|
#Compiler: arm-none-eabi
|
|
|
|
#####################################################################################
|
|
|
|
#Add Files and Folders below#########################################################
|
2020-02-12 21:00:35 +01:00
|
|
|
CFILES = main.c syscalls.c setup/system_stm32f4xx.c systick.c
|
2020-01-26 15:27:06 +01:00
|
|
|
ASFILES = boot/startup_stm32f4xx.S
|
2020-02-02 00:01:08 +01:00
|
|
|
INCLUDEPATH = -Icmsis -Iinclude
|
2020-01-26 15:27:06 +01:00
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
OBJDIR = obj
|
2020-01-26 15:27:06 +01:00
|
|
|
target = reflow-controller
|
|
|
|
LIBRARYPATH = -L. -Lmathlib
|
2020-02-15 01:04:40 +01:00
|
|
|
LIBRARIES = -larm_cortexM4lf_math -lm
|
2020-01-26 15:27:06 +01:00
|
|
|
|
2020-02-02 00:01:08 +01:00
|
|
|
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4 -DHSE_VALUE=8000000UL
|
2020-01-26 21:07:54 +01:00
|
|
|
mapfile = memory-mapping
|
|
|
|
|
2020-02-09 19:13:37 +01:00
|
|
|
GIT_VER := $(shell git describe --always --dirty --tags)
|
|
|
|
DEFINES += -DGIT_VER=$(GIT_VER)
|
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
ifneq ($(VERBOSE),true)
|
|
|
|
QUIET=@
|
|
|
|
else
|
|
|
|
QUIET=
|
|
|
|
endif
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
##Custom Files###
|
2020-02-02 01:49:37 +01:00
|
|
|
CFILES += adc-meas.c
|
2020-02-02 20:54:09 +01:00
|
|
|
|
2020-02-03 19:19:31 +01:00
|
|
|
# Shellmatta
|
2020-02-09 19:13:37 +01:00
|
|
|
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
|
2020-02-02 20:54:09 +01:00
|
|
|
INCLUDEPATH += -Ishellmatta/api
|
2020-02-09 19:13:37 +01:00
|
|
|
# DEFINES += -DSHELLMATTA_STRIP_PRINTF
|
2020-02-02 20:54:09 +01:00
|
|
|
|
2020-02-03 19:19:31 +01:00
|
|
|
# RCC Manager
|
2020-02-12 21:06:28 +01:00
|
|
|
CFILES += stm-periph/clock-enable-manager.c
|
2020-02-03 19:19:31 +01:00
|
|
|
|
2020-02-12 21:06:28 +01:00
|
|
|
CFILES += stm-periph/uart.c stm-periph/dma-ring-buffer.c
|
2020-02-10 22:38:24 +01:00
|
|
|
|
|
|
|
CFILES += digio.c
|
|
|
|
|
2020-02-12 22:24:17 +01:00
|
|
|
CFILES += stm-periph/unique-id.c
|
|
|
|
|
2020-02-15 01:04:40 +01:00
|
|
|
CFILES += calibration.c
|
|
|
|
|
2020-02-15 20:31:38 +01:00
|
|
|
CFILES += temp-converter.c
|
|
|
|
|
2020-02-16 14:25:49 +01:00
|
|
|
CFILES += rotary-encoder.c
|
|
|
|
|
2020-02-10 22:38:24 +01:00
|
|
|
DEFINES += -DDEBUGBUILD
|
2020-01-26 15:27:06 +01:00
|
|
|
#TODO
|
|
|
|
|
|
|
|
###################################################################################
|
|
|
|
CC=arm-none-eabi-gcc
|
|
|
|
OBJCOPY=arm-none-eabi-objcopy
|
2020-01-26 21:07:54 +01:00
|
|
|
OBJDUMP=arm-none-eabi-objdump
|
|
|
|
SIZE=arm-none-eabi-size
|
2020-01-26 15:27:06 +01:00
|
|
|
|
2020-02-02 02:00:42 +01:00
|
|
|
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
2020-01-26 15:27:06 +01:00
|
|
|
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
|
2020-01-26 21:07:54 +01:00
|
|
|
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -O0 -g
|
2020-02-15 21:06:45 +01:00
|
|
|
CFLAGS += -Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter -Wimplicit-fallthrough=3 -Wsign-compare
|
2020-01-26 15:27:06 +01:00
|
|
|
####################################################################################
|
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
|
|
|
ASOBJ += $(ASFILES:%.S=$(OBJDIR)/%.S.o)
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
default: $(target).elf
|
|
|
|
|
|
|
|
%.bin: %.elf
|
2020-01-26 21:07:54 +01:00
|
|
|
$(QUIET)$(OBJCOPY) -O binary $^ $@
|
2020-01-26 15:27:06 +01:00
|
|
|
%.hex: %.elf
|
2020-01-26 21:07:54 +01:00
|
|
|
$(QUIET)$(OBJCOPY) -O ihex $^ $@
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
#Linking
|
2020-01-26 21:07:54 +01:00
|
|
|
$(target).elf: $(OBJ) $(ASOBJ)
|
|
|
|
@echo [LD] $@
|
|
|
|
$(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
|
|
|
|
$(QUIET)$(SIZE) $@
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
#Compiling
|
2020-01-26 21:07:54 +01:00
|
|
|
$(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)
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
.PHONY: qtproject clean mrproper objcopy disassemble
|
|
|
|
|
|
|
|
disassemble: $(target).elf
|
|
|
|
$(QUIET)$(OBJDUMP) -D -s $< > $(target).lss
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
objcopy: $(target).bin $(target).hex
|
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
mrproper: clean
|
2020-01-26 15:27:06 +01:00
|
|
|
rm -f $(target).pro
|
|
|
|
|
|
|
|
clean:
|
2020-02-12 21:06:28 +01:00
|
|
|
rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
2020-01-26 15:27:06 +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
|
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|