[U-Boot-Users] Compiled system and target board mismatched while make U-boot image..

Dear Thomas,
I make my U-boot image from PC to DBAu1550, I used GCC 3.4.4, with mipsel-linux-sdelinux-6.03.01-1 toolchain, while I make my U-boot image with U-boot-1.1.4, I got the following messages:
mipsel-linux-ld: hello_world.o: compiled for a little endian system and target is big endian mipsel-linux-ld: hello_world.o: endianness incompatible with that of the selected emulation mipsel-linux-ld: failed to merge target specific data of file hello_world.o
I searched for related articles on U-Boot Website and Mailing lists, but I can't find out any helpful messages to fix the problem. Did I miss some patches? Do you have the reference material for this problem? Thanks a lot.
Charles C.K. Lai

Hi.
Use dbau1550 for big endian version.
Use dbau1550_el for little endian version.
Your toolchain is little endian.
Regards, /Thomas
Charles C.K.Lai wrote:
Dear Thomas,
I make my U-boot image from PC to DBAu1550, I used GCC 3.4.4, with mipsel-linux-sdelinux-6.03.01-1 toolchain, while I make my U-boot image with U-boot-1.1.4, I got the following messages: mipsel-linux-ld: hello_world.o: compiled for a little endian system and
target is big endian mipsel-linux-ld: hello_world.o: endianness incompatible with that of the selected emulation mipsel-linux-ld: failed to merge target specific data of file hello_world.o
I searched for related articles on U-Boot Website and Mailing lists, but I can't find out any helpful messages to fix the problem. Did I miss some patches? Do you have the reference material for this
problem? Thanks a lot.
Charles C.K. Lai

Dear Thomas
From: Thomas Lange thomas@corelatus.se Subject: [U-Boot-Users] Re: Compiled system and target board mismatched while make U-boot image.. Date: Thu, 06 Apr 2006 11:03:54 +0200 Message-Id: 4434D97A.6070701@corelatus.se
Hi.
Use dbau1550 for big endian version.
Use dbau1550_el for little endian version.
Your toolchain is little endian.
No. I think problems are in linker script.
I use sdelinux-5.03.06-1 (gcc-2.96) and gcc-3.3.4 from uClibc toolchain. both compiler needs to apply attached changes.
Maybe your compiler can generate a file for little-endian code to big-endian binary format. but sdelinux or uClibc toolchain are not.
Please report If your compiler does not have problems with this patch, if it is noproblem, consider to marge this. > support@denx.de
What I change is: remove OUTPUT_FORMAT: It will use default format. remove -EL or -EB : It will use toolchain default.
-------- Hiroshi Ito Media Lab. Inc., URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256
diff --git a/board/dbau1x00/u-boot.lds b/board/dbau1x00/u-boot.lds index 10c9917..0f17f80 100644 --- a/board/dbau1x00/u-boot.lds +++ b/board/dbau1x00/u-boot.lds @@ -23,8 +23,8 @@
/* OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips") -*/ OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips") +*/ OUTPUT_ARCH(mips) ENTRY(_start) SECTIONS diff --git a/cpu/mips/config.mk b/cpu/mips/config.mk index c357615..9ae20bd 100644 --- a/cpu/mips/config.mk +++ b/cpu/mips/config.mk @@ -21,7 +21,7 @@ # MA 02111-1307 USA # v=$(shell \ -mips-linux-as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}') +${CROSS_COMPILE}as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}') MIPSFLAGS=$(shell \ if [ "$v" -lt "14" ]; then \ echo "-mcpu=4kc"; \ @@ -29,12 +29,6 @@ else \ echo "-march=4kc -mtune=4kc"; \ fi)
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) -ENDIANNESS = -EL -else -ENDIANNESS = -EB -endif - MIPSFLAGS += $(ENDIANNESS) -mabicalls
PLATFORM_CPPFLAGS += $(MIPSFLAGS) diff --git a/examples/Makefile b/examples/Makefile index fee2674..b3f20c3 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -34,7 +34,7 @@ LOAD_ADDR = 0xc100000 endif
ifeq ($(ARCH),mips) -LOAD_ADDR = 0x80200000 -T mips.lds +LOAD_ADDR = 0x80200000 -L $(gcclibdir) -T mips.lds endif
ifeq ($(ARCH),nios) diff --git a/examples/mips.lds b/examples/mips.lds index 9d9849b..24d0f27 100644 --- a/examples/mips.lds +++ b/examples/mips.lds @@ -21,10 +21,6 @@ * MA 02111-1307 USA */
-/* -OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips") -*/ -OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips") OUTPUT_ARCH(mips) SECTIONS {

ito@mlb.co.jp wrote:
Use dbau1550 for big endian version.
Use dbau1550_el for little endian version.
Your toolchain is little endian.
No. I think problems are in linker script.
I use sdelinux-5.03.06-1 (gcc-2.96) and gcc-3.3.4 from uClibc toolchain. both compiler needs to apply attached changes.
Maybe your compiler can generate a file for little-endian code to big-endian binary format. but sdelinux or uClibc toolchain are not.
Please report If your compiler does not have problems with this patch, if it is noproblem, consider to marge this. > support@denx.de
What I change is: remove OUTPUT_FORMAT: It will use default format. remove -EL or -EB : It will use toolchain default.
This is not a dbau1550 question IMHO. It is an endian question for mips platforms and I am not qualified to determine if it is correct or not. I use big endian and ELDK ;-)
Wolfgang?
Regards, /Thomas

In message 44357A9C.8010907@corelatus.se you wrote:
This is not a dbau1550 question IMHO. It is an endian question for mips platforms and I am not qualified to determine if it is correct or not. I use big endian and ELDK ;-)
Wolfgang?
Yessir!! I'm here at work. What's up?
Ummm... What shall I say? ELDK for MIPS supports both LE and BE configurations, and both work just fine, except for the fact that the dbau1x00 port produces warnings because it is broken as it uses a definition of HZ which is not 1000:
-> export CROSS_COMPILE=mips_4KC- -> ./MAKEALL dbau1550 Configuring for dbau1x00 board... net.c: In function `NetStartAgain': net.c:597: warning: integer overflow in expression xyzModem.c: In function `xyzModem_stream_open': xyzModem.c:455: warning: unused variable `console_chan' text data bss dec hex filename 127896 4548 22864 155308 25eac u-boot
-> export CROSS_COMPILE=mips_4KCle- -> ./MAKEALL dbau1550_el Configuring for dbau1x00 board... net.c: In function `NetStartAgain': net.c:597: warning: integer overflow in expression xyzModem.c: In function `xyzModem_stream_open': xyzModem.c:455: warning: unused variable `console_chan' text data bss dec hex filename 130072 4548 22864 157484 2672c u-boot
IMHO it's clearly a toolchain problem, but who am I to know such things?
Best regards,
Wolfgang Denk

Hello Wolfgang
Ummm... What shall I say? ELDK for MIPS supports both LE and BE configurations, and both work just fine, except for the fact that the
Thank you for reply.
ELDK user is ok. but with mipsel-linux-gcc, and to comile for little, there is a 2 problem.
1. always add -EB to compiler.
-- cpu/mips/config.mk --- ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) ENDIANNESS = -EL else ENDIANNESS = -EB endif
this means, to compile for little endian, part of cross compiler name have to has a name of "4KCle". otherwise, it will put -EB.
I think, we do not need to put -EL or -EB, compiler default is enough.
2. examples/mips.lds、board/dbau1x00/u-boot.lds
OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips")
this specify bigendian format.
mipsel-linux-ld -g -Ttext 0x80200000 -T mips.lds \ -o hello_world -e hello_world hello_world.o libstubs.a \ -L/usr/src/mldbox/gcc-3.3.x/toolchain_mipsel/bin-ccache/../lib/gcc-lib/mipsel-linux-uclibc/3.3.4 -lgcc mipsel-linux-ld: hello_world.o: compiled for a little endian system and target is big endian mipsel-linux-ld: hello_world.o: endianness incompatible with that of the selected emulation File in wrong format: failed to merge target specific data of file hello_world.omipsel-linux-ld: libstubs.a(stubs.o): compiled for a little endian system and target is big endian mipsel-linux-ld: libstubs.a(stubs.o): endianness incompatible with that of the selected emulation File in wrong format: failed to merge target specific data of file libstubs.a(stubs.o)
To fix these error, I need to change OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips") to OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradlittlemips", "elf32-tradlittlemips")
or deleteing this line also work. so, if ELDK works, without this line, please delete it.
-------- Hiroshi Ito Media Lab. Inc., URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256
dbau1x00 port produces warnings because it is broken as it uses a definition of HZ which is not 1000:
-> export CROSS_COMPILE=mips_4KC- -> ./MAKEALL dbau1550 Configuring for dbau1x00 board... net.c: In function `NetStartAgain': net.c:597: warning: integer overflow in expression xyzModem.c: In function `xyzModem_stream_open': xyzModem.c:455: warning: unused variable `console_chan' text data bss dec hex filename 127896 4548 22864 155308 25eac u-boot
-> export CROSS_COMPILE=mips_4KCle- -> ./MAKEALL dbau1550_el Configuring for dbau1x00 board... net.c: In function `NetStartAgain': net.c:597: warning: integer overflow in expression xyzModem.c: In function `xyzModem_stream_open': xyzModem.c:455: warning: unused variable `console_chan' text data bss dec hex filename 130072 4548 22864 157484 2672c u-boot
IMHO it's clearly a toolchain problem, but who am I to know such things?
Best regards,
Wolfgang Denk
-- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de We fight only when there is no other choice. We prefer the ways of peaceful contact. -- Kirk, "Spectre of the Gun", stardate 4385.3
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd_________________________________________... U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users

# Sorry, I put a Japanese character in last mail. # Sending again
Hello Wolfgang
Ummm... What shall I say? ELDK for MIPS supports both LE and BE configurations, and both work just fine, except for the fact that the
Thank you for reply.
ELDK user is ok. but with mipsel-linux-gcc, and to comile for little, there is a 2 problem.
1. always add -EB to compiler.
-- cpu/mips/config.mk --- ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) ENDIANNESS = -EL else ENDIANNESS = -EB endif
this means, to compile for little endian, part of cross compiler name have to has a name of "4KCle". otherwise, it will put -EB.
I think, we do not need to put -EL or -EB, compiler default is enough.
2. examples/mips.lds, board/dbau1x00/u-boot.lds
OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips")
this specify bigendian format.
mipsel-linux-ld -g -Ttext 0x80200000 -T mips.lds \ -o hello_world -e hello_world hello_world.o libstubs.a \ -L/usr/src/mldbox/gcc-3.3.x/toolchain_mipsel/bin-ccache/../lib/gcc-lib/mipsel-linux-uclibc/3.3.4 -lgcc mipsel-linux-ld: hello_world.o: compiled for a little endian system and target is big endian mipsel-linux-ld: hello_world.o: endianness incompatible with that of the selected emulation File in wrong format: failed to merge target specific data of file hello_world.omipsel-linux-ld: libstubs.a(stubs.o): compiled for a little endian system and target is big endian mipsel-linux-ld: libstubs.a(stubs.o): endianness incompatible with that of the selected emulation File in wrong format: failed to merge target specific data of file libstubs.a(stubs.o)
To fix these error, I need to change OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips") to OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradlittlemips", "elf32-tradlittlemips")
or deleteing this line also work. so, if ELDK works, without this line, please delete it.
-------- Hiroshi Ito Media Lab. Inc., URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256
dbau1x00 port produces warnings because it is broken as it uses a definition of HZ which is not 1000:
-> export CROSS_COMPILE=mips_4KC- -> ./MAKEALL dbau1550 Configuring for dbau1x00 board... net.c: In function `NetStartAgain': net.c:597: warning: integer overflow in expression xyzModem.c: In function `xyzModem_stream_open': xyzModem.c:455: warning: unused variable `console_chan' text data bss dec hex filename 127896 4548 22864 155308 25eac u-boot
-> export CROSS_COMPILE=mips_4KCle- -> ./MAKEALL dbau1550_el Configuring for dbau1x00 board... net.c: In function `NetStartAgain': net.c:597: warning: integer overflow in expression xyzModem.c: In function `xyzModem_stream_open': xyzModem.c:455: warning: unused variable `console_chan' text data bss dec hex filename 130072 4548 22864 157484 2672c u-boot
IMHO it's clearly a toolchain problem, but who am I to know such things?
Best regards,
Wolfgang Denk
-- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de We fight only when there is no other choice. We prefer the ways of peaceful contact. -- Kirk, "Spectre of the Gun", stardate 4385.3
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd_________________________________________... U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&da... _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users

Dear Thomas,
My procedure is:
make dbau1550_el_config make dep make all
and I modified the following files to fit the toolchain:
Makefile: ifeq ($(ARCH),mips) CROSS_COMPILE = mipsel-linux-
cpu/mips/config.mk: v=$(shell \ mipsel-linux-as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}')
ifneq (,$(findstring mipsel,$(CROSS_COMPILE)))
Do I miss some files to meet the toolchain? Thanks a lot.
Charles C.K. Lai
participants (4)
-
Charles C.K.Lai
-
ito@mlb.co.jp
-
Thomas Lange
-
Wolfgang Denk