summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-11-23 11:44:14 +0700
committerhathach <[email protected]>2023-11-23 11:44:14 +0700
commit51312f70fde779f59dcc48b41132291c10d3ad0b (patch)
treeabf7ea5c2fbd6bfddd66930f3fefc88fd1a3bf5b
parent08f9ed67c92421cbd0bc09270d2f363886681866 (diff)
move make to examples/build_system
add -Wl,--no-warn-rwx-segment for gcc 12+
-rw-r--r--examples/build_system/make/cpu/arm1176.mk (renamed from tools/make/cpu/arm1176.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-a53.mk (renamed from tools/make/cpu/cortex-a53.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-a72.mk (renamed from tools/make/cpu/cortex-a72.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-m0.mk (renamed from tools/make/cpu/cortex-m0.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-m0plus.mk (renamed from tools/make/cpu/cortex-m0plus.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-m3.mk (renamed from tools/make/cpu/cortex-m3.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-m33.mk (renamed from tools/make/cpu/cortex-m33.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-m4.mk (renamed from tools/make/cpu/cortex-m4.mk)0
-rw-r--r--examples/build_system/make/cpu/cortex-m7.mk (renamed from tools/make/cpu/cortex-m7.mk)0
-rw-r--r--examples/build_system/make/toolchain/arm_gcc.mk (renamed from tools/make/toolchain/arm_gcc.mk)9
-rw-r--r--examples/build_system/make/toolchain/arm_gcc_rules.mk (renamed from tools/make/toolchain/arm_gcc_rules.mk)0
-rw-r--r--examples/build_system/make/toolchain/arm_iar.mk (renamed from tools/make/toolchain/arm_iar.mk)0
-rw-r--r--examples/build_system/make/toolchain/arm_iar_rules.mk (renamed from tools/make/toolchain/arm_iar_rules.mk)0
-rw-r--r--examples/make.mk18
-rw-r--r--examples/rules.mk2
-rw-r--r--tools/build_family.py3
16 files changed, 19 insertions, 13 deletions
diff --git a/tools/make/cpu/arm1176.mk b/examples/build_system/make/cpu/arm1176.mk
index 022ccf7ad..022ccf7ad 100644
--- a/tools/make/cpu/arm1176.mk
+++ b/examples/build_system/make/cpu/arm1176.mk
diff --git a/tools/make/cpu/cortex-a53.mk b/examples/build_system/make/cpu/cortex-a53.mk
index 42e522ecf..42e522ecf 100644
--- a/tools/make/cpu/cortex-a53.mk
+++ b/examples/build_system/make/cpu/cortex-a53.mk
diff --git a/tools/make/cpu/cortex-a72.mk b/examples/build_system/make/cpu/cortex-a72.mk
index 1b3d8da4a..1b3d8da4a 100644
--- a/tools/make/cpu/cortex-a72.mk
+++ b/examples/build_system/make/cpu/cortex-a72.mk
diff --git a/tools/make/cpu/cortex-m0.mk b/examples/build_system/make/cpu/cortex-m0.mk
index feb0f395b..feb0f395b 100644
--- a/tools/make/cpu/cortex-m0.mk
+++ b/examples/build_system/make/cpu/cortex-m0.mk
diff --git a/tools/make/cpu/cortex-m0plus.mk b/examples/build_system/make/cpu/cortex-m0plus.mk
index b416b7a4a..b416b7a4a 100644
--- a/tools/make/cpu/cortex-m0plus.mk
+++ b/examples/build_system/make/cpu/cortex-m0plus.mk
diff --git a/tools/make/cpu/cortex-m3.mk b/examples/build_system/make/cpu/cortex-m3.mk
index 7a34b9e04..7a34b9e04 100644
--- a/tools/make/cpu/cortex-m3.mk
+++ b/examples/build_system/make/cpu/cortex-m3.mk
diff --git a/tools/make/cpu/cortex-m33.mk b/examples/build_system/make/cpu/cortex-m33.mk
index fe5b7b380..fe5b7b380 100644
--- a/tools/make/cpu/cortex-m33.mk
+++ b/examples/build_system/make/cpu/cortex-m33.mk
diff --git a/tools/make/cpu/cortex-m4.mk b/examples/build_system/make/cpu/cortex-m4.mk
index d8776b5d8..d8776b5d8 100644
--- a/tools/make/cpu/cortex-m4.mk
+++ b/examples/build_system/make/cpu/cortex-m4.mk
diff --git a/tools/make/cpu/cortex-m7.mk b/examples/build_system/make/cpu/cortex-m7.mk
index 0e3461787..0e3461787 100644
--- a/tools/make/cpu/cortex-m7.mk
+++ b/examples/build_system/make/cpu/cortex-m7.mk
diff --git a/tools/make/toolchain/arm_gcc.mk b/examples/build_system/make/toolchain/arm_gcc.mk
index bba0607df..071b13f68 100644
--- a/tools/make/toolchain/arm_gcc.mk
+++ b/examples/build_system/make/toolchain/arm_gcc.mk
@@ -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
diff --git a/tools/make/toolchain/arm_gcc_rules.mk b/examples/build_system/make/toolchain/arm_gcc_rules.mk
index b76d4aec3..b76d4aec3 100644
--- a/tools/make/toolchain/arm_gcc_rules.mk
+++ b/examples/build_system/make/toolchain/arm_gcc_rules.mk
diff --git a/tools/make/toolchain/arm_iar.mk b/examples/build_system/make/toolchain/arm_iar.mk
index 04c9f22b3..04c9f22b3 100644
--- a/tools/make/toolchain/arm_iar.mk
+++ b/examples/build_system/make/toolchain/arm_iar.mk
diff --git a/tools/make/toolchain/arm_iar_rules.mk b/examples/build_system/make/toolchain/arm_iar_rules.mk
index 2c066f6da..2c066f6da 100644
--- a/tools/make/toolchain/arm_iar_rules.mk
+++ b/examples/build_system/make/toolchain/arm_iar_rules.mk
diff --git a/examples/make.mk b/examples/make.mk
index 448d7883d..b646b46ce 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -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
diff --git a/examples/rules.mk b/examples/rules.mk
index 227849a18..b02665cdd 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -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)))
diff --git a/tools/build_family.py b/tools/build_family.py
index fb90e0edb..cd9884313 100644
--- a/tools/build_family.py
+++ b/tools/build_family.py
@@ -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()