Makefile: Make a separate memory mapfile for each build configuration (release or debug)

This commit is contained in:
Mario Hüttel 2020-06-15 21:48:37 +02:00
parent 3705cc09d1
commit 47d8df052a

View File

@ -13,7 +13,7 @@ LIBRARYPATH = -L. -Lmathlib
LIBRARIES = -larm_cortexM4lf_math -lm LIBRARIES = -larm_cortexM4lf_math -lm
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4 -DHSE_VALUE=8000000UL DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4 -DHSE_VALUE=8000000UL
mapfile = memory-mapping MAPFILE_BASE = memory-mapping
export GIT_VER = $(shell git describe --always --dirty --tags) export GIT_VER = $(shell git describe --always --dirty --tags)
DEFINES += -DGIT_VER=$(GIT_VER) DEFINES += -DGIT_VER=$(GIT_VER)
@ -61,34 +61,39 @@ OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump OBJDUMP=$(CROSS_COMPILE)objdump
SIZE=$(CROSS_COMPILE)size SIZE=$(CROSS_COMPILE)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 -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
CFLAGS_RELEASE = -O3 -g CFLAGS_RELEASE = -O3 -g
CFLAGS_DEBUG = -O0 -g CFLAGS_DEBUG = -O0 -g
LFLAGS_RELEASE = -Wl,--gc-sections LFLAGS_RELEASE = -Wl,--gc-sections
LFLAGS_DEBUG = LFLAGS_DEBUG =
CFLAGS =
LFLAGS =
ifneq ($(DEBUGBUILD),true) ifneq ($(DEBUGBUILD),true)
DEFINES += $(RELEASE_DEFINES) DEFINES += $(RELEASE_DEFINES)
CFLAGS += $(CFLAGS_RELEASE) CFLAGS += $(CFLAGS_RELEASE)
LFLAGS += $(LFLAGS_RELEASE) LFLAGS += $(LFLAGS_RELEASE)
target = $(TARGET_BASE)-release target = $(TARGET_BASE)-release
OBJDIR = $(OBJDIR_BASE)/release OBJDIR = $(OBJDIR_BASE)/release
MAPFILE = $(MAPFILE_BASE)-release
else else
DEFINES += $(DEBUG_DEFINES) DEFINES += $(DEBUG_DEFINES)
target = $(TARGET_BASE)-debug target = $(TARGET_BASE)-debug
CFLAGS += $(CFLAGS_DEBUG) CFLAGS += $(CFLAGS_DEBUG)
LFLAGS += $(LFLAGS_DEBUG) LFLAGS += $(LFLAGS_DEBUG)
OBJDIR = $(OBJDIR_BASE)/debug OBJDIR = $(OBJDIR_BASE)/debug
MAPFILE = $(MAPFILE_BASE)-debug
endif endif
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 -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
#################################################################################### ####################################################################################
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o) OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)