Running Applications on the Target
To Contents | To previous page | To next page

## Running Applications on the Target

To verify both that a hardware target is properly set up, and that the GDB commands used to connect to the target (hardware, simulator or synthetic) work properly on your system, you will now be guided through "downloading" and executing a prebuilt eCos test. The procedure is exactly the same when you want to download and run applications or tests that you have built yourself.

On Windows you must have the bash command line interpreter running with some environment variables which are useful for eCos work. If you have purchased the eCos Developer's Kit , you can select this by selecting Start->Programs->Red Hat eCos->eCos Development Environment . If you are using the eCos Net release, you should set the environment variables as shown in the GNUPro Toolkit Reference Manual . On Linux, simply open a new shell window.

You will need to change directory to the prebuilt tests that are provided in the eCos installation. Change directory as follows:

    for the TX3904-based Toshiba JMR-TX3904 board:
      $ cd BASE_DIR/prebuilt/jmr3904/tests/kernel/v1_3_1/tests
    for the TX39 simulator target:
      $ cd BASE_DIR/prebuilt/tx39_sim/tests/kernel/v1_3_1/tests
    for the i386-based Linux synthetic target:
      $ cd BASE_DIR/prebuilt/linux/tests/kernel/v1_3_1/tests

To execute the `thread_gdb` test case on the desired target, run GDB in command line mode using the following command, remembering to substitute the appropriate name for the architecture's gdb:

    $ gdb -nw thread_gdb

GDB will display a copyright banner and then display a prompt (gdb). Connect to the target according to the instructions given earlier (in Target Setup ) - via serial or ethernet to hardware targets, or directly for simulator and synthetic targets.

Depending on the target type, you will be notified about a successful connection, and possibly see some output informing you of the current program counter of the target.

Now download the test - effectively loading the test case executable into the memory of the target - by typing this command:

    (gdb) load

Again, depending on the target, you may see some output describing how much data was downloaded, and at what speed. Next, start the test case running. For hardware targets this is done with the ™continue' command, while ™run' must be used on simulators and synthetic targets:

    (gdb) continue

or

    (gdb) run

You should now see a number of text messages appear, such as:

    PASS:<GDB Thread test OK>
    EXIT:<done>

### NOTE

eCos has no concept of the application exiting. All eCos test cases complete and then run in a continuous tight loop. To return control to GDB you must stop the application.

The usual method of stopping an application is with Ctrl+C , but Ctrl+C may not work on your platform for the prebuilts. First, make default tests and check that they work the same way as prebuilts, then modify your config to enable GDB stubs (if applicable) and break support, so that a Ctrl+C character will interrupt the application.

Another way to stop the application is by means of a breakpoint. Before running the application, breakpoint `cyg_test_exit()` to stop an eCos test case at its end.

The full functionality of GDB is now available to you, including breakpoints and watchpoints. Please consult the GNUPro GDB documentation for further information.

Running Applications on the Target
To Contents | To previous page | To next page