[ELDK] Crosstool for MIPS exception in "run time"

Wolfgang Denk wd at denx.de
Sat Dec 1 16:21:34 CET 2007

Hello Bemipefe (?),

in message <47517109.5050701 at libero.it> you wrote:
> In First, thank you for your help.

You are welcome.

> Maybe i have bad posted the problem, but i think that this is a compile 
> problem.
> Now retry with a simple Hello World:
> That is:
> ----------------------------------------------------------
> #include <stdlib.h>
> #include <stdio.h>
> void main()
> {
> printf("Hello World!");
> }
> ----------------------------------------------------------
> I compile in the default way:
> mips-linux-gcc -EL -I $HOME/Programs/mipstools/mips_4KCle/usr/include/ 
> my_hello.c -o my_hello

This is not exactly the default way.

If you read the documentation you see that you are supposed to

1) set and export the CROSS_COMPILE environment variable. I guess you 
   might have done that but I cannot see it in the example you quote.

2) You do not have to add compiler options like "-EL" or an explicit
   include patch to your command line  - the ELDK cross compiler knows
   about this automatically if you use it correctly.

So your commdns should read:

$ export CROSS_COMPILE=mips_4KCle-
$ mips_4KCle-gcc -o my_hello my_hello.c

> Then if i try to run mips-linux-run my_hello, i receive:
> mips-core: 4 byte read to unmapped address 0x400510 at 0x400510
> program stopped with signal 7.
> the same error by gxemul:
> [ exception TLBL <tlb> vaddr=0x00400510 pc=0x00400510 <__start> ]
> I think that there is a wrong ELF. We can do a proof. If you compile 
> this "hello world" and your machine not have an error in run time
> send me the executable. If my machine fail there is any problem in my 
> computer. But if it's not this case ?

Here is what I get:

On the cross host:

-> cat my_hello.c
#include <stdlib.h>
#include <stdio.h>

void main()

printf("Hello World!");

-> export CROSS_COMPILE=mips_4KCle-
-> mips_4KCle-gcc -o my_hello my_hello.c
my_hello.c: In function 'main':
my_hello.c:7: warning: return type of 'main' is not 'int'
-> ls -l my_hello
-rwxr-xr-x  1 wd denx 70859 Dec  1 16:14 my_hello
-> file my_hello
my_hello: ELF 32-bit LSB executable, MIPS, version 1 (SYSV), for GNU/Linux 2.4.3, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped

On the target:

DENX ELDK version 4.1 build 2007-01-21
Linux 2.6.22-gbcfc8d37-dirty on a mips
bash-3.00# cd /tmp
bash-3.00# ls -l my*
-rwxr-xr-x  1  500  500 70859 Dec  1  2007 my_hello
-rw-r--r--  1  500  500    86 Dec  1  2007 my_hello.c
bash-3.00# ./my_hello
Hello World!bash-3.00# 

This looks absolutely OK to me...

> Have you the same problem with mips-2007-01-21.iso ?

No, it's working perfectly fine here.

> What's your steps for compiling ?

See above - I just follow the documentation in the manual, btw.

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
"...this does not mean that some of us should not want, in  a  rather
dispassionate sort of way, to put a bullet through csh's head."
                   - Larry Wall in <1992Aug6.221512.5963 at netlabs.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: my_hello.gz
Type: application/x-gzip
Size: 3018 bytes
Desc: my_hello.gz
Url : http://lists.denx.de/pipermail/eldk/attachments/20071201/b691e621/attachment.bin 

More information about the eldk mailing list