defs-cpp.mk, mcu-defs.mk, mcu-tags.mk: Dissolve mcu-tags.mk into defs-cpp.mk

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2019-03-19 13:16:53 +00:00
commit f09eb174ef
3 changed files with 60 additions and 65 deletions

View file

@ -76,6 +76,66 @@ ifeq ($(USE_VERSION_MACROS),true)
BUILD_CPPFLAGS += -DVERSION=$(HEX_VERSION) -DVERSION_STR=\"$(VERSION)\" BUILD_CPPFLAGS += -DVERSION=$(HEX_VERSION) -DVERSION_STR=\"$(VERSION)\"
endif endif
ifneq ($(findstring cortex-m3,$(TAGGED_TMPL_TAGS)),)
# -- set jw-build mcu choices
MCU_CPU ?= cortex-m3
# -- set flags
# don't wrap error message lines
#PROJECT_LDFLAGS += -fmessage-length=0
# don't know what kind of optimization that is
#PROJECT_LDFLAGS += -Og
# stick with what janware code tends to expect
PROJECT_LDFLAGS += -fsigned-char
# I have no clue which part would evaluate these names
PROJECT_LDFLAGS += -ffunction-sections
PROJECT_LDFLAGS += -fdata-sections
PROJECT_LDFLAGS += -ffreestanding
PROJECT_LDFLAGS += -fno-move-loop-invariants
# skip any automatic initialization
PROJECT_LDFLAGS += -nostartfiles
# garbage collect unused input sections
PROJECT_LDFLAGS += -Xlinker --gc-sections
# create map file
PROJECT_LDFLAGS += -Wl,-Map,"$(EXE_MAP)"
# use newlib-nano, provides symbols _write _close _fstat _isatty _lseek (at least)
# (TODO: No -Wl necessary?)
PROJECT_LDFLAGS += --specs=nano.specs
PROJECT_LDFLAGS += --specs=nosys.specs
endif
ifneq ($(findstring gnu-mcu-eclipse,$(TAGGED_TMPL_TAGS)),)
LD_DEFINE_SYMBOLS += _sbrk
endif
# ----- build options based on product choices
ifneq ($(findstring $(MCU_CPU),cortex-m3),)
PROJECT_CPPFLAGS += -mcpu=cortex-m3 -mthumb
PROJECT_LDFLAGS += -mcpu=cortex-m3 -mthumb
endif
# ----- tagged templates
#MCU_LD_DIR = $(wildcard $(firstword $(call $(TAGGED_TMPL_DIRS),ld)))
#MCU_LD_DIR = $(firstword $(foreach tag,$(TAGGED_TMPL_TAGS),$(foreach repo,$(TOPDIR)/tmpl/tagged $(MODDIR)/tmpl/tagged,$(wildcard $(repo)/$(tag)/ld))))
#MCU_LD_DIR = $(firstword $(wildcard $(foreach tag,$(TAGGED_TMPL_TAGS),$(foreach repo,$(TOPDIR)/tmpl/tagged $(MODDIR)/tmpl/tagged,$(repo)/$(tag)/ld))))
MCU_LD_CHECK_DIRS = $(foreach tag,$(TAGGED_TMPL_TAGS),$(foreach repo,$(TOPDIR)/tmpl/tagged $(MODDIR)/tmpl/tagged,$(repo)/$(tag)/ld))
MCU_LD_DIRS = $(wildcard $(MCU_LD_CHECK_DIRS))
MCU_LD_DIR = $(firstword $(MCU_LD_DIRS))
PROJECT_LDFLAGS += -L$(MCU_LD_DIR) $(addprefix -T ,$(sort $(notdir $(wildcard $(MCU_LD_DIR)/*.ld))))
# ----- tool chain # ----- tool chain
ifneq ($(TARGET_TRIPLET),$(HOST_TRIPLET)) # we're cross-compiling ifneq ($(TARGET_TRIPLET),$(HOST_TRIPLET)) # we're cross-compiling
@ -123,7 +183,6 @@ endif
ifeq ($(TARGET_TRIPLET),arm-none-eabi) ifeq ($(TARGET_TRIPLET),arm-none-eabi)
USE_DISABLE_COMPILER_OPTIMISATION_OPTS = false USE_DISABLE_COMPILER_OPTIMISATION_OPTS = false
USE_EXCEPTIONS_IN_C = false USE_EXCEPTIONS_IN_C = false
ARM_NONE_EABI_ALLFLAGS += -mcpu=cortex-m3 -mthumb
ARM_NONE_EABI_ALLFLAGS += -fno-exceptions ARM_NONE_EABI_ALLFLAGS += -fno-exceptions
ARM_NONE_EABI_ALLFLAGS += -Os ARM_NONE_EABI_ALLFLAGS += -Os
BUILD_LDFLAGS += $(ARM_NONE_EABI_ALLFLAGS) BUILD_LDFLAGS += $(ARM_NONE_EABI_ALLFLAGS)

View file

@ -6,8 +6,6 @@
# endif # endif
#endef #endef
include $(MODDIR)/make/mcu-tags.mk
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)
ifeq ($(MCU_BOARD_MODEL),) ifeq ($(MCU_BOARD_MODEL),)
$(error MCU_BOARD_MODEL not specified) $(error MCU_BOARD_MODEL not specified)

View file

@ -1,62 +0,0 @@
# ----- product specific part
ifneq ($(findstring cortex-m3,$(TAGGED_TMPL_TAGS)),)
# -- set jw-build mcu choices
MCU_CPU ?= cortex-m3
# -- set flags
# don't wrap error message lines
#PROJECT_LDFLAGS += -fmessage-length=0
# don't know what kind of optimization that is
#PROJECT_LDFLAGS += -Og
# stick with what janware code tends to expect
PROJECT_LDFLAGS += -fsigned-char
# I have no clue which part would evaluate these names
PROJECT_LDFLAGS += -ffunction-sections
PROJECT_LDFLAGS += -fdata-sections
PROJECT_LDFLAGS += -ffreestanding
PROJECT_LDFLAGS += -fno-move-loop-invariants
# skip any automatic initialization
PROJECT_LDFLAGS += -nostartfiles
# garbage collect unused input sections
PROJECT_LDFLAGS += -Xlinker --gc-sections
# create map file
PROJECT_LDFLAGS += -Wl,-Map,"$(EXE_MAP)"
# use newlib-nano, provides symbols _write _close _fstat _isatty _lseek (at least)
# (TODO: No -Wl necessary?)
PROJECT_LDFLAGS += --specs=nano.specs
PROJECT_LDFLAGS += --specs=nosys.specs
endif
ifneq ($(findstring gnu-mcu-eclipse,$(TAGGED_TMPL_TAGS)),)
LD_DEFINE_SYMBOLS += _sbrk
endif
# ----- build options based on product choices
ifneq ($(findstring $(MCU_CPU),cortex-m3),)
PROJECT_LDFLAGS += -mcpu=cortex-m3
PROJECT_LDFLAGS += -mthumb
endif
# ----- tagged templates
#MCU_LD_DIR = $(wildcard $(firstword $(call $(TAGGED_TMPL_DIRS),ld)))
#MCU_LD_DIR = $(firstword $(foreach tag,$(TAGGED_TMPL_TAGS),$(foreach repo,$(TOPDIR)/tmpl/tagged $(MODDIR)/tmpl/tagged,$(wildcard $(repo)/$(tag)/ld))))
#MCU_LD_DIR = $(firstword $(wildcard $(foreach tag,$(TAGGED_TMPL_TAGS),$(foreach repo,$(TOPDIR)/tmpl/tagged $(MODDIR)/tmpl/tagged,$(repo)/$(tag)/ld))))
MCU_LD_CHECK_DIRS = $(foreach tag,$(TAGGED_TMPL_TAGS),$(foreach repo,$(TOPDIR)/tmpl/tagged $(MODDIR)/tmpl/tagged,$(repo)/$(tag)/ld))
MCU_LD_DIRS = $(wildcard $(MCU_LD_CHECK_DIRS))
MCU_LD_DIR = $(firstword $(MCU_LD_DIRS))
PROJECT_LDFLAGS += -L$(MCU_LD_DIR) $(addprefix -T ,$(sort $(notdir $(wildcard $(MCU_LD_DIR)/*.ld))))