This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

gdbserver Fails With Serial On AM3517 Experimenter Linux SDK

Other Parts Discussed in Thread: AM3517

I can successfully run gdbserver on the AM3517 Experimenter over TCP on port 10000.

However, eth0 is needed in my application so I have a need to use one of the serial ports for gdb.

I tried /dev/ttyS2 (console) as below - see error below

 

root@am3517-evm:~# gdbserver /dev/ttyS2 /usr/bin/HelloWorld.elf

Process /usr/bin/HelloWorld.elf created; pid = 1509

Remote debugging using /dev/ttyS2

readchar: Socket operation on non-socket

Remote side has terminated connection.  GDBserver will reopen the connection.

Remote debugging using /dev/ttyS2

...

 

I also tried /dev/ttyS0 and /dev/ttyS1 (are these the USB ports?) with the same error.

There appears to be no man page for gdbserver so not sure if I am setting something wrong.

 

Any suggestions on how to get gdbserver to work over serial?

  • Hi,

    There's only one UART brought out on the AM3517 Experimenter available either on the DSUB9 or the Debug USB B port. The other UARTs exist on the AM3517 and are initialized but are not available for use (see schematic). In this case, to use the exposed serial port for both console and gdbserver (RSP) traffic would require a multiplexer. Years ago, there were options for some Linux platforms to multiplex console and kgdb, but this was far simpler since it could be implemented entirely in the kernel. Multiplexing console and  the userspace gdbserver stub on a single serial port is not supported.

    By far, the simplest solution (if your application allowed it) is to run gdbserver over the Ethernet port. However, if your application doesn't allow a network configuration where packets can reach your host running the gdb debug engine there are a few alternatives:

    1) Attach a USB<->RS-232 adapter to the AM3517 Exp USB host port. Be sure the appropriate USB serial converter option(s) are enabled. Start gdbserver with /dev/ttyUSB0 (assuming one converter connected to the Experimenter board) and attach the appropriate cabling to the debug host serial port.

    2) Attach a USB A<->B cable to the AM3517 Exp USB peripheral port. Configure the AM3517 Exp kernel with the gadget serial driver, load the g_serial module and run gdbserver on the gadget serial port device. A USB serial port device will appear on the host when the cable is connected and gdb can be attached to the AM3517 Exp target via the USB serial device.

    3) Attach a USB A->B cable to AM3517 Exp USB peripheral port. Configure the AM3517 Exp kernel with the gadget ethernet driver, load the g_ether module and configure networking. Common Linux desktop distributions (including the supported Ubuntu distro) include the CDC Ethernet USB client driver and when the cable is connected, each side will create a USB networking device. Configure networking parameters and then run gdbserver attached the the USB network. From the host, run gdb server specifying the IP address of the USB interface (and select gdbserver port) on the AM3517 Exp target.

    Regards,

    Matt