mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
mcu-*.mk: Support arm-none-eabi / modm
This commit adds compiler flags needed for compilation with modm. Cleanup is needed, most notably should mcu-tags.mk be dissolved into defs-cpp.mk. The good part is that it works. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
714cf468f3
commit
4a5ae9c734
3 changed files with 83 additions and 10 deletions
|
|
@ -3,6 +3,7 @@
|
|||
COMPILER_SUITE ?= gcc
|
||||
CPP_STANDARD_VERSION ?= 17
|
||||
C_STANDARD_VERSION ?= 11
|
||||
|
||||
ifeq ($(TARGET_TRIPLET),arm-none-eabi)
|
||||
LIBTYPE ?= static
|
||||
else
|
||||
|
|
@ -132,10 +133,76 @@ endif
|
|||
|
||||
ifeq ($(TARGET_TRIPLET),arm-none-eabi)
|
||||
USE_DISABLE_COMPILER_OPTIMISATION_OPTS = false
|
||||
BUILD_CFLAGS += -mcpu=cortex-m3 -mthumb
|
||||
BUILD_CPPFLAGS += -mcpu=cortex-m3 -mthumb
|
||||
BUILD_CPPFLAGS += -fno-exceptions
|
||||
USE_EXCEPTIONS_IN_C = false
|
||||
ARM_NONE_EABI_ALLFLAGS += -mcpu=cortex-m3 -mthumb
|
||||
ARM_NONE_EABI_ALLFLAGS += -fno-exceptions
|
||||
ARM_NONE_EABI_ALLFLAGS += -Os
|
||||
BUILD_LDFLAGS += $(ARM_NONE_EABI_ALLFLAGS)
|
||||
BUILD_CFLAGS += $(ARM_NONE_EABI_ALLFLAGS)
|
||||
BUILD_CPPFLAGS += $(ARM_NONE_EABI_ALLFLAGS)
|
||||
BUILD_CPPFLAGS += -fno-rtti
|
||||
|
||||
# -- used by modm, but currently disabled for test purposes
|
||||
#BUILD_CFLAGS += -fno-threadsafe-statics
|
||||
#BUILD_CFLAGS += -fno-unwind-tables
|
||||
#BUILD_CFLAGS += -fstrict-enums
|
||||
#BUILD_CFLAGS += -fuse-cxa-atexit
|
||||
#BUILD_CFLAGS += -fshort-wchar
|
||||
#BUILD_CFLAGS += -fsingle-precision-constant
|
||||
#BUILD_CFLAGS += -funsigned-bitfields
|
||||
#BUILD_CFLAGS += -funsigned-char
|
||||
#BUILD_CFLAGS += -fwrapv
|
||||
#BUILD_CFLAGS += -g3
|
||||
#BUILD_CFLAGS += -gdwarf
|
||||
#BUILD_CFLAGS += -W
|
||||
#BUILD_CFLAGS += -Wall
|
||||
#BUILD_CFLAGS += -Wdouble-promotion
|
||||
#BUILD_CFLAGS += -Wduplicated-cond
|
||||
#BUILD_CFLAGS += -Werror=format
|
||||
#BUILD_CFLAGS += -Werror=maybe-uninitialized
|
||||
#BUILD_CFLAGS += -Werror=overflow
|
||||
#BUILD_CFLAGS += -Werror=sign-compare
|
||||
#BUILD_CFLAGS += -Wextra
|
||||
#BUILD_CFLAGS += -Wlogical-op
|
||||
#BUILD_CFLAGS += -Wpointer-arith
|
||||
#BUILD_CFLAGS += -Wundef
|
||||
|
||||
|
||||
#BUILD_CPPFLAGS += -fdata-sections
|
||||
#BUILD_CPPFLAGS += -ffunction-sections
|
||||
#BUILD_CPPFLAGS += -finline-limit=10000
|
||||
#BUILD_CPPFLAGS += -fshort-wchar
|
||||
#BUILD_CPPFLAGS += -fsingle-precision-constant
|
||||
#BUILD_CPPFLAGS += -funsigned-bitfields
|
||||
#BUILD_CPPFLAGS += -funsigned-char
|
||||
#BUILD_CPPFLAGS += -fwrapv
|
||||
#BUILD_CPPFLAGS += -g3
|
||||
#BUILD_CPPFLAGS += -gdwarf
|
||||
#BUILD_CPPFLAGS += -W
|
||||
#BUILD_CPPFLAGS += -Wall
|
||||
#BUILD_CPPFLAGS += -Wdouble-promotion
|
||||
#BUILD_CPPFLAGS += -Wduplicated-cond
|
||||
#BUILD_CPPFLAGS += -Werror=format
|
||||
#BUILD_CPPFLAGS += -Werror=maybe-uninitialized
|
||||
#BUILD_CPPFLAGS += -Werror=overflow
|
||||
#BUILD_CPPFLAGS += -Werror=sign-compare
|
||||
#BUILD_CPPFLAGS += -Wextra
|
||||
#BUILD_CPPFLAGS += -Wlogical-op
|
||||
#BUILD_CPPFLAGS += -Wpointer-arith
|
||||
#BUILD_CPPFLAGS += -Wundef
|
||||
#BUILD_CPPFLAGS += -fno-threadsafe-statics
|
||||
#BUILD_CPPFLAGS += -fno-unwind-tables
|
||||
#BUILD_CPPFLAGS += -fstrict-enums
|
||||
#BUILD_CPPFLAGS += -fuse-cxa-atexit
|
||||
#BUILD_CPPFLAGS += -std=c++17
|
||||
#BUILD_CPPFLAGS += -Woverloaded-virtual
|
||||
#BUILD_CPPFLAGS += -fno-move-loop-invariants
|
||||
#BUILD_CPPFLAGS += -fno-split-wide-types
|
||||
#BUILD_CPPFLAGS += -fno-tree-loop-optimize
|
||||
#BUILD_CPPFLAGS += -Og
|
||||
|
||||
#BUILD_CPPFLAGS += -fno-exceptions
|
||||
#BUILD_CPPFLAGS += -fno-rtti
|
||||
endif
|
||||
|
||||
ifeq ($(COMPILER_SUITE),gcc)
|
||||
|
|
@ -196,6 +263,8 @@ else ifeq ($(COMPILER_SUITE),clang)
|
|||
|
||||
endif # COMPILER_SUITE
|
||||
|
||||
PROJECT_LDFLAGS += $(addprefix -u ,$(LD_DEFINE_SYMBOLS))
|
||||
|
||||
# -- target files and dirs
|
||||
|
||||
SRC_SUFFIX += $(sort $(suffix $(wildcard $(TOPDIR)/hdr/*)))
|
||||
|
|
@ -253,7 +322,9 @@ ifeq ($(USE_X),true)
|
|||
BUILD_LDFLAGS += -L/usr/X11/$(SYSTEM_LIBDIR_NAME) -lXext -lX11
|
||||
endif
|
||||
|
||||
LPPFLAGS += -lstdc++
|
||||
ifneq ($(TARGET_TRIPLET),arm-none-eabi)
|
||||
LPPFLAGS += -lstdc++
|
||||
endif
|
||||
|
||||
ifeq ($(GCC_MAJOR),2)
|
||||
LPPFLAGS += -lm
|
||||
|
|
@ -487,7 +558,7 @@ ifeq ($(USE_PROJECT_LIB),true)
|
|||
LIBFLAGS += -L$(BUILD_LIBDIR)
|
||||
endif
|
||||
|
||||
INCLUDE += $(call proj_query, cflags $(PREREQ_BUILD) $(PROJECT))
|
||||
INCLUDE += $(call proj_query, cflags $(PREREQ_BUILD) $(PROJECT))
|
||||
|
||||
LDFLAGS_QUERY_ARGS = $(addprefix --exclude ,$(LDFLAGS_EXCLUDE))
|
||||
LIBFLAGS += $(call proj_query, ldflags $(LDFLAGS_QUERY_ARGS) --add-self $(PREREQ_BUILD))
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ endif
|
|||
|
||||
MCU_FLASH_PUSH_FILE_HEX ?= $(patsubst %.elf,%.hex,$(EXE_BASENAME))
|
||||
EXE_MAP ?= $(patsubst %.elf,%.map,$(EXE_BASENAME))
|
||||
PROJECT_LDFLAGS += -static
|
||||
LD_DEFINE_SYMBOLS += _sbrk
|
||||
|
||||
PROJECT_LDFLAGS += $(addprefix -u ,$(LD_DEFINE_SYMBOLS))
|
||||
|
||||
include $(MODDIR)/make/mcu-defs.mk
|
||||
include $(MODDIR)/make/exe.mk
|
||||
|
|
|
|||
|
|
@ -31,11 +31,17 @@ ifneq ($(findstring cortex-m3,$(TAGGED_TMPL_TAGS)),)
|
|||
# create map file
|
||||
PROJECT_LDFLAGS += -Wl,-Map,"$(EXE_MAP)"
|
||||
|
||||
# use newlib-nano (TODO: No -Wl necessary?)
|
||||
# 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),)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue