Pthread dynamic linking problem

2004-11-24 Thread Iñigo Lopez Barranco
Hi.

We're using use ELDK 3.0 with kernel linuxppc_2_4_devel from DENX CVS on a 
Lite5200 board.
The problem arises linking a program with a library using fopen and the pthread 
lib dynamically. My program gets stucked when doing a fopen call. This doesn't 
happen if the linking is static (against .a).
Here are an example library and program that show this problem:

* The main program is:

//
// cositas.cpp
//
#include 
#include 

void Polopos(char *fname);

int main(int argc, char **argv)
{
  pthread_t th;

// Do things
Polopos("/etc/AVMRecorder.conf");

  return 0;
}

* The library it uses along with pthread lib is:

// 
// acasitos.cpp
//
#include 

void Polopos(char *foo)
{
fprintf(stderr, "Opening file %s...\n", foo);
FILE* cositas = fopen(foo, "rt");
fprintf(stderr, "...file %s open\n", foo);
fprintf(stderr, "Closing file %s...\n", foo);
fclose(cositas);
fprintf(stderr, "...file %s closed\n", foo);
}

* To build the shared lib I issue the following commands:

 @ /usr/local/ppc_82xx/bin/ppc_82xx-g++ -c -o acasitos.o 
-I/usr/local/ppc_82xx/local/include acasitos.cpp
 @ /usr/local/ppc_82xx/bin/ppc_82xx-ld -o libacasitos.so acasitos.o

* And for the final binary:

 @ /usr/local/ppc_82xx/bin/ppc_82xx-g++ -o cositas -L. 
-I/usr/local/ppc_82xx/local/include -lpthread -lacasitos cositas.cpp


* The output for the program is:

 Opening file /etc/AVMRecorder.conf...

* The output of strace is:

execve("./cositas", ["./cositas"], [/* 20 vars */]) = 0
uname({sys="Linux", node="localhost", ...}) = 0
brk(0)  = 0x10011c68
open("/etc/ld.so.preload", O_RDONLY)= -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=11995, ...}) = 0
mmap(NULL, 11995, PROT_READ, MAP_PRIVATE, 3, 0) = 0x30015000
close(3)= 0
open("/lib/libpthread.so.0", O_RDONLY)  = 3
read(3, "[EMAIL PROTECTED]"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=1416528, ...}) = 0
mmap(0xff8f000, 395776, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xff8f000
mprotect(0xff9d000, 338432, PROT_NONE)  = 0
mmap(0xff9f000, 69632, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 
3, 0) = 0xff9f000
mmap(0xffb, 260608, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffb
close(3)= 0
open("/usr/local/lib/libacasitos.so", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\0\4"..., 1024) = 
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=3141, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x30018000
mmap(0xff6e000, 67136, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xff6e000
mprotect(0xff6f000, 63040, PROT_NONE)   = 0
mmap(0xff7e000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 
0) = 0xff7e000
close(3)= 0
open("/usr/lib/libstdc++.so.5", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\4C\250"..., 1024) = 
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=809956, ...}) = 0
mmap(0xfe82000, 898616, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xfe82000
mprotect(0xff35000, 165432, PROT_NONE)  = 0
mmap(0xff42000, 86016, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 
3, 0xb) = 0xff42000
mmap(0xff57000, 26168, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xff57000
close(3)= 0
open("/lib/libm.so.6", O_RDONLY)= 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\0\242"..., 1024) = 
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=497740, ...}) = 0
mmap(0xfdec000, 545232, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xfdec000
mprotect(0xfe5f000, 74192, PROT_NONE)   = 0
mmap(0xfe6c000, 20480, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 
3, 0x7) = 0xfe6c000
mmap(0xfe71000, 464, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xfe71000
close(3)= 0
open("/lib/libc.so.6", O_RDONLY)= 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\1\300"..., 1024) = 
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=1363888, ...}) = 0
mmap(0xfc8d000, 1370128, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xfc8d000
mprotect(0xfdc4000, 96272, PROT_NONE)   = 0
mmap(0xfdcd000, 49152, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 
3, 0x13) = 0xfdcd000
mmap(0xfdd9000, 10256, PROT_READ|PROT_WRITE|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xfdd9000
close(3)= 0
mprotect(0xfc8d000, 1273856, PROT_READ|PROT_WRITE) = 0
mprotect(0xfc8d000, 1273856, PROT_READ|PROT_EXEC) = 0
mprotect(0xff6e000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0xff6e000, 4096, PROT_READ|PROT_EXEC) = 0
munmap(0x30015000, 11995)   = 0
getpid()=

Ethernet on 5200 is using DMA?

2004-11-18 Thread Iñigo Lopez Barranco
Hi. I'm using linuxppc_2_4_devel from Denx CVS on a Lite5200 board.
When doing "put" of a large file to a ftp server, ftp eats all the CPU 
available (90%+). I suspect it's not using DMA for the ethernet. Is this right?
Thanks in advance.

I?igo



Hang in send() to a socket

2004-07-23 Thread Iñigo Lopez Barranco

Hi. I'm testing a program to send files thru a TCP socket on an MPC5200. The 
program itself is quite simple: reads block from file, adds headers for a 
custom protocol, and sends the packet to the socket.
This works without problems on x86 architecture, but in PPC, the programs stops 
forever in one of the writings to the socket after having sent a random number 
of packets. Strace says that it stops on a send(), and netstat shows that the 
connection is stablished, and stays this way:
Proto Recv-Q Send-Q Local Address   Foreign Address State
tcp0  63903 160.100.100.169:12700   160.100.100.189:41097   ESTABLISHED
Until the kernel destroys the socket. The program isn't hanged, and it detects 
when the socket closes (Connection timed out) if you wait enough, and exits 
properly. It just stops in send().

Is there any know problem with this on the MPC5200?
The platform is a Lite5200, and kernel linuxppc_2_4_devel from Denx CVS.
Thanks

I?igo

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





Little survey: SCM systems?

2004-07-14 Thread Iñigo Lopez Barranco

Hi.
I would like to know which software configuration system (SCM) have you people 
tried. I found a nice comparison between different systems in 
http://better-scm.berlios.de/comparison/ and Vesta seems really interesting. 
Anyone has tried it?
We're using CVS right now, but it has some limitations wich can become quite 
bothering. Also, we have to compile for several different platforms, using 
different toolchains, etc. Any SCM that you would recommend for this kind of 
development.
Thanks in advance.

I?igo

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





Kernel oops with MPC5200 UDMA. How to debug?

2004-06-24 Thread Iñigo Lopez Barranco

Hi.
We get this kernel oops when using UDMA on a Lite5200 board even if the FEC 
support is not in the kernel.
At this moment, we're using a Lite5200 with a Realtek 8139 instead of the 
5200's FEC for ethernet. To test this problem we do an infinite loop with 
'hdparm -t /dev/hda' with DMA on. This provokes a kernel oops (see end of mail) 
if eth0 is up, but if we shut down the eth0 before the test, it works with no 
problems.
Also, we get the kernel oops when using heavily the ethernet and the IDE DMA is 
activated (for example, doing 'find /' on a telnet console, will give an oops 
with different values for TASK, like swapper, or in.telnetd), but not if the 
IDE DMA is off.
Seems that the DMA is still broken even if the FEC support is disabled.
Is there a way to find where the problem is without using a BDI? We don't have 
any of those tools yet, but a Metrowerks wiretap which seems to be not 
supported on linux.
This is one of the several oops we see:

Caused by (from SRR1=41000): Transfer error ack signal
Oops: machine check, sig: 7
NIP: C00C91B4 XER:  LR: C0004F3C SP: C3047D10 REGS: c3047c60 TRAP: 0200 
   Not tainted
MSR: 00041000 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00
TASK = c3046000[616] 'hdparm' Last syscall: 3
last math c3046000 last altivec 
GPR00: C0004F3C C3047D10 C3046000  C3FF3C00 C3047DA0 300A14BC 
GPR08: F0001200 C01C F500 C000C154 24002842 1001F27C  
GPR16: 0004 0001 C0025B84 C3002100 1032 03047D90  C0003E40
GPR24:  4074 C3FF3D60 0014 C3FF3C00 403E 4000 
Call backtrace:
C00D5710 C0004F3C C0005000 C0003E40  C00255C4 C0025CF4
C0035154 C0003BFC  10001A78 1000270C 100037BC 0FEBCF6C

Kernel panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing
 <0>Rebooting in 180 seconds..

Thanks.

I?igo

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





Lite5200 USB with Vbus=1.7V

2004-06-22 Thread Iñigo Lopez Barranco

I'll answer myself. At first sight, seems that connecting pin 3 to GND is 
enough to make USB work. Thanks anyway.
I?igo

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





Lite5200 USB with Vbus=1.7V

2004-06-22 Thread Iñigo Lopez Barranco

Hi again.
I been trying to use a Kingston USB stick with the Lite5200, but it's not seen 
from linux nor from u-boot, though it works without problems on any linux PC.

The USB diode (D85 on schematics) is off, and I've found that Vbus in the USB 
connector, coming from pins 6 and 8 of the MIC2025 (U27) is only ~1.7V. Could 
anyone compare this value with a Lite5200 working USB?

The voltage input (pin 7) of the MIC2025 chip (U27) is 5V, and the enable (pin 
1 connected to USB1_PORTPWR_S in the MPC5200) has 3.3V. The pin 2 FLG output is 
3.1V and is active low, so it's telling the MPC5200 that there is no 
overcurrent, right?

The only strange thing is that in Motorola's schematics says that pins 3 and 5 
of the Micrel 2025 are Not Connected and 4 is GND, and Micrel's 2025 datasheet 
says that 3 is GND and 4 and 5 NC.
Then, in the Lite5200 GND pin 3 is connected to GND through an 1k resistor, 
instead of directly as I suppose they pretended in the schematic, and 4 NC pin 
is conected directly to GND. I'm not sure if this might be the cause of the 
problen, but placing an oscilloscope probe between pin 3 and GND shows a 2V 
periodic signal with ton=4us and toff=10us approx. Is this a known problem or 
my board has something broken? (don't think I can connect anything upside down 
this time).
Thank you.

I?igo

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





Lite5200 PCI not working

2004-06-21 Thread Iñigo Lopez Barranco

>I don't understand, what do you mean "with both power LEDs off",
> the LEDs on the Lite5200? If yes, then I guess you have a problem!

Yes, I mean that. If the PCI card is plugged in the slot, when I connect the 
power, the LEDs in the Lite5200 board for 5V and 3.3V stay off. Without the PCI 
card, the Lite5200 works fine.

> And of course it should be inserted correctly - sorry if this is too obvious!

I think it is, but just to be sure: when I plug the card the RJ45 connector is 
in the side of the IDE connector of the Lite5200, in the opposite side of the 
"short part" of the PCI connector. Right?

> One card, that is known to work in this slot is the Intel eepro100 NIC.

I'll try to get ont of those, though I'm not sure if the timing problems in the 
PCI bus may cause the problem I'm seeing with this board. Thanks.

Ciao,
  Gerhard


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





Lite5200 PCI not working

2004-06-21 Thread Iñigo Lopez Barranco

Hi.
I've bought a 3.3V PCI ethernet card (US Robotics 7900) and tried to use it 
with the Lite5200 kit, but when I power it, it doesn't even turn on, with both 
power LEDs (3.3V and 5V) off. What may be the problem and where should I look 
for it?
Thanks.

I?igo

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





MPC5200 PCI questions

2004-06-16 Thread Iñigo Lopez Barranco

Hi.
Is it possible, with the present version of BestComm, to use DMA for IDE and 
PCI at the same time?
As is not possible to use IDE DMA and the integrated FEC at this moment, I'm 
thinking of using the integrated ATA controller in the MPC5200 with DMA for an 
IDE disk and the PCI controller to interface to a PCI to ethernet transceiver 
in a custom board. Is this possible? Any recommended transceiver to use with 
linux and the MPC5200?.
Also, I would like to know if there is a known to work PCI ethernet card 
(10/100 if possible) for use with the Lite5200 kit, supported by linux.
Thanks in advance.

I?igo

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/