## Defining a launch configuration

In this example we show how to create a new project using one of the built-in Carbide templates, how to build it into an executable, and how to launch the debugger to verify program accuracy. The steps to do this include:

1. Creating a project from a project template
2. Building the object code based on the project sources
3. Defining a launch configuration for running or debugging the application
4. Controlling and debugging the running program using the Carbide debugger

To run or debug a project you need a launch configuration. A project must have at least one launch configuration, and can have as many as necessary. It is not unusual to have two or more launch configurations per target device, usually a debug version and a run version. You can use the New Launch Configuration Wizard to create them all.

- On emulator targets, the New Launch Configuration Wizard usually has all the information it requires to create a launch configuration and launch the program on the emulator. If at any time it needs additional information, dialogs will ask for it, then launch the program.
- On device targets, the New Launch Configuration Wizard requests all the additional information it needs like the target device, the remote connection, and more, before it creates the launch configuration. Once it has all the required data, it creates the launch configuration, then downloads the executable to the device and launches it.

Once the emulator or device is loaded with the executable, a debug session can begin.

If at any time the New Launch Configuration Wizard encounters a problem during a later launch sequence it will request settings clarification before continuing. For example, maybe the target device has changed, or a new ROM has been installed. Either of these will trigger a request for clarification.

#### Defining a launch configuration (emulator example)

1. Select the project to run in the Project Explorer view.
2. To run the project without the debugger choose:

   To simply run the project on the chosen target use one of the following actions. Use this option to verify a release program's execution without debugging symbols.

   1. Right-click the project and click Run As > Run on Emulator or Device.
   2. Click the Run > Run (CTRL-F11) menu item.
   3. Click the Run () icon in the toolbar.
3. Select the Process to launch in the Executable Selection page, then click Next.

4. Set the Build (if required) before launching option in the Build Options Selection page, then click Next.

5. Verify the new launch configuration settings in the New Launch Configuration page.

6. (Optional) Checkmark the Advanced settings option to further customize the launch configuration.
7. Click Finish.

   Carbide launches the emulator, transfers the HelloWorld executable to it, then launches the program (see below). You can then use the soft-keys to choose actions from the Options soft-menu. Click the Exit soft-key to close the emulator and return to Carbide.c++.

With a launch configuration in place, its now possible to edit, build, and run a project in the emulator. However, since none of us can write perfect code the first time the use of a debugger is essential for further development of our project.

#### NEXT STEP > Controlling and debugging the running program using the Carbide debugger

#### Other references

- Emulator Application Projects