All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] MIPS: fix endianess handling
@ 2011-11-28 13:42 Daniel Schwierzeck
       [not found] ` <CACUy__XYf2Zo3d0SQ7Ub-ea37C2X=gZ+bTMTX95vz+YdAeQhDw@mail.gmail.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Daniel Schwierzeck @ 2011-11-28 13:42 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Cc: Thomas Lange <thomas@corelatus.se>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Wolfgang Denk <wd@denx.de>
---
Another try to finally fix this originated by discussion:
[1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/118111/focus=118122

Related discussions:
[2] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81572
[3] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/45404

 README                         |    6 ++++++
 arch/mips/cpu/mips32/config.mk |   21 +++++++++++++++------
 boards.cfg                     |    4 ++--
 examples/standalone/Makefile   |    6 +++++-
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/README b/README
index 07f1d11..468bfdf 100644
--- 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
 
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index 4d1b273..a1cd590 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -27,14 +27,23 @@
 # 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)
diff --git a/boards.cfg b/boards.cfg
index c83d861..2cd917e 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -324,13 +324,13 @@ 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
 incaip                       mips        mips32      incaip              -              incaip
 incaip_100MHz                mips        mips32      incaip              -              incaip      incaip:CPU_CLOCK_RATE=100000000
 incaip_133MHz                mips        mips32      incaip              -              incaip      incaip:CPU_CLOCK_RATE=133000000
 incaip_150MHz                mips        mips32      incaip              -              incaip      incaip:CPU_CLOCK_RATE=150000000
-pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000
+pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000,SYS_LITTLE_ENDIAN
 qemu_mips                    mips        mips32      qemu-mips           -              -           qemu-mips
 tb0229                       mips        mips32
 vct_premium                  mips        mips32      vct                 micronas       -           vct:VCT_PREMIUM
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index e23865b..eab23b4 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -88,6 +88,10 @@ endif
 CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
 CFLAGS += $(CFLAGS_NTR)
 
+# Pass through endianess settings in LDFLAGS to LD
+LDFLAGS_ENDIAN += $(filter -EB,$(LDFLAGS))
+LDFLAGS_ENDIAN += $(filter -EL,$(LDFLAGS))
+
 all:	$(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
 
 #########################################################################
@@ -96,7 +100,7 @@ $(LIB):	$(obj).depend $(LIBOBJS)
 
 $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
-		$(LD) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
+		$(LD) $(LDFLAGS_ENDIAN) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
 
-- 
1.7.7.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] MIPS: fix endianess handling
       [not found] ` <CACUy__XYf2Zo3d0SQ7Ub-ea37C2X=gZ+bTMTX95vz+YdAeQhDw@mail.gmail.com>
@ 2011-12-04 14:32   ` Shinya Kuribayashi
  2011-12-04 15:08     ` Wolfgang Denk
  0 siblings, 1 reply; 11+ messages in thread
From: Shinya Kuribayashi @ 2011-12-04 14:32 UTC (permalink / raw)
  To: u-boot

On 12/4/11 9:02 PM, Daniel Schwierzeck wrote:
>> diff --git a/boards.cfg b/boards.cfg
>> index c83d861..2cd917e 100644
>> --- a/boards.cfg
>> +++ b/boards.cfg
>> @@ -324,13 +324,13 @@ 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

This looks Ok.

>>    gth2                         mips        mips32      -                   -              au1x00
>>    incaip                       mips        mips32      incaip              -              incaip
>>    incaip_100MHz                mips        mips32      incaip              -              incaip      incaip:CPU_CLOCK_RATE=100000000
>>    incaip_133MHz                mips        mips32      incaip              -              incaip      incaip:CPU_CLOCK_RATE=133000000
>>    incaip_150MHz                mips        mips32      incaip              -              incaip      incaip:CPU_CLOCK_RATE=150000000
>> -pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000
>> +pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000,SYS_LITTLE_ENDIAN
>>    qemu_mips                    mips        mips32      qemu-mips           -              -           qemu-mips
>>    tb0229                       mips        mips32
>>    vct_premium                  mips        mips32      vct                 micronas       -           vct:VCT_PREMIUM

But I don't see any reason CONFIG_SYS_LITTLE_ENDIAN is specified in
boards.cfg.  Just putting it in configs/pb1000.h is enough, isn't it?

> Shinya, do you have an opinion about this?

No, if it works for you, I'm fine.  Thanks for tackling this issue.
Does anyone disagree with this change?  If not, I'll pick this up.

>> diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
>> index e23865b..eab23b4 100644
>> --- a/examples/standalone/Makefile
>> +++ b/examples/standalone/Makefile
>> @@ -88,6 +88,10 @@ endif
>>    CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
>>    CFLAGS += $(CFLAGS_NTR)
>>
>> +# Pass through endianess settings in LDFLAGS to LD

s/endianess/endianness/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] MIPS: fix endianess handling
       [not found] ` <4EDB5F86.40605@googlemail.com>
@ 2011-12-04 15:06   ` Wolfgang Denk
  2011-12-05  0:04     ` Daniel Schwierzeck
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Denk @ 2011-12-04 15:06 UTC (permalink / raw)
  To: u-boot

Dear Daniel Schwierzeck,

In message <4EDB5F86.40605@googlemail.com> you wrote:
>
> Wolfgang, is there any reason why standalone apps are linked without 
> LDFLAGS (especially PLATFORM_LDFLAGS)?

None that I know, at least.

In general, standalone applications are a rarely used special feature,
and the few people who actually ever used this for a purpose probably
used custom code and custom linker scripts, so the mainline code is
eventually not that good supproted.

> This patch fixes a general issue with standalone apps on archs 
> supporting both endianess types when running MAKEALL. I guess this could 
> be relevant for ARM too if U-Boot has support for big-endian ARM boards.

It does, but I doubt anybody ever used standalone applications on
these.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Computers are not intelligent.  They only think they are.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] MIPS: fix endianess handling
  2011-12-04 14:32   ` Shinya Kuribayashi
@ 2011-12-04 15:08     ` Wolfgang Denk
  2011-12-05  0:10       ` Daniel Schwierzeck
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Denk @ 2011-12-04 15:08 UTC (permalink / raw)
  To: u-boot

Dear Shinya Kuribayashi,

In message <4EDB8475.1080305@pobox.com> you wrote:
>
> >> -pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000
> >> +pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000,SYS_LITTLE_ENDIAN
...
> But I don't see any reason CONFIG_SYS_LITTLE_ENDIAN is specified in
> boards.cfg.  Just putting it in configs/pb1000.h is enough, isn't it?

Agreed.  In almost all cases this should be done in the board config
file only.  Only if there are cases where a board suppors both LE and
BE configurations (is there any such board??) then we should need a
SYS_*_ENDIAN setting in boards.cfg (but even then, only one - not
two).

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Real computer scientists don't comment their  code.  The  identifiers
are so long they can't afford the disk space.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] MIPS: fix endianess handling
  2011-12-04 15:06   ` Wolfgang Denk
@ 2011-12-05  0:04     ` Daniel Schwierzeck
  2011-12-05 10:05       ` Wolfgang Denk
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Schwierzeck @ 2011-12-05  0:04 UTC (permalink / raw)
  To: u-boot

On 12/04/2011 04:06 PM, Wolfgang Denk wrote:
> Dear Daniel Schwierzeck,
>
> In message<4EDB5F86.40605@googlemail.com>  you wrote:
>>
>> Wolfgang, is there any reason why standalone apps are linked without
>> LDFLAGS (especially PLATFORM_LDFLAGS)?
>
> None that I know, at least.
>
> In general, standalone applications are a rarely used special feature,
> and the few people who actually ever used this for a purpose probably
> used custom code and custom linker scripts, so the mainline code is
> eventually not that good supproted.

the problem is those apps are always compiled. Maybe we should introduce 
a config option to enable building only if someone really needs them?

>
>> This patch fixes a general issue with standalone apps on archs
>> supporting both endianess types when running MAKEALL. I guess this could
>> be relevant for ARM too if U-Boot has support for big-endian ARM boards.
>
> It does, but I doubt anybody ever used standalone applications on
> these.
>
> Best regards,
>
> Wolfgang Denk
>



-- 
Best regards,
Daniel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] MIPS: fix endianess handling
  2011-12-04 15:08     ` Wolfgang Denk
@ 2011-12-05  0:10       ` Daniel Schwierzeck
  2012-03-31 20:54         ` Marek Vasut
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Schwierzeck @ 2011-12-05  0:10 UTC (permalink / raw)
  To: u-boot

On 12/04/2011 04:08 PM, Wolfgang Denk wrote:
> Dear Shinya Kuribayashi,
>
> In message<4EDB8475.1080305@pobox.com>  you wrote:
>>
>>>> -pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000
>>>> +pb1000                       mips        mips32      pb1x00              -              au1x00      pb1x00:PB1000,SYS_LITTLE_ENDIAN
> ...
>> But I don't see any reason CONFIG_SYS_LITTLE_ENDIAN is specified in
>> boards.cfg.  Just putting it in configs/pb1000.h is enough, isn't it?
>
> Agreed.  In almost all cases this should be done in the board config
> file only.  Only if there are cases where a board suppors both LE and
> BE configurations (is there any such board??) then we should need a
> SYS_*_ENDIAN setting in boards.cfg (but even then, only one - not
> two).

I did this because of dbau1550 and dbau1550_el. For the pb1000 I'll
move it to the board config.

>
> Best regards,
>
> Wolfgang Denk
>


-- 
Best regards,
Daniel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] MIPS: fix endianess handling
  2011-12-05  0:04     ` Daniel Schwierzeck
@ 2011-12-05 10:05       ` Wolfgang Denk
  0 siblings, 0 replies; 11+ messages in thread
From: Wolfgang Denk @ 2011-12-05 10:05 UTC (permalink / raw)
  To: u-boot

Dear Daniel Schwierzeck,

In message <4EDC0A99.6090106@googlemail.com> you wrote:
>
> > In general, standalone applications are a rarely used special feature,
> > and the few people who actually ever used this for a purpose probably
> > used custom code and custom linker scripts, so the mainline code is
> > eventually not that good supproted.
> 
> the problem is those apps are always compiled. Maybe we should introduce 
> a config option to enable building only if someone really needs them?

As is, they are rarely used, so they tend to collect bit-rot.

If we stop to even compile them, they wil rot much faster.  This is
not a good idea.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In C we had to code our own bugs, in C++ we can inherit them.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v2] MIPS: fix endianess handling
  2011-11-28 13:42 [U-Boot] [PATCH] MIPS: fix endianess handling Daniel Schwierzeck
       [not found] ` <CACUy__XYf2Zo3d0SQ7Ub-ea37C2X=gZ+bTMTX95vz+YdAeQhDw@mail.gmail.com>
       [not found] ` <4EDB5F86.40605@googlemail.com>
@ 2011-12-07 12:59 ` Daniel Schwierzeck
  2011-12-11 16:53   ` [U-Boot] [PATCH v3] " Daniel Schwierzeck
  2 siblings, 1 reply; 11+ messages in thread
From: Daniel Schwierzeck @ 2011-12-07 12:59 UTC (permalink / raw)
  To: u-boot

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>
---
Changes for v2:
 - moved CONFIG_SYS_LITTLE_ENDIAN from boards.cfg to configs/pb1x00.h
 - fixed typo in comment
 - updated patch summary

Note:
qemu_mips and tb0229 boards are still broken.

Build result with Sourcery CodeBench Lite 2011.03-93:

~/devel/u-boot$ CROSS_COMPILE=/opt/codesourcery/mips-2011.03/bin/mips-linux-gnu- BUILD_NCPUS=2 ./MAKEALL -a mips
Configuring for dbau1000 - Board: dbau1x00, Options: DBAU1000
   text	   data	    bss	    dec	    hex	filename
 120604	   4390	  16068	 141062	  22706	./u-boot
Configuring for dbau1100 - Board: dbau1x00, Options: DBAU1100
   text	   data	    bss	    dec	    hex	filename
 120604	   4390	  16068	 141062	  22706	./u-boot
Configuring for dbau1500 - Board: dbau1x00, Options: DBAU1500
   text	   data	    bss	    dec	    hex	filename
 120604	   4390	  16068	 141062	  22706	./u-boot
Configuring for dbau1550 - Board: dbau1x00, Options: DBAU1550
   text	   data	    bss	    dec	    hex	filename
 119148	   4454	  18732	 142334	  22bfe	./u-boot
Configuring for dbau1550_el - Board: dbau1x00, Options: DBAU1550,SYS_LITTLE_ENDIAN
   text	   data	    bss	    dec	    hex	filename
 120316	   4454	  18732	 143502	  2308e	./u-boot
Configuring for gth2 board...
   text	   data	    bss	    dec	    hex	filename
 113668	   4390	  13752	 131810	  202e2	./u-boot
Configuring for incaip board...
   text	   data	    bss	    dec	    hex	filename
 147500	   5066	  15676	 168242	  29132	./u-boot
Configuring for incaip_100MHz - Board: incaip, Options: CPU_CLOCK_RATE=100000000
   text	   data	    bss	    dec	    hex	filename
 147500	   5066	  15676	 168242	  29132	./u-boot
Configuring for incaip_133MHz - Board: incaip, Options: CPU_CLOCK_RATE=133000000
   text	   data	    bss	    dec	    hex	filename
 147500	   5066	  15676	 168242	  29132	./u-boot
Configuring for incaip_150MHz - Board: incaip, Options: CPU_CLOCK_RATE=150000000
   text	   data	    bss	    dec	    hex	filename
 147500	   5066	  15676	 168242	  29132	./u-boot
Configuring for pb1000 - Board: pb1x00, Options: PB1000
   text	   data	    bss	    dec	    hex	filename
 110084	   5090	  15896	 131070	  1fffe	./u-boot
Configuring for qemu_mips board...
net/libnet.o: In function `eth_halt':
(.text.eth_halt+0x0): multiple definition of `eth_halt'
drivers/net/libnet.o:/home/schwierd/devel/u-boot/drivers/net/ne2000_base.c:721: first defined here
net/libnet.o: In function `eth_rx':
(.text.eth_rx+0x0): multiple definition of `eth_rx'
drivers/net/libnet.o:/home/schwierd/devel/u-boot/drivers/net/ne2000_base.c:729: first defined here
net/libnet.o: In function `eth_init':
(.text.eth_init+0x0): multiple definition of `eth_init'
drivers/net/libnet.o:/home/schwierd/devel/u-boot/drivers/net/ne2000_base.c:668: first defined here
net/libnet.o: In function `eth_send':
(.text.eth_send+0x0): multiple definition of `eth_send'
drivers/net/libnet.o:/home/schwierd/devel/u-boot/drivers/net/ne2000_base.c:734: first defined here
make: *** [u-boot] Error 1
/opt/codesourcery/mips-2011.03/bin/mips-linux-gnu-size: './u-boot': No such file
Configuring for tb0229 board...
flash.c:27:24: fatal error: asm/ppc4xx.h: No such file or directory
compilation terminated.
make[1]: *** No rule to make target `.depend', needed by `_depend'.  Stop.
make: *** [depend] Error 2
/opt/codesourcery/mips-2011.03/bin/mips-linux-gnu-size: './u-boot': No such file
Configuring for vct_premium - Board: vct, Options: VCT_PREMIUM
   text	   data	    bss	    dec	    hex	filename
 197880	  12100	 272852	 482832	  75e10	./u-boot
Configuring for vct_premium_small - Board: vct, Options: VCT_PREMIUM,VCT_SMALL_IMAGE
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
  88104	   3640	  14372	 106116	  19e84	./u-boot
Configuring for vct_premium_onenand - Board: vct, Options: VCT_PREMIUM,VCT_ONENAND
   text	   data	    bss	    dec	    hex	filename
 292552	  14564	 274068	 581184	  8de40	./u-boot
Configuring for vct_premium_onenand_small - Board: vct, Options: VCT_PREMIUM,VCT_ONENAND,VCT_SMALL_IMAGE
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
 181884	   6056	  15604	 203544	  31b18	./u-boot
Configuring for vct_platinum - Board: vct, Options: VCT_PLATINUM
   text	   data	    bss	    dec	    hex	filename
 197880	  12100	 272852	 482832	  75e10	./u-boot
Configuring for vct_platinum_small - Board: vct, Options: VCT_PLATINUM,VCT_SMALL_IMAGE
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
  88104	   3640	  14372	 106116	  19e84	./u-boot
Configuring for vct_platinum_onenand - Board: vct, Options: VCT_PLATINUM,VCT_ONENAND
   text	   data	    bss	    dec	    hex	filename
 292552	  14564	 274068	 581184	  8de40	./u-boot
Configuring for vct_platinum_onenand_small - Board: vct, Options: VCT_PLATINUM,VCT_ONENAND,VCT_SMALL_IMAGE
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
 181884	   6056	  15604	 203544	  31b18	./u-boot
Configuring for vct_platinumavc - Board: vct, Options: VCT_PLATINUMAVC
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
 118196	   4752	  15576	 138524	  21d1c	./u-boot
Configuring for vct_platinumavc_small - Board: vct, Options: VCT_PLATINUMAVC,VCT_SMALL_IMAGE
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
  87608	   3640	  14372	 105620	  19c94	./u-boot
Configuring for vct_platinumavc_onenand - Board: vct, Options: VCT_PLATINUMAVC,VCT_ONENAND
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
 213024	   7212	  16820	 237056	  39e00	./u-boot
Configuring for vct_platinumavc_onenand_small - Board: vct, Options: VCT_PLATINUMAVC,VCT_ONENAND,VCT_SMALL_IMAGE
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
   text	   data	    bss	    dec	    hex	filename
 181380	   6056	  15604	 203040	  31920	./u-boot
Configuring for qi_lb60 board...
cpu.c: In function '_machine_restart':
cpu.c:65:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
cpu.c:65:2: warning: large integer implicitly truncated to unsigned type
board.c: In function 'board_init_r':
board.c:266:8: warning: unused variable 's'
timer.c: In function 'reset_timer_masked':
timer.c:37:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
timer.c: In function 'get_timer_masked':
timer.c:43:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
timer.c: In function 'timer_init':
timer.c:86:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
timer.c:88:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
timer.c:89:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
timer.c:90:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
qi_lb60.c: In function 'cpm_init':
qi_lb60.c:72:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
qi_lb60.c:84:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
   text	   data	    bss	    dec	    hex	filename
 123064	   8304	   2528	 133896	  20b08	./u-boot

--------------------- SUMMARY ----------------------------
Boards compiled: 26
Boards with warnings or errors: 11 ( qemu_mips tb0229 vct_premium_small vct_premium_onenand_small vct_platinum_small vct_platinum_onenand_small vct_platinumavc vct_platinumavc_small vct_platinumavc_onenand vct_platinumavc_onenand_small qi_lb60 )
----------------------------------------------------------

 README                         |    6 ++++++
 arch/mips/cpu/mips32/config.mk |   21 +++++++++++++++------
 boards.cfg                     |    2 +-
 examples/standalone/Makefile   |    6 +++++-
 include/configs/pb1x00.h       |    2 ++
 5 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/README b/README
index 3ddec77..0e09842 100644
--- 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
 
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index 4d1b273..a1cd590 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -27,14 +27,23 @@
 # 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)
diff --git a/boards.cfg b/boards.cfg
index b678547..e99fde6 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -323,7 +323,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
 incaip                       mips        mips32      incaip              -              incaip
 incaip_100MHz                mips        mips32      incaip              -              incaip      incaip:CPU_CLOCK_RATE=100000000
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index e23865b..8c9e4cf 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -88,6 +88,10 @@ endif
 CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
 CFLAGS += $(CFLAGS_NTR)
 
+# Pass through endianness settings in LDFLAGS to LD
+LDFLAGS_ENDIAN += $(filter -EB,$(LDFLAGS))
+LDFLAGS_ENDIAN += $(filter -EL,$(LDFLAGS))
+
 all:	$(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
 
 #########################################################################
@@ -96,7 +100,7 @@ $(LIB):	$(obj).depend $(LIBOBJS)
 
 $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
-		$(LD) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
+		$(LD) $(LDFLAGS_ENDIAN) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
 
diff --git a/include/configs/pb1x00.h b/include/configs/pb1x00.h
index eea8ed3..d056884 100644
--- a/include/configs/pb1x00.h
+++ b/include/configs/pb1x00.h
@@ -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	*/
-- 
1.7.8

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3] MIPS: fix endianess handling
  2011-12-07 12:59 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
@ 2011-12-11 16:53   ` Daniel Schwierzeck
  2011-12-16 18:12     ` Mike Frysinger
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Schwierzeck @ 2011-12-11 16:53 UTC (permalink / raw)
  To: u-boot

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>
---
Changes for v3:
 - rebased against current master

Changes for v2:
 - moved CONFIG_SYS_LITTLE_ENDIAN from boards.cfg to configs/pb1x00.h
 - fixed typo in comment
 - updated patch summary

 README                         |    6 ++++++
 arch/mips/cpu/mips32/config.mk |   21 +++++++++++++++------
 boards.cfg                     |    2 +-
 examples/standalone/Makefile   |    6 +++++-
 include/configs/pb1x00.h       |    2 ++
 5 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/README b/README
index ff72e47..afcfc8f 100644
--- 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
 
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index 4d1b273..a1cd590 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -27,14 +27,23 @@
 # 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)
diff --git a/boards.cfg b/boards.cfg
index a0a2bba..cbeba0c 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -348,7 +348,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
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index e23865b..8c9e4cf 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -88,6 +88,10 @@ endif
 CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
 CFLAGS += $(CFLAGS_NTR)
 
+# Pass through endianness settings in LDFLAGS to LD
+LDFLAGS_ENDIAN += $(filter -EB,$(LDFLAGS))
+LDFLAGS_ENDIAN += $(filter -EL,$(LDFLAGS))
+
 all:	$(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
 
 #########################################################################
@@ -96,7 +100,7 @@ $(LIB):	$(obj).depend $(LIBOBJS)
 
 $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
-		$(LD) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
+		$(LD) $(LDFLAGS_ENDIAN) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
 
diff --git a/include/configs/pb1x00.h b/include/configs/pb1x00.h
index eea8ed3..d056884 100644
--- a/include/configs/pb1x00.h
+++ b/include/configs/pb1x00.h
@@ -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	*/
-- 
1.7.8

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH v3] MIPS: fix endianess handling
  2011-12-11 16:53   ` [U-Boot] [PATCH v3] " Daniel Schwierzeck
@ 2011-12-16 18:12     ` Mike Frysinger
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2011-12-16 18:12 UTC (permalink / raw)
  To: u-boot

On Sunday 11 December 2011 11:53:11 Daniel Schwierzeck wrote:
> --- 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.

might be useful to describe what these do.  something like:
Adds options to explicitly add compiler flags that select the desired 
endianness.  Otherwise, the endian will be whatever the toolchain defaults to.

> --- a/arch/mips/cpu/mips32/config.mk
> +++ b/arch/mips/cpu/mips32/config.mk
> 
> +ifdef CONFIG_SYS_LITTLE_ENDIAN
> +ENDIANNESS := -EL
> +endif
> +
> +ifdef CONFIG_SYS_BIG_ENDIAN
> +ENDIANNESS := -EB
> +endif

the GNU linker should treat -EL/-EB the same for all targets.  so we should be 
able to add to the common .mk files in the top level:
	LDFLAGS-$(CONFIG_SYS_LITTLE_ENDIAN) += -EL
	LDFLAGS-$(CONFIG_SYS_BIG_ENDIAN) += -EB
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111216/e7a4a6ac/attachment.pgp>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] MIPS: fix endianess handling
  2011-12-05  0:10       ` Daniel Schwierzeck
@ 2012-03-31 20:54         ` Marek Vasut
  0 siblings, 0 replies; 11+ messages in thread
From: Marek Vasut @ 2012-03-31 20:54 UTC (permalink / raw)
  To: u-boot

Dear Daniel Schwierzeck,

> On 12/04/2011 04:08 PM, Wolfgang Denk wrote:
> > Dear Shinya Kuribayashi,
> > 
> > In message<4EDB8475.1080305@pobox.com>  you wrote:
> >>>> -pb1000                       mips        mips32      pb1x00          
> >>>>    -              au1x00      pb1x00:PB1000 +pb1000                  
> >>>>     mips        mips32      pb1x00              -              au1x00
> >>>>      pb1x00:PB1000,SYS_LITTLE_ENDIAN
> > 
> > ...
> > 
> >> But I don't see any reason CONFIG_SYS_LITTLE_ENDIAN is specified in
> >> boards.cfg.  Just putting it in configs/pb1000.h is enough, isn't it?
> > 
> > Agreed.  In almost all cases this should be done in the board config
> > file only.  Only if there are cases where a board suppors both LE and
> > BE configurations (is there any such board??) then we should need a
> > SYS_*_ENDIAN setting in boards.cfg (but even then, only one - not
> > two).
> 
> I did this because of dbau1550 and dbau1550_el. For the pb1000 I'll
> move it to the board config.
> 
> > Best regards,
> > 
> > Wolfgang Denk

Will we see V2 of this patch please?

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-03-31 20:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-28 13:42 [U-Boot] [PATCH] MIPS: fix endianess handling Daniel Schwierzeck
     [not found] ` <CACUy__XYf2Zo3d0SQ7Ub-ea37C2X=gZ+bTMTX95vz+YdAeQhDw@mail.gmail.com>
2011-12-04 14:32   ` Shinya Kuribayashi
2011-12-04 15:08     ` Wolfgang Denk
2011-12-05  0:10       ` Daniel Schwierzeck
2012-03-31 20:54         ` Marek Vasut
     [not found] ` <4EDB5F86.40605@googlemail.com>
2011-12-04 15:06   ` Wolfgang Denk
2011-12-05  0:04     ` Daniel Schwierzeck
2011-12-05 10:05       ` Wolfgang Denk
2011-12-07 12:59 ` [U-Boot] [PATCH v2] " Daniel Schwierzeck
2011-12-11 16:53   ` [U-Boot] [PATCH v3] " Daniel Schwierzeck
2011-12-16 18:12     ` Mike Frysinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.