MIPS: fix endianess handling
authorDaniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Mon, 2 Apr 2012 02:57:56 +0000 (02:57 +0000)
committerMarek Vasut <marex@denx.de>
Mon, 2 Apr 2012 13:54:53 +0000 (15:54 +0200)
Make endianess of target CPU configurable. Use the new config
option for dbau1550_el and pb1000 boards.

Adapt linking of standalone applications to pass through
endianess options to LD.

Build tested with:
 - ELDK 4 mips_4KC- and mips4KCle
 - Sourcery CodeBench Lite 2011.03-93

With this patch all 26 MIPS boards can be compiled now in one step by
running "MAKEALL -a mips".

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
README
arch/mips/cpu/mips32/config.mk
boards.cfg
include/configs/pb1x00.h

diff --git a/README b/README
index c98afa74b18f68a866a4283bc5c0785374e6fd3f..9702067174e361eb94383839e984d9ae6df4075c 100644 (file)
--- a/README
+++ b/README
@@ -374,6 +374,12 @@ The following options need to be configured:
                Defines the string to utilize when trying to match PCIe device
                tree nodes for the given platform.
 
+- Generic CPU options:
+               CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN
+
+               Defines the endianess of the CPU. Implementation of those
+               values is arch specific.
+
 - Intel Monahans options:
                CONFIG_SYS_MONAHANS_RUN_MODE_OSC_RATIO
 
index 4d1b27379d8973e05352ab472d0ece07e20a5582..a1cd590a00414c5f368af190103882440fbdd971 100644 (file)
 # Note: Toolchains with binutils prior to v2.16
 # are no longer supported by U-Boot MIPS tree!
 #
-MIPSFLAGS = -march=mips32r2
+MIPSFLAGS := -march=mips32r2
 
+# Handle special prefix in ELDK 4.0 toolchain
 ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
+ENDIANNESS := -EL
 endif
 
-MIPSFLAGS += $(ENDIANNESS)
+ifdef CONFIG_SYS_LITTLE_ENDIAN
+ENDIANNESS := -EL
+endif
+
+ifdef CONFIG_SYS_BIG_ENDIAN
+ENDIANNESS := -EB
+endif
+
+# Default to EB if no endianess is configured
+ENDIANNESS ?= -EB
 
-PLATFORM_CPPFLAGS += $(MIPSFLAGS)
+PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANNESS)
+PLATFORM_LDFLAGS += $(ENDIANNESS)
index c6090bab90010ba76dd62a6c17e09c4acaf7bfd5..3cf75c3151b0c7be6c91405661c962c78002ca3c 100644 (file)
@@ -360,7 +360,7 @@ dbau1000                     mips        mips32      dbau1x00            -
 dbau1100                     mips        mips32      dbau1x00            -              au1x00      dbau1x00:DBAU1100
 dbau1500                     mips        mips32      dbau1x00            -              au1x00      dbau1x00:DBAU1500
 dbau1550                     mips        mips32      dbau1x00            -              au1x00      dbau1x00:DBAU1550
-dbau1550_el                  mips        mips32      dbau1x00            -              au1x00      dbau1x00:DBAU1550
+dbau1550_el                  mips        mips32      dbau1x00            -              au1x00      dbau1x00:DBAU1550,SYS_LITTLE_ENDIAN
 gth2                         mips        mips32      -                   -              au1x00
 pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000
 incaip                       mips        mips32      incaip              -              incaip
index eea8ed3adb09199cdb94b3cac081653cf87ab32d..d056884e7ebac620bc316f62cc4f70609119c83a 100644 (file)
@@ -46,6 +46,8 @@
 #endif
 #endif
 
+#define CONFIG_SYS_LITTLE_ENDIAN
+
 #define CONFIG_ETHADDR         DE:AD:BE:EF:01:01    /* Ethernet address */
 
 #define CONFIG_BOOTDELAY       2       /* autoboot after 2 seconds     */