2011-02-23 08:00:45     debugging over serial

Document created by Aaronwu Employee on Oct 16, 2013
Version 1Show Document
  • View in full screen mode

2011-02-23 08:00:45     debugging over serial

Chandrashekhar Lavania (INDIA)

Message: 98375   

 

Hi,

 

I am trying to debug applications running on the target. I used the following link as reference:

 

http://docs.blackfin.uclinux.org/doku.php?id=debuggers#debugging_via_serial_port

 

 

 

Now, I am able to do the debugging via the ethernet method, but there are some issues when I try to debug over serial.

 

 

 

Normally to connect with the target over serial I use minicom with the serial port as /dev/ttyUSB0.

 

Similarly in the case of the target the console is mapped to /dev/ttyBF0

 

 

 

Now in case of debugging over serial, I have to supply two set of ports:

 

1. On the host to tell through which port the host can connect to the target (which is running the gdbserver)

 

2. The port which the target uses to connect to the gdbserver running on itself.

 

 

 

Now if I use say /dev/tty0 for the case 2, and /dev/ttyUSB0 for case 1 , the whole process just sort of hangs and I am not able to get to the gdb prompt after doing     " target remote /dev/ttyUSB0"

 

On the target it  just says "Remote  debugging using /dev/tty0" and I guess it just waits.

 

 

 

How can I resolve this issue?

 

 

 

Regards,

 

Shekhar

 

PS: I try this from the telnet console and not the minicom one. For the target , the /dev/ttyBF0 is mapped to minicom console

 

PPS: There is only one physical serial UART for the target

QuoteReplyEditDelete

 

 

2011-02-23 12:28:48     Re: debugging over serial

Mike Frysinger (UNITED STATES)

Message: 98380   

 

you dont actually mean "/dev/tty0" do you ?  that is a virtual terminal and not the serial port.  you must use "/dev/ttyBF0".

 

if you're trying to run stdin/stdout on the UART at the same time, you're going to have problems.  you could try and redirect everything to /dev/null while debugging, but it's easier to simply use ppp:

http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:ppp

QuoteReplyEditDelete

 

 

2011-02-24 00:27:47     Re: debugging over serial

Chandrashekhar Lavania (INDIA)

Message: 98381   

 

Hi Mike,

 

I was under the impression that since the gdbserver is running on the target itself, there is no need for an actual uart and a virtual device would be sufficient to connect to the gdbserver from the target.

 

Now I tried:

 

gdbserver /dev/ttyBF0 <program name>

 

on my target and I did

 

target remote /dev/ttyUSB0

 

on the gdb prompt on my host and I still get the same problem. The host terminal just hangs and I cannot get to the next gdb prompt, while the target just waits saying "Remote debugging using /dev/ttyBF0" .

 

I used telnet to enter the target, so I assume that the /dev/ttyBF0 should be free as it maps to the minicom terminal.

 

 

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-02-24 01:08:43     Re: debugging over serial

Chandrashekhar Lavania (INDIA)

Message: 98383   

 

Hi,

 

I just wanted to add that normally when I transmit some data from target over /dev/ttyBF0 , I can read it from /dev/ttyUSB0 on the host. To avoid the data reception at minicom terminal, I use telnet to get into the target.

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-02-24 04:59:26     Re: debugging over serial

Stuart Henderson (UNITED KINGDOM)

Message: 98395   

 

a couple of quick questions for clarification:

 

1- when you launch gdb, are you launching it with the correct privileges to access the serial port?

e.g. sudo bfin-uclinux-gdb -b 57600 a.out.gdb

 

2- what baud rate are you using?

 

3- what version of the tools/kernel/u-boot are you using?  i'm testing using 2010R1 without any problems.

 

Thanks,

 

Stu

QuoteReplyEditDelete

 

 

2011-02-24 05:36:00     Re: debugging over serial

Chandrashekhar Lavania (INDIA)

Message: 98397   

 

Hi Stu,

 

1. Yes, the priviledges are correct as I run minicom in a similar fashion. Also If I try any other port I get the error "Permission Denied", which I do not get in this case.

 

2. I'm using 115200

 

3. I'm using 2010R1-RC4.

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-02-24 06:45:10     Re: debugging over serial

Stuart Henderson (UNITED KINGDOM)

Message: 98399   

 

Can you give me the output from the following command line:

 

root:/>  dmesg | grep tty

QuoteReplyEditDelete

 

 

2011-02-24 07:03:33     Re: debugging over serial

Chandrashekhar Lavania (INDIA)

Message: 98400   

 

Hi Stu,

 

 

 

Now, as I said the target hangs after I start gdbserver . It just says "Remote debugging using /dev/ttyBF0" and hangs...I guess it waits for signal from the host. I have to restart it to get anything done. The result of the dmesg query after restartng the system is the following

 

 

 

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000 earlyprintk=serial,uart1,115200 console=ttyBF0,115200 ip=192.168.1.85:192.168.1.8:192.168.1.2:255.255.255.0:bf527-ezkit:eth0:off

 

console [ttyBF0] enabled, bootconsole disabled

 

bfin-uart.1: ttyBF0 at MMIO 0xffc02000 (irq = 31) is a BFIN-UART

 

Regards,

Shekhar

 

PS: RAMfs is being used

QuoteReplyEditDelete

 

 

2011-02-24 07:58:16     Re: debugging over serial

Stuart Henderson (UNITED KINGDOM)

Message: 98401   

 

>>Now, as I said the target hangs after I start gdbserver . It just says "Remote debugging using /dev/ttyBF0" and hangs...I guess it waits for signal from the host.

 

Yep, don't worry.  It hasn't hung, it's just waiting for a connection.

 

 

 

In my experience usb->serial adapters are incredibly flakey.  i believe a lot of them don't work reliably above 57.6k baud.  have you tried lowering the baudrate on the board and then connecting at that?

QuoteReplyEditDelete

 

 

2011-02-24 08:22:14     Re: debugging over serial

Mike Frysinger (UNITED STATES)

Message: 98402   

 

you cannot run a shell on the serial port and attempt to use gdbserver at the same time.  stop using console=ttyBF0, or launching a shell on it.

QuoteReplyEditDelete

 

 

2011-02-28 01:34:31     Re: debugging over serial

Chandrashekhar Lavania (INDIA)

Message: 98461   

 

Hi,

 

Ok, so I removed console=ttyBF0, and tried to run the debugging at baud rate 57600.

 

This works, but there are some prob;ems with it.

 

It only works if I run a script which sets serial connection properties like baudrate, ONCLR, stop bits, parity etc. The script basically initializes the serial deice /dev/ttyBF0 with these properties .

 

After running this script, I can connect to the gdbserver via serial.

 

 

 

If I do not run this script, then I get the following messages at my host:

 

Remote debugging using /dev/ttyUSB0

 

Ignoring packet eror, continuing......

 

warning: unrecognized item "timeout" in "qSupported" response

 

 

 

Therefore is there any environment variable or something which I need to set for serial before doing this debugging??

 

 

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-02-28 11:27:36     Re: debugging over serial

Mike Frysinger (UNITED STATES)

Message: 98475   

 

env vars really have no bearing at all on serial configuration.  what you describe is correct behavior.  simply run `stty` yourself in /etc/rc or wherever to make sure the serial is configured appropriately.

QuoteReplyEditDelete

Attachments

    Outcomes