## Defining a Stop Mode Debug Configuration

After installing all necessary software such as Perl, JTAG, compilers, Devkits and SDKs and creating your project, you will need to define a Debug launch configuration for your project. For this example, we'll define a Trace32 launch configuration. For new projects that do not have a launch configuration, a New Launch Configuration Wizard will appear and allow you to define settings. You can also cancel the wizard and define a launch configuration from the following instructions.

#### Define a Launch Configuration

1. Access the Debug window
   1. If necessary, import a project's .mmp or .inf file in Carbide.c++.
   2. Select the Project in the C/C++ Project view that you want to debug.
   3. Select the Run > Debug… menu option to display the Debug launch configuration window.
   4. Define a debug launch configuration to communicate with the on-device debug agent or protocol interface.
   5. In the Debug window, define the type of debug launch configuration to use when debugging programs on the target device.

Figure 1 - Debug Configurations

Select either a Symbian OS Trace32 configuration type for stop mode on-device debugging and click the New launch configuration icon. The following pages require review and possible option settings:

- Main - defines the project to be launched on the target device
- Connection - specifies the method used to transfer files to the target device
- Debugger - provides control over entry points, message handling, and instruction set default settings
- ROM Image- specifies startup options and ROM log and image files
- Source - specifies the source lookup paths
- Common - specifies general launch configuration settings

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.

2. Define Main Tab Settings

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

Figure 2 - 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.
Executable | This is the name of the executable that is linked to the project. Click Browse to select a different executable.

3. Define Connection Tab Settings

Figure 3 - Debug Window - Connection Tab

Table 2 - Connection pane

Item | Explanation
--- | ---
Trace32 Executable | Specify the path to the Trace32 executable. The default path assumes that the Trace32 executable is installed in the default location: C:\T32\T32marm.exe.
Trace32 Configuration File | Specify the path to the config.t32 file or other custom configuration file. The default path assumes that the Trace32 configuration file is installed in the default location: C:\T32\config.t32. For arm11 processors copy the trace32 configuration file for non-ARM11 processor (config_arm11.t32) to your C:\T32 folder and specify it in the edit box. You can modify the config.t32 file to support UDP (User Datagram Protocol) connections by adding the following lines: PBI=USB RCL=NETASSIST PACKLEN=1024 PORT=20000
Trace32 Initialization Script | Specify the path to the initialization cmm file. This script will be run in T32 after connecting to T32. You can specify your own scripts for the targets used.
View messages between Carbide and Trace32 | Enable to log communications with Trace32 to the console window.

4. Define Debugger Tab Settings

Figure 4 - Debug Window - Debugger tab

Table 3 - 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.
Target Processor | A drop down with a list of all supported processors. The process selection should help in determining the memory model. This will in turn help determine the base address and the offsets for the Symbian OS kernel aware information.
Target Initialization File | Check this box to have the debugger run an initialization script when the debug session starts. For example, if a target device requires initialization for the debugger to be able to read and write memory or registers, you can specify an initialization script here. Click Browse to select a script file using a standard file selection dialog box. When using T32, most of the initialization is done in the CMM script file. With other debug protocols you can specify the initialization file, which can be run after connecting to the target.
Memory Configuration File | Controls whether the debugger uses a memory configuration file when a debug session starts. The Carbide debugger uses this configuration file to know which memory is accessible, readable, and writable on the target.
Reset target at the start of each debug session | Forces the Carbide IDE to reset the target at the start of each debug session. This ensures that the debugging session uses the most up-to-date program code.
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. This can happen at addresses for which we have no symbolic information. The debugger uses the mode when setting breakpoints and disassembling 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.

5. Define ROM Image Tab

Figure 5 - Debug Window - ROM Image Tab

Table 4 - ROM Image pane

Item | Explanation
--- | ---
Start Address | Enter the physical address in memory where the Symbian OS start code begins execution. This address is target-specific. The address should be in hexadecimal format with the 0x prefix. For example, 0x8000000 is a valid entry. NOTE The address entered in this field must match the start address specified in the source code used to build the Symbian OS ROM image to be debugged. The Start address must match the Download address.
Debug from Start address | Select this option to have the debugger halt the program at the address specified in Start Address once the target initialization is done and the OS is downloaded; if the user has chosen to download the OS. You can then step through start-up code or run the target in bare-board mode.
Run from start address | Select this option to have the debugger start the code at the address specified in Start Address once the target initialization is done. If you have breakpoints set, the debugger stops at the first breakpoint encountered. You can click the Break button to halt the device.
Symbian ROM Log file | Check the Parse ROM Log File option and specify the information that the debugger needs in order to show detailed stack information, set breakpoints, and show source level debugging information for ROM images. In the first text field, browse to or enter the full path and name of the log file that corresponds to the ROM image on the target device. This log file is generated by default when the ROM image is built.
Symbian OS Kit EPOC32 Directory | Specifies the epoc32 directory in which the ROM image and log files are stored. Since the log file may not contain full paths to the ROM components on the host PC, you need to enter this epoc32 directory. NOTE Always include the epoc32 folder in this path.
Log unresolved modules | Check this box to have the debugger output a list of components from the specified ROMBUILD log file that do not have debugger symbolic information. The list is displayed in the debugger console window at the beginning of the debug session. NOTE You cannot perform source-level debugging on components that do not include symbolic information.
Debug non-XIP Executables | Check this box to debug a project, or a dynamically loaded module, that is loaded from NAND-Flash or other removable media (MMC, memory stick, etc.) at run time and executed in RAM. Use this option to debug modules that work fine when executed in place as part of the ROM image, but sometimes fail when placed in NAND-Flash or other removable media. NOTE Selecting this option will affect debugging performance. When the debugger needs to load a module (DLL, EXE, etc.) it will stop the target, read information from it, then restart it.
Symbian ROM Image | Controls the logging of communication with Trace32. Enable to log communications with Trace32 to the console window.
Download Address (hex) | Enter the physical address in memory at which the debugger should place the ROM image. This address is target-specific. The address should be in hexadecimal format with the 0x prefix. For example, 0x000FFF00 is a valid entry. NOTE The address entered in this field must match the download address specified in the source code used to build the Symbian OS ROM image to be debugged. If you leave this field blank, the debugger does not download the ROM image to the device at the beginning of the debug session. The Download address must match the Start address.
Ask for download at the start of each debug session | Check this box to have the debugger display a dialog box at the beginning of every debug session that lets you choose whether or not you want the debugger to download the ROM image to the device.

##### Related Tasks

- Stop Mode On-Device Debugging Preconditions