move make to examples/build_system

add -Wl,--no-warn-rwx-segment for gcc 12+
This commit is contained in:
hathach 2023-11-23 11:44:14 +07:00
parent 08f9ed67c9
commit 51312f70fd
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
16 changed files with 19 additions and 13 deletions

View File

@ -9,6 +9,8 @@ GDB = $(CROSS_COMPILE)gdb
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
CC_VERSION := $(shell $(CC) -dumpversion)
# ---------------------------------------
# Compiler Flags
# ---------------------------------------
@ -65,7 +67,12 @@ LDFLAGS += \
-Wl,-cref \
-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)
LDFLAGS += -Wl,--print-memory-usage
endif
# from version 12
ifeq (12,$(firstword $(sort 12 $(CC_VERSION))))
LDFLAGS += -Wl,--no-warn-rwx-segment
endif

View File

@ -2,14 +2,10 @@
# Common make definition for all examples
# ---------------------------------------
# Supported toolchain: gcc, iar
TOOLCHAIN ?= gcc
#-------------- TOP and CURRENT_PATH ------------
# Set TOP to be the path to get from the current directory (where make was
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
# the name of this makefile relative to where make was invoked.
# Set TOP to be the path to get from the current directory (where make was invoked) to the top of the tree.
# $(lastword $(MAKEFILE_LIST)) returns the name of this makefile relative to where make was invoked.
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
# strip off /tools/top.mk to get for example ../../..
@ -38,7 +34,6 @@ __check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
# Build directory
BUILD := _build/$(BOARD)
@ -73,7 +68,10 @@ else
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
endif
#-------------- Cross Compiler ------------
#-------------- Toolchain ------------
# Supported toolchain: gcc, iar
TOOLCHAIN ?= gcc
# Can be set by board, default to ARM GCC
CROSS_COMPILE ?= arm-none-eabi-
@ -139,8 +137,8 @@ endif
# CPU specific flags
ifdef CPU_CORE
include $(TOP)/tools/make/cpu/$(CPU_CORE).mk
include ${TOP}/examples/build_system/make/cpu/$(CPU_CORE).mk
endif
# toolchain specific
include $(TOP)/tools/make/toolchain/arm_$(TOOLCHAIN).mk
include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk

View File

@ -37,7 +37,7 @@ vpath %.c . $(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)))

View File

@ -34,6 +34,7 @@ def build_family(example, family, make_option):
# sum all element of same index (column sum)
return list(map(sum, list(zip(*result))))
if __name__ == '__main__':
# IAR CC
if make_iar_option not in sys.argv:
@ -44,7 +45,7 @@ if __name__ == '__main__':
for d in os.scandir("examples"):
if d.is_dir() and 'cmake' not in d.name:
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)
filter_with_input(all_examples)
all_examples.sort()