OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Simple C Programs On Big-endian Xscale
linnuxxy
post Nov 20 2005, 01:30 AM
Post #1





Group: Members
Posts: 5
Joined: 20-November 05
Member No.: 8,563



Im trying to develop programs to a target machine wth the following /proc/cpuinfo:

Processor : XScale-IXP4xx/IXC11xx rev 1 (v5b)
BogoMIPS : 266.24
Features : swp half thumb fastmult edsp

Hardware : iDirect Phoenix Platform
Revision : 0000
Serial : 0000000000000000

and uname -a:
Linux iDirect 2.4.24-uc0-iDirect0 #1 Fri Apr 29 16:01:03 GMT 2005 armv5b unknown

as it is Bigendian machine i use
/usr/local/arm-uclinux-tools2/arm-uclinux-elf/bin/atic -mbig-endian

to compile

the hello world is working fine.

i tired to compile a simple program

#include <stdio.h>

int main() {
printf("Hi: %d\n",0);
return 0;
}
the program had compiled well, but when i run the program on the target machine alot of rabush is showed out.

running the following program on the target shows "Segmentation fault" error
#include <stdio.h>

int main() {
char txt[]="Hi from Ahmad!\n";
sprintf(txt,"Hi: %d",0);
printf(txt);
return 0;
}
What is wrong and how to overcome this problem??!!
please help me!!
Go to the top of the page
 
+Quote Post
lardman
post Nov 20 2005, 03:21 AM
Post #2





Group: Members
Posts: 4,515
Joined: 25-October 03
From: Bath, UK
Member No.: 464



QUOTE
the program had compiled well, but when i run the program on the target machine alot of rabush is showed out.


Can you show us some of the output please?

Unless people here have experience with endian issues they won't be able to help except by logical reasoning (as all Zaurii run in littleendian mode, so I've never seen anything like this before).

You might get more exposure for this question by posting it to: http://www.arm.linux.org.uk/ (it's not Zaurus or Openembedded related yet). I'd also read the mailing list archives and see whether other people have experienced anything similar - search for bigendian.

But if anyone can help, then please chip in,


Si
Go to the top of the page
 
+Quote Post
linnuxxy
post Nov 20 2005, 04:24 AM
Post #3





Group: Members
Posts: 5
Joined: 20-November 05
Member No.: 8,563



I can narrow the problem;
after asking.. it sounds like a bug in the toolchain... which have been batched out

Can anyone show me where to find a tested toolchain to compile to armeb (armv5b) architecture???
Go to the top of the page
 
+Quote Post
lardman
post Nov 20 2005, 06:24 AM
Post #4





Group: Members
Posts: 4,515
Joined: 25-October 03
From: Bath, UK
Member No.: 464



Not likely from us as we are all littleendian.

I was asking about the output as if the code thought it was running in littleendian mode, %d might produce something interesting if the two halves of the number are switched (as the sign bit will produce something).


Si
Go to the top of the page
 
+Quote Post
linnuxxy
post Nov 20 2005, 11:01 PM
Post #5





Group: Members
Posts: 5
Joined: 20-November 05
Member No.: 8,563



QUOTE(lardman @ Nov 20 2005, 06:24 AM)
I was asking about the output as if the code thought it was running in littleendian mode, %d might produce something interesting if the two halves of the number are switched (as the sign bit will produce something).


The output is just like if u had cat a binary file....long one....
Go to the top of the page
 
+Quote Post
linnuxxy
post Nov 21 2005, 02:11 AM
Post #6





Group: Members
Posts: 5
Joined: 20-November 05
Member No.: 8,563



I could getover

I used crosstool 0.38
compile it using

export TARBALLS_DIR=/home/user/crosstool # where it will save source tarballs
export RESULT_TOP=/opt/crosstool # where it will install the tools
export GCC_LANGUAGES="c,c++,java,f77" # which languages it will make compilers for
cd /home/user/crosstool/crosstool-0.38
eval `cat armv5b-softfloat.dat gcc-3.4.0-glibc-2.3.2.dat` sh all.sh --notest

for more info http://kegel.com/crosstool/crosstool-0.38/...tool-howto.html

and it is working now
armv5b-softfloat-linux-gcc hello.c
Go to the top of the page
 
+Quote Post
lardman
post Nov 21 2005, 03:22 AM
Post #7





Group: Members
Posts: 4,515
Joined: 25-October 03
From: Bath, UK
Member No.: 464



Coll, glad you got it sorted - I'd be interested to know why you got all that binary stuff out though if you ever find out why.


Si
Go to the top of the page
 
+Quote Post
linnuxxy
post Nov 21 2005, 11:10 PM
Post #8





Group: Members
Posts: 5
Joined: 20-November 05
Member No.: 8,563



QUOTE(lardman @ Nov 21 2005, 03:22 AM)
Coll, glad you got it sorted - I'd be interested to know why you got all that binary stuff out though if you ever find out why.

Thank you, i think it is a bug in the crosstool or something... and the make apply the proper patch to it if i use the above building configureation...although im not sure...
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st October 2014 - 12:46 AM