[U-Boot] [RFC PATCH 6/6] Mips: Update setting of endianess and CPU optimization flags

daniel.schwierzeck at googlemail.com daniel.schwierzeck at googlemail.com
Wed Mar 9 14:16:59 CET 2011


The current Mips CPU config.mk code always expects a Mips 4kc
core and toolchain. This is not appropiate for other toolchains
and CPUs/SoCs.

Replace the current MIPSFLAGS code by cc-option macro and use
-march=mips32r2 as default optimization level for all Mips32 CPUs.
Replace the endianess determination code from toolchain prefix by
a more generic one inspired by the Linux arch/mips/Makefile.
Move the -mtune setting to the SoC specific config.mk makefiles.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck at googlemail.com>
Cc: Shinya Kuribayashi <skuribay at pobox.com>
---
 arch/mips/cpu/mips32/au1x00/config.mk |    2 ++
 arch/mips/cpu/mips32/config.mk        |   21 +++++++--------------
 arch/mips/cpu/mips32/incaip/config.mk |    2 ++
 arch/mips/cpu/mips32/purple/config.mk |    2 ++
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/mips/cpu/mips32/au1x00/config.mk b/arch/mips/cpu/mips32/au1x00/config.mk
index 3516213..ecfcb9c 100644
--- a/arch/mips/cpu/mips32/au1x00/config.mk
+++ b/arch/mips/cpu/mips32/au1x00/config.mk
@@ -20,3 +20,5 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+
+PLATFORM_CPPFLAGS += $(call cc-option,-mtune=4kc)
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index a173c54..a91dcb4 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -20,20 +20,13 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2)
-MIPSFLAGS:=$(shell \
-if [ "$v" -lt "14" ]; then \
-	echo "-mcpu=4kc"; \
-else \
-	echo "-march=4kc -mtune=4kc"; \
-fi)

-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
-endif
+# Optimization flags for all Mips32 CPUs
+MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2)

-MIPSFLAGS += $(ENDIANNESS)
+# Determine endianess from toolchain prefix
+ENDIANESS = $(shell $(CC) -dumpmachine | \
+		grep -q 'mips.*el-.*' && echo -EL || echo -EB)
+
+PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANESS)

-PLATFORM_CPPFLAGS += $(MIPSFLAGS)
diff --git a/arch/mips/cpu/mips32/incaip/config.mk b/arch/mips/cpu/mips32/incaip/config.mk
index 3516213..ecfcb9c 100644
--- a/arch/mips/cpu/mips32/incaip/config.mk
+++ b/arch/mips/cpu/mips32/incaip/config.mk
@@ -20,3 +20,5 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+
+PLATFORM_CPPFLAGS += $(call cc-option,-mtune=4kc)
diff --git a/arch/mips/cpu/mips32/purple/config.mk b/arch/mips/cpu/mips32/purple/config.mk
index 3516213..ecfcb9c 100644
--- a/arch/mips/cpu/mips32/purple/config.mk
+++ b/arch/mips/cpu/mips32/purple/config.mk
@@ -20,3 +20,5 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+
+PLATFORM_CPPFLAGS += $(call cc-option,-mtune=4kc)
--
1.7.4.1



More information about the U-Boot mailing list