move make to examples/build_system
add -Wl,--no-warn-rwx-segment for gcc 12+
This commit is contained in:
@@ -9,6 +9,8 @@ GDB = $(CROSS_COMPILE)gdb
|
|||||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||||
SIZE = $(CROSS_COMPILE)size
|
SIZE = $(CROSS_COMPILE)size
|
||||||
|
|
||||||
|
CC_VERSION := $(shell $(CC) -dumpversion)
|
||||||
|
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Compiler Flags
|
# Compiler Flags
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
@@ -65,7 +67,12 @@ LDFLAGS += \
|
|||||||
-Wl,-cref \
|
-Wl,-cref \
|
||||||
-Wl,-gc-sections \
|
-Wl,-gc-sections \
|
||||||
|
|
||||||
# Some toolchain such as renesas rx does not support --print-memory-usage flags
|
# renesas rx does not support --print-memory-usage flags
|
||||||
ifneq ($(FAMILY),rx)
|
ifneq ($(FAMILY),rx)
|
||||||
LDFLAGS += -Wl,--print-memory-usage
|
LDFLAGS += -Wl,--print-memory-usage
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# from version 12
|
||||||
|
ifeq (12,$(firstword $(sort 12 $(CC_VERSION))))
|
||||||
|
LDFLAGS += -Wl,--no-warn-rwx-segment
|
||||||
|
endif
|
@@ -2,14 +2,10 @@
|
|||||||
# Common make definition for all examples
|
# Common make definition for all examples
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
|
|
||||||
# Supported toolchain: gcc, iar
|
|
||||||
TOOLCHAIN ?= gcc
|
|
||||||
|
|
||||||
#-------------- TOP and CURRENT_PATH ------------
|
#-------------- TOP and CURRENT_PATH ------------
|
||||||
|
|
||||||
# Set TOP to be the path to get from the current directory (where make was
|
# Set TOP to be the path to get from the current directory (where make was invoked) to the top of the tree.
|
||||||
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
|
# $(lastword $(MAKEFILE_LIST)) returns the name of this makefile relative to where make was invoked.
|
||||||
# the name of this makefile relative to where make was invoked.
|
|
||||||
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
# strip off /tools/top.mk to get for example ../../..
|
# strip off /tools/top.mk to get for example ../../..
|
||||||
@@ -38,7 +34,6 @@ __check_defined = \
|
|||||||
$(if $(value $1),, \
|
$(if $(value $1),, \
|
||||||
$(error Undefined make flag: $1$(if $2, ($2))))
|
$(error Undefined make flag: $1$(if $2, ($2))))
|
||||||
|
|
||||||
|
|
||||||
# Build directory
|
# Build directory
|
||||||
BUILD := _build/$(BOARD)
|
BUILD := _build/$(BOARD)
|
||||||
|
|
||||||
@@ -73,7 +68,10 @@ else
|
|||||||
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
|
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#-------------- Cross Compiler ------------
|
#-------------- Toolchain ------------
|
||||||
|
|
||||||
|
# Supported toolchain: gcc, iar
|
||||||
|
TOOLCHAIN ?= gcc
|
||||||
|
|
||||||
# Can be set by board, default to ARM GCC
|
# Can be set by board, default to ARM GCC
|
||||||
CROSS_COMPILE ?= arm-none-eabi-
|
CROSS_COMPILE ?= arm-none-eabi-
|
||||||
@@ -139,8 +137,8 @@ endif
|
|||||||
|
|
||||||
# CPU specific flags
|
# CPU specific flags
|
||||||
ifdef CPU_CORE
|
ifdef CPU_CORE
|
||||||
include $(TOP)/tools/make/cpu/$(CPU_CORE).mk
|
include ${TOP}/examples/build_system/make/cpu/$(CPU_CORE).mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# toolchain specific
|
# toolchain specific
|
||||||
include $(TOP)/tools/make/toolchain/arm_$(TOOLCHAIN).mk
|
include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk
|
||||||
|
@@ -37,7 +37,7 @@ vpath %.c . $(TOP)
|
|||||||
vpath %.s . $(TOP)
|
vpath %.s . $(TOP)
|
||||||
vpath %.S . $(TOP)
|
vpath %.S . $(TOP)
|
||||||
|
|
||||||
include $(TOP)/tools/make/toolchain/arm_$(TOOLCHAIN)_rules.mk
|
include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN)_rules.mk
|
||||||
|
|
||||||
|
|
||||||
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
OBJ_DIRS = $(sort $(dir $(OBJ)))
|
||||||
|
@@ -34,6 +34,7 @@ def build_family(example, family, make_option):
|
|||||||
# sum all element of same index (column sum)
|
# sum all element of same index (column sum)
|
||||||
return list(map(sum, list(zip(*result))))
|
return list(map(sum, list(zip(*result))))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# IAR CC
|
# IAR CC
|
||||||
if make_iar_option not in sys.argv:
|
if make_iar_option not in sys.argv:
|
||||||
@@ -44,7 +45,7 @@ if __name__ == '__main__':
|
|||||||
for d in os.scandir("examples"):
|
for d in os.scandir("examples"):
|
||||||
if d.is_dir() and 'cmake' not in d.name:
|
if d.is_dir() and 'cmake' not in d.name:
|
||||||
for entry in os.scandir(d.path):
|
for entry in os.scandir(d.path):
|
||||||
if entry.is_dir() and 'cmake' not in entry.name:
|
if entry.is_dir() and 'cmake' not in entry.name and entry.name != 'build_system':
|
||||||
all_examples.append(d.name + '/' + entry.name)
|
all_examples.append(d.name + '/' + entry.name)
|
||||||
filter_with_input(all_examples)
|
filter_with_input(all_examples)
|
||||||
all_examples.sort()
|
all_examples.sort()
|
||||||
|
Reference in New Issue
Block a user