[U-Boot] [PATCH v2 3/5] MIPS: Optimize the setup of endianess and CPU optimization flags

Daniel Schwierzeck daniel.schwierzeck at googlemail.com
Tue Mar 15 14:20:57 CET 2011


Hi Shinya,

2011/3/15 Shinya Kuribayashi <skuribay at pobox.com>:
> On 3/15/11 6:14 AM, daniel.schwierzeck at googlemail.com wrote:
>>
>> 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.
>
> [...]
>>
>> -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)
>
> This trick can not work with the ELDK toolchain, which also I don't
> want to think about and be involved in discussion any more.   See:
>
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81572/focus=81735

sorry, I missed that discussion

> Users who need to dig into this area should install the ELDK first,
> build little-endian targets with it by yourself, then find a way
> to handle endianness appropriately which works for both the ELDK and
> non-ELDK toolchains.
>
> Or I may miss something.  If it's already verified with the ELDK,
> please let me know, thanks.
>

The following code works with ELDK (mips_4KC and mips_4KCle) and my
non-ELDK BE toolchain.

ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
ENDIANESS = -EL
else ifneq (,$(findstring 4KC,$(CROSS_COMPILE)))
ENDIANESS = -EB
else
ENDIANESS = $(shell $(CC) -dumpmachine | \
		grep -q 'mips.*el-.*' && echo -EL || echo -EB)
endif

Do we need this endianess flag stuff at all? Each toolchain that is
built with a specific
endinaness does not really need the extra setting of -EB/-EL or am I
miss something?

Daniel


More information about the U-Boot mailing list