Preparing Your Target

You can select a topic from this diagram:

Glossary What's New Utilities Used by the IDE Getting System Information Using Code Coverage Common Wizards Reference Preparing Your Target Developing Photon Applications Developing C/C++ Programs Where Files Are Stored Building OS and Flash Images Migrating to the 6.3 Release Tutorials IDE Concepts About This Guide Analyzing Your System With Kernel Tracing Profiling an Application Finding Memory Errors Debugging Programs Managing Source Code Launch Configurations Reference

Workflow with targets chapter highlighted


This chapter explains how to set up host-target communications.

In this chapter:

Host-target communications

Regardless of whether you're connecting to a remote or a local target, you have to prepare your target machine so that the IDE can interact with the QNX Neutrino image running on the target.

The IDE supports host-target communications using either an IP or a serial connection. We recommend both. If you have only a serial link, you'll be able to debug a program, but you'll need an IP link in order to use any of the advanced diagnostic tools in the IDE.

Target systems need to run the target agent (qconn). for more information about qconn, see "Target agent (the qconn daemon)" in the IDE Concepts chapter.


Note: Ensure that you occasionally check the Download Center on our website for updated versions of qconn, or you can use the IDE Software Updates manager (Help-->Software Updates).

IP communications

Before you can configure your target for IP communications, you must connect the target and host machines to the same network. You must already have TCP/IP networking functioning between the host and target systems.

To configure your target for IP communications, you must launch qconn on the target, either from a command-line shell, or the target's boot script.


Note: The version of QNX Momentics on your host must be the same or newer than the version of QNX Neutrino on your target, or unexpected behavior may occur. Newer features won't be supported by an older target.

If your target's qconn is out of date, its listing in the Target Navigator view will notify you to check the target properties:

qconn is out of date

For more information, see "Installing the qconn update," later in this chapter.

When you set up a launch configuration, select C/C++ QNX QConn (IP). (See the Launch Configurations Reference chapter in this guide for more information.)


Note: The pdebug command must be present on the target system in /usr/bin for all debugging sessions; qconn launches it, as required. The devc-pty manager must also be running on the target to support the Debug perspective's Terminal view.

Serial communications

Before you can configure your target for serial communications, you must establish a working serial connection between your host and target machines.


Note: On Linux, disable and stop mgetty before configuring your target for serial communications.

To configure your target for serial communications:

  1. If 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 &

    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.

qconn over Qnet

Suppose you have two targets running Neutrino, such that:

To connect to the second target with the IDE, all you need to do is start qconn on the second target, and instruct it to use the IP stack of the first target, like this:

SOCK=/net/firstTargetName qconn

If you want to start qconn like this every time you boot the second target, add this command to the file named /etc/rc.d/rc.local. For more information about starting Neutrino, see the Controlling How Neutrino Starts chapter of the Neutrino User's Guide.

Installing the qconn update

After you've installed the IDE, you may need to update qconn on your target systems to take advantage of some additional features. The IDE will work with older versions of qconn, but not all features will be available.


Note: Only users with system administrator privileges can perform updates to qconn.

To update qconn on your development system:

  1. In the IDE, select Help-->Software Updates-->Qconn Updates....
  2. Click OK to let the IDE update qconn on your host.

Note: If you already have the latest version of qconn, or the next time you choose Software Updates-->Qconn Updates... from the Help menu, the IDE offers to uninstall the qconn update.

After you update qconn on your Development system, you then need to update the version of qconn on your target system. How you do this depends on your target system; you might have to build a new image, or you might simply have to copy the new version to your target.

For example, to copy a new version of qconn to a target system:

  1. Use slay qconn on the target to stop any existing qconn.
  2. Copy $QNX_TARGET/target/usr/sbin/qconn to your target system's /usr/sbin directory.
  3. Ensure that the qconn in the target's /usr/sbin directory is executable; if it isn't, use chmod +x to make it executable.
  4. On the target, launch the new qconn.

Example: Debugging via PPP

This example shows you how to prepare your target and host for debugging using a PPP connection.

Before you begin, make sure the serial ports on both the host and target systems are configured properly and can communicate with each other through a null-modem serial cable.

Setting up your target

To configure your target for PPP:

  1. Create a file named options in the directory /etc/ppp/options that contains the following lines:
    debug
    57600
    /dev/ser1
    10.0.0.1:10.0.0.0

    Note: The number 57600 refers to the baud rate. You may need to use a different value if you encounter problems using this value.

  2. If it's not already running, start io-net with this command:
    io-net -ptcpip -ppppmgr
  3. Type the following command to start the PPP daemon:
    pppd
  4. Type the following command to start the qconn target agent:
    qconn

QNX Neutrino host

To configure your QNX Neutrino host for PPP:

  1. >Create a file named options in the directory /etc/ppp/options that contains the following lines:
    debug
    57600
    /dev/ser1
    10.0.0.1:10.0.0.0

    Note: The number 57600 refers to the baud rate. You may need to use a different value if you encounter problems using this value.

  2. If it's not already running, start io-net with this command:
    io-net -ptcpip -ppppmgr
  3. Type the following command to start the PPP daemon with the passive option:
    pppd passive

Windows host

To configure your Windows XP host for serial communication using PPP:


Note: The names of menu items and other details differ slightly on other supported versions of Windows.

  1. In the Control Panel window, select Network Connections.
  2. In the New Connection Wizard dialog, click Set up an advanced connection, then click Next:

    Network Connection Wizard

  3. Select Connect directly to another computer, then click Next.
  4. When prompted for the role of your target, choose Guest; click Next.
  5. Name your connection (e.g. "ppp_biscayne"), and then click Next.
  6. When prompted to select a device, choose Communications Port (COM1), and then click Next.
  7. When prompted to specify whether you want this connection to be for your use only, or for anyone's, select Anyone's use. Click Next.
  8. If you want Windows to create a desktop shortcut, click the option on the last page of the wizard.
  9. Click Finish.
  10. In the Connect name_of_target dialog, enter your user ID and password, then select Properties.
  11. Select the Options tab.
  12. Disable the option Prompt for name and password, certificate, etc., then click OK.

Connecting with Phindows

The IDE lets you connect to a Photon session on a target from a Windows host machine and interact with the remote Photon system as if you were sitting in front of the target machine.

To prepare your target for a Phindows connection:

  1. Open a terminal window and log in as root.
  2. Edit the file /etc/inetd.conf and add the following line (or remove the comment character if the line already exists):
    phrelay stream tcp nowait root /usr/bin/phrelay phrelay -x
  3. Save the file and exit the editor.
  4. If it's running, kill the inetd daemon:
    slay inetd
  5. Now restart inetd:
    inetd

    The inetd daemon starts and you can connect to your target using Phindows.

For details on using Phindows, see the Phindows Connectivity User's Guide in your QNX Momentics documentation set.