## Run Mode On-Device Debugging

To implement run mode on-device debugging the following tasks need to be completed.

1. Install device connection software
2. Install Perl
3. Install an SDK
4. Setup environment variables
5. Setup a virtual drive for Techview and Cust Kits
6. Set the default kit in Devices.xml
7. Install the SISX file on the target device
8. Configure TRK connection on the device
9. Create a launch configuration

#### Creating a Launch Configuration setup

1. Import the MMP or INF file
2. Select the Project in the C/C++ Project pane you want to debug
3. From the IDE select Run > Debug…
4. The New Launch Configuration Wizard appears

To communicate between the Carbide.c++ debugger and the on-device debug agent or protocol interface you must define a debug launch configuration. The Debug window is where you define the type of debug launch configuration to use when debugging programs on the target device (Figure 4).

Figure 4. Debug Window

5. Select either a Symbian OS Application TRK or Symbian OS System TRK configuration type for on-device debugging and click New

For debug launch configurations using the TRK debug agent, the following pages require review and possible option settings:

- Main - defines the project to be launched on the target device
- Arguments (Eclipse) - defines the arguments to be passed to the application and to the virtual machine
- Debugger - provides control over entry points, message handling, and instruction set default settings
- Connection - specifies the method used to transfer files to the target device
- File Transfer - files transfered to the target device at the start of each launch
- Installation - specifies the .sis or .pkg file to install on the target device
- Executables - specifies which executables are debugged by your project
- Source (Eclipse) - defines the location of source files used to display source when debugging
- Common (Eclipse) - defines general information about the launch configuration

Click Debug after all the preference panels have been set. The Debug window closes and the Carbide.c++ debugger begins a debugging session using the new configuration. The next time you click the Debug icon, this debug launch configuration is used to start a debug session.

##### Main Tab

The Main pane defines the project to be launched on the target device. Table 1 defines the fields.

Figure 5. Debug window - Main Tab

Table 1. Main pane

Item | Explanation
--- | ---
Project | The project to associate with this debug launch configuration. Click Browse to select a different project.
Remote process to launch | The absolute path of the remote process to launch on the target device.

##### Debugger Tab

The Debug or launch configuration windows Debugger pane provides control over entry points, message handling, and instruction set default settings.

Figure 6. Debug windows Debugger Pane

Table 2. Debugger pane

Item | Explanation
--- | ---
Break at entry point | When checked, break at the specified entry point entered in the text field. For .EXE targets, the default entry point is set to E32Main. By default, the Break at entry point option is unchecked for all other target types.
View program output | When checked, show the contents of any unframed messages from the communications port in a Console view.
View messages between Carbide and debug agent | When checked, show the communications between the PC and the target device in a Console view when the TRK Communciation message log is visible. NOTE You can pin the TRK Communication message log view so that it does not lose focus.
Message retry delay (ms) | Enter the delay time in milliseconds (ms) between 100 and 10000 that the debugger should wait for a response. The default Message retry delay value is 2000.
Default Instructon Set | Specifies the default instruction set to use if the debugger cannot determine the processor mode in order to set breakpoints and to disassemble code. The options are: Auto (examine code at current PC location) ARM (32-bit) THUMB (16-bit) By default the Instruction Set option uses ARM 32-bit.

##### Connection Tab

Select the Connection tab that is available for TRK. Specify the Serial port for your configuration. The Connection pane specifies the method used to transfer files to the target device. Once the Current Connection to Target type is selected, the remaining options contain default values for the specific connection type. You can change these options to match the target device's communication specifications.

Figure 7. Debug windows Connection pane using PC Suite

Table 3. Connection pane

Item | Explanation
--- | ---
Current Connection to Target | Choose the connection type to use when communicating with a device.
Serial Port | Select the serial port option to use for the launch configuration. Once set, this port will be used for all subsequent launch configurations until it is set again. NOTE USB and Bluetooth can be dynamically assigned, so its critical that the port ID assigned here matches the one the system is using to communicate with the target device.
Baud Rate | Use the Baud Rate option to select the baud rate for communication. The default baud rate value is 115200 bits per second (bps).
Data Bits | Use the Data Bits option to select a common data bits size (4, 5, 6, 7, and 8). The default data bits value is 8.
Parity | Use the Parity option to select the parity setting (None, Odd, or Even). The default parity value is None.
Stop Bits | Use the Stop Bits option to select the stop bits setting (1, 1.5, 2). The default stop bits value is 2.
Flow Control | Use the Flow Control option to select the flow control setting (None, Hardware (RTS/CTS), and Software (XON/XOFF)). The default flow control value is None.

##### Installation Tab

For Application TRK select the Installation tab. The Installation pane specifies the .sis file to install on the target device. This is used by Application TRK because Application TRK downloads all files via a SIS file. This is required when using the TRK debug agent with 9.x based SDK’s.

Figure 8. Debug windows Installation pane

Table 4. Installation pane

Item | Explanation
--- | ---
Installation file | Browse to and select the file to be installed.
Download directory | Specify directory to receive download.
Install each launch even if installer file has not changed | Check this option to always install the .sis file.
Do not show installer UI on the phone | Check this option to hide the installer interface on the phone.
Install to drive: | Select drive on phone to install the .sis file.

##### File Transfer Tab

For System TRK select the File Transfer pane. The File Transfer pane displays a list of files the Carbide IDE transfers to the target device at the start of each launch. By default, any file added is automatically checked for downloading to the device.

NOTE If debugging a DLL from an application and using System TRK, ensure that the DLL is included so that it is deployed to the device with the application. It is not added by default.

Figure 9. Debug windows File Transfer pane