In the section called Verification in Chapter 10 you ran the prebuilt test case on real hardware; now you are ready to run one of the test programs in the simulated environment or as an Linux application.
Note: Since the ARM7 architecture does not have simulator support, you need to run the following tests on the PID or AEB-1 board. Make sure you have configured and built eCos for the correct board and for RAM start-up instead of ROM start-up as described previously. Consult Chapter 6 for details about downloading the test to the board. Otherwise, the program behavior as described below should be the same.
Start a command window (such as a bash shell or an MS-DOS window) with the environment variables set as described in the GNUPro documentation. Define the appropriate GDB macro described in the section called Using the simulator in Chapter 2. Change to the directory in which you set up your build tree, and invoke GDB on the test program.
To run the bin_sem0 test (which will test the kernel for the correct creation and destruction of binary semaphores) type:
$ gdb -nw install/tests/kernel/bin_sem0
Note: If you are using a CD distribution of the eCos Developer’s Kit, the GNUPro tool chain which accompanies it comes with the graphical front end to GDB, GDB/Tk, which will be invoked unless you specify the -nw option to gdb. The command line version of GDB is shown in this tutorial.
Example 13-1. Starting up GDB
You should see the following in the command window:
GNU gdb 4.17-ecos-98r1p6 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. This version of GDB is supported for customers of Cygnus Solutions. Type "show warranty" for details. This GDB was configured as "--host=THIS-HOST --target=THIS-TARGET". (gdb) |
If you are trying to run a synthetic target test on Linux, skip the simulator connection and download steps. Otherwise, specify that you are using the simulator target (rather than real hardware) by typing:
(gdb) msim
on the MN10300, or
(gdb) tsim
on the TX39, or
(gdb) psim
on the PowerPC, or
(gdb) ssim
on the SPARClite.
You will see the following lines on your screen:
Connected to the simulator. (gdb) |
Now download the program to the (simulator) target with
(gdb) load
You should see output similar to the following on your screen:
Loading section .rom_vectors, size 0xc0 lma 0x40000000 Loading section .text, size 0x1b3b lma 0x400000c0 Loading section .rodata, size 0x2f4 lma 0x40001bfc Loading section .data, size 0x7c lma 0x40001ef0 Start address 0x40000000 Transfer rate: 64344 bits in <1 sec. (gdb) |
You are now ready to run your program as if this were an ordinary debugging session with GDB. If you type
(gdb) run
you will see output similar to the following:
Starting program: /ecos-work/./install/tests/kernel/bin_sem0.exe PASS:<Binary Semaphore 0 OK> EXIT:<done> |
You must kill your GDB session with Control-C, or it will sit in the “idle” thread and use up CPU time. Type quit and you are done.