2020-01-26 15:27:06 +01:00
|
|
|
################################Shimatta Makefile####################################
|
|
|
|
#CPU: STM32F407VET6
|
|
|
|
#Compiler: arm-none-eabi
|
|
|
|
#####################################################################################
|
|
|
|
#Add Files and Folders below#########################################################
|
2020-08-21 23:25:03 +02:00
|
|
|
CFILES = main.c syscalls.c setup/system_stm32f4xx.c systick.c boot/startup_stm32f407vx.c
|
|
|
|
ASFILES =
|
2020-06-09 21:50:37 +02:00
|
|
|
INCLUDEPATH = -Iinclude
|
2020-01-26 15:27:06 +01:00
|
|
|
|
2020-06-15 21:22:05 +02:00
|
|
|
OBJDIR_BASE = obj
|
|
|
|
TARGET_BASE = reflow-controller
|
2020-11-01 20:59:17 +01:00
|
|
|
LIBRARYPATH = -L.
|
|
|
|
LIBRARIES =
|
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-06-15 21:48:37 +02:00
|
|
|
MAPFILE_BASE = memory-mapping
|
2020-08-29 08:52:44 +02:00
|
|
|
LINKER_SCRIPT=stm32f407vet6_flash.ld
|
2020-01-26 21:07:54 +01:00
|
|
|
|
2020-02-16 16:52:21 +01:00
|
|
|
export GIT_VER = $(shell git describe --always --dirty --tags)
|
2020-02-09 19:13:37 +01:00
|
|
|
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-04-11 00:54:17 +02: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 shellmatta/src/shellmatta_opt.c shell.c
|
2020-02-02 20:54:09 +01:00
|
|
|
INCLUDEPATH += -Ishellmatta/api
|
2020-04-20 01:19:37 +02:00
|
|
|
DEFINES += -DSHELLMATTA_HELP_ALIAS=\"?\"
|
2020-02-02 20:54:09 +01:00
|
|
|
|
2020-02-03 19:19:31 +01:00
|
|
|
# RCC Manager
|
2020-12-01 21:00:23 +01:00
|
|
|
CFILES += stm-periph/rcc-manager.c
|
2020-08-23 21:40:16 +02:00
|
|
|
CFILES += stm-periph/uart.c stm-periph/dma-ring-buffer.c stm-periph/backup-ram.c
|
2020-09-07 20:47:56 +02:00
|
|
|
CFILES += stm-periph/rng.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-23 21:06:42 +01:00
|
|
|
CFILES += rotary-encoder.c button.c
|
2020-11-29 19:01:24 +01:00
|
|
|
CFILES += ui/lcd.c ui/menu.c ui/gui.c
|
2020-02-25 20:05:48 +01:00
|
|
|
CFILES += fatfs/diskio.c fatfs/ff.c fatfs/ffsystem.c fatfs/ffunicode.c fatfs/shimatta_sdio_driver/shimatta_sdio.c
|
2020-04-20 21:16:39 +02:00
|
|
|
CFILES += pid-controller.c oven-driver.c
|
2020-04-26 21:23:25 +02:00
|
|
|
CFILES += settings/settings.c settings/settings-sd-card.c
|
2020-09-05 12:17:16 +02:00
|
|
|
CFILES += stm-periph/crc-unit.c
|
2020-09-07 21:56:04 +02:00
|
|
|
CFILES += safety/safety-adc.c safety/safety-controller.c safety/watchdog.c safety/fault.c safety/safety-memory.c safety/stack-check.c
|
2020-11-29 19:02:30 +01:00
|
|
|
CFILES += hw-version-detect.c
|
2020-10-30 22:21:31 +01:00
|
|
|
CFILES += config-parser/config-parser.c
|
|
|
|
INCLUDEPATH += -Iconfig-parser/include
|
2020-04-20 21:16:39 +02:00
|
|
|
|
2020-11-01 18:03:52 +01:00
|
|
|
CFILES += base64-lib/src/base64-lib.c
|
|
|
|
INCLUDEPATH += -Ibase64-lib/include
|
2020-11-01 20:43:59 +01:00
|
|
|
DEFINES += -DBASE64_LOOKUP_TABLE_SECTION="\".ccm.bss\""
|
|
|
|
|
2020-11-01 18:03:52 +01:00
|
|
|
|
2020-06-15 21:22:05 +02:00
|
|
|
DEBUG_DEFINES = -DDEBUGBUILD
|
2020-11-01 21:22:28 +01:00
|
|
|
RELEASE_DEFINES = -DUART_ON_DEBUG_HEADER
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
###################################################################################
|
2020-06-15 21:22:05 +02:00
|
|
|
ifeq ($(CROSS_COMPILE),)
|
|
|
|
CROSS_COMPILE=arm-none-eabi-
|
|
|
|
endif
|
|
|
|
|
|
|
|
CC=$(CROSS_COMPILE)gcc
|
|
|
|
OBJCOPY=$(CROSS_COMPILE)objcopy
|
|
|
|
OBJDUMP=$(CROSS_COMPILE)objdump
|
|
|
|
SIZE=$(CROSS_COMPILE)size
|
2020-01-26 15:27:06 +01:00
|
|
|
|
2020-06-15 21:22:05 +02:00
|
|
|
CFLAGS_RELEASE = -O3 -g
|
|
|
|
CFLAGS_DEBUG = -O0 -g
|
|
|
|
|
2020-06-15 21:24:27 +02:00
|
|
|
LFLAGS_RELEASE = -Wl,--gc-sections
|
|
|
|
LFLAGS_DEBUG =
|
2020-06-15 21:22:05 +02:00
|
|
|
|
2020-06-15 21:48:37 +02:00
|
|
|
CFLAGS =
|
|
|
|
LFLAGS =
|
|
|
|
|
2020-06-15 21:22:05 +02:00
|
|
|
ifneq ($(DEBUGBUILD),true)
|
|
|
|
DEFINES += $(RELEASE_DEFINES)
|
|
|
|
CFLAGS += $(CFLAGS_RELEASE)
|
|
|
|
LFLAGS += $(LFLAGS_RELEASE)
|
2020-06-15 21:24:27 +02:00
|
|
|
target = $(TARGET_BASE)-release
|
2020-06-15 21:22:05 +02:00
|
|
|
OBJDIR = $(OBJDIR_BASE)/release
|
2020-06-15 21:48:37 +02:00
|
|
|
MAPFILE = $(MAPFILE_BASE)-release
|
2020-06-15 21:22:05 +02:00
|
|
|
else
|
|
|
|
DEFINES += $(DEBUG_DEFINES)
|
|
|
|
target = $(TARGET_BASE)-debug
|
|
|
|
CFLAGS += $(CFLAGS_DEBUG)
|
|
|
|
LFLAGS += $(LFLAGS_DEBUG)
|
|
|
|
OBJDIR = $(OBJDIR_BASE)/debug
|
2020-06-15 21:48:37 +02:00
|
|
|
MAPFILE = $(MAPFILE_BASE)-debug
|
2020-06-15 21:22:05 +02:00
|
|
|
endif
|
|
|
|
|
2020-06-15 21:48:37 +02:00
|
|
|
LFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
|
|
|
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
2020-08-18 20:23:44 +02:00
|
|
|
LFLAGS += -T$(LINKER_SCRIPT) -Wl,-Map=$(MAPFILE).map -Wl,--print-memory-usage
|
2020-06-15 21:48:37 +02:00
|
|
|
|
|
|
|
CFLAGS += -c -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
|
|
|
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
|
|
|
|
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
|
|
|
|
|
2020-06-15 21:22:05 +02:00
|
|
|
all: debug release
|
|
|
|
|
|
|
|
release:
|
|
|
|
$(QUIET)$(MAKE) DEBUGBUILD=false
|
|
|
|
|
|
|
|
debug:
|
|
|
|
$(QUIET)$(MAKE) DEBUGBUILD=true
|
|
|
|
|
2020-01-26 15:27:06 +01:00
|
|
|
%.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-08-18 20:23:44 +02:00
|
|
|
$(target).elf: $(OBJ) $(ASOBJ) $(LINKER_SCRIPT)
|
2020-01-26 21:07:54 +01:00
|
|
|
@echo [LD] $@
|
2020-08-18 20:23:44 +02:00
|
|
|
$(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $(OBJ) $(ASOBJ) $(LIBRARIES)
|
2020-01-26 21:07:54 +01:00
|
|
|
$(QUIET)$(SIZE) $@
|
2020-02-16 16:52:21 +01:00
|
|
|
@echo "Built Version $(GIT_VER)"
|
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)
|
2020-02-23 22:00:14 +01:00
|
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S)
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
|
2020-06-15 21:57:36 +02:00
|
|
|
.PHONY: qtproject-legacy qtproject qtproject-debug clean mrproper objcopy disassemble program program-debug
|
|
|
|
|
|
|
|
program-debug:
|
|
|
|
$(QUIET)$(MAKE) DEBUGBUILD=true program
|
2020-04-18 01:39:50 +02:00
|
|
|
|
|
|
|
program: $(target).elf
|
|
|
|
./program-device.sh $<
|
2020-01-26 21:07:54 +01:00
|
|
|
|
|
|
|
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-08-29 08:52:44 +02:00
|
|
|
ifneq ($(DEBUGBUILD),true)
|
|
|
|
@echo "Purging RELEASE project files"
|
|
|
|
else
|
|
|
|
@echo "Purging DEBUG project files"
|
|
|
|
endif
|
2020-06-15 21:22:05 +02:00
|
|
|
$(QUIET)rm -f $(target).pro $(target).creator $(target).files $(target).cflags $(target).cxxflags $(target).includes $(target).config
|
2020-08-29 08:52:44 +02:00
|
|
|
ifneq ($(DEBUGBUILD),true)
|
|
|
|
$(QUIET)$(MAKE) DEBUGBUILD=true mrproper
|
|
|
|
endif
|
|
|
|
|
2020-01-26 15:27:06 +01:00
|
|
|
|
|
|
|
clean:
|
2020-06-15 21:22:05 +02:00
|
|
|
@echo -n "Cleaning up derived files for "
|
|
|
|
ifneq ($(DEBUGBUILD),true)
|
|
|
|
@echo "RELEASE build"
|
|
|
|
else
|
|
|
|
@echo "DEBUG build"
|
|
|
|
endif
|
2020-05-05 00:00:44 +02:00
|
|
|
$(QUIET)rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
|
|
|
$(QUIET)rm -rf $(OBJDIR)/*
|
2020-06-15 21:22:05 +02:00
|
|
|
ifneq ($(DEBUGBUILD),true)
|
|
|
|
$(QUIET)$(MAKE) DEBUGBUILD=true clean
|
|
|
|
endif
|
2020-05-05 00:00:44 +02:00
|
|
|
|
2020-06-09 21:50:37 +02:00
|
|
|
qtproject-legacy:
|
2020-01-26 15:27:06 +01:00
|
|
|
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-06-13 22:47:45 +02:00
|
|
|
|
2020-06-15 21:22:05 +02:00
|
|
|
qtproject-debug:
|
|
|
|
@echo "Generating debug build project"
|
|
|
|
$(QUIET)$(MAKE) DEBUGBUILD=true qtproject
|
|
|
|
|
2020-06-09 21:50:37 +02:00
|
|
|
qtproject:
|
|
|
|
$(QUIET)rm -f $(target).files $(target).cflags $(target).config $(target).creator $(target).includes $(target).creator.user
|
2020-06-15 21:22:05 +02:00
|
|
|
@echo "Generating source file list"
|
2020-06-09 21:50:37 +02:00
|
|
|
$(QUIET)echo "$(CFILES)" | tr ' ' '\n' > $(target).files
|
|
|
|
@echo -n "Appending found header files from folders "
|
|
|
|
@echo `echo $(INCLUDEPATH) | sed "s/-I//g"`
|
|
|
|
$(QUIET)for dir in `echo $(INCLUDEPATH) | sed "s/-I//g"`; do \
|
|
|
|
find `echo "$${dir}"` -name "*.h" >> $(target).files; \
|
|
|
|
done
|
2020-06-13 22:47:45 +02:00
|
|
|
@echo "Generating $(target).cflags"
|
2020-06-09 21:50:37 +02:00
|
|
|
$(QUIET)echo "" > $(target).cflags
|
2020-06-13 22:47:45 +02:00
|
|
|
@echo "Generating $(target).includes"
|
2020-06-09 21:50:37 +02:00
|
|
|
$(QUIET)echo $(INCLUDEPATH) | sed "s/-I/,/g" | tr , '\n' | sed "/^$$/d" > $(target).includes;
|
2020-06-13 22:47:45 +02:00
|
|
|
@echo "Generating $(target).config"
|
2020-06-09 21:50:37 +02:00
|
|
|
$(QUIET)echo $(DEFINES) | sed "s/-D/,#define /g" | tr , '\n' | sed "/^$$/d" > $(target).config
|
2020-06-13 22:47:45 +02:00
|
|
|
@echo "Generating $(target).creator"
|
2020-06-09 21:50:37 +02:00
|
|
|
$(QUIET)echo "[GENERAL]" > $(target).creator
|
2020-06-13 22:47:45 +02:00
|
|
|
|
2020-01-26 21:07:54 +01:00
|
|
|
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|