Configuring a target for serial communication

To configure your target for serial communications:

  1. f it's not already running, start the serial device driver that's appropriate for your target. Typically, Intel x86-based machines use the devc-ser8250 driver.
  2. Once the serial driver is running, you'll see a serial device listed in the /dev directory. To confirm it's running, enter: ls /dev/ser* You'll see an entry such as /dev/ser1 or /dev/ser2.
  3. Type the following command to start the pseudo-terminal communications manager ( devc-pty ): devc-pty &
  4. Type the following command to start the debug agent (this command assumes that you're using the first serial port on your target):
    pdebug /dev/ser1 &
    Note: If you change the pdebug command to pdebug /dev/ser1,57600, stty </dev/ser1 shows how ser1 is configured so that you can take note of the baud rate, and then specify the same number in the launch configuration. At pdebug launch time, the baud rate of the device that pdebug uses can be specified for the launch configuration (in this example, 57600).

    The target is now fully configured.

  5. Determine the serial port parameters by entering the following command (again, this command assumes the first serial port):
    stty </dev/ser1
    This command produces a lot of output. Look for the baud=baudrate entry; you'll need this information to properly configure the host portion of the connection.

When you set up a launch configuration, select C/C++ QNX PDebug (Serial). For information about launch configurations, see the Launch Configurations Reference chapter in this guide.

Note:

After a debug session ends, you must restart pdebug on the target because pdebug always exits. If you use qconn, you don't have to restart pdebug because it will automatically restart pdebug with each new debug session. However, if you use serial debug, you must manually restart pdebug, or use the target reset if pdebug was initiated by the startup process.

The following shell script shows how to keep pdebug running so that it behaves similar to qconn:

while true 
  do 
     pidin | grep -q pdebug 
     if [ $? -ne 0 ] 
     then 
        echo Start pdebug 
        pdebug /dev/ser1,115200 
     fi 
     sleep 1 
done