User`s guide
4 Debugging Your BSP
4.2 Basic Debugging Techniques
117
4
information on debugging using an OCD, see 4.3 Advanced Debugging Techniques,
p.126.
4.2.1 Using LEDs as a Diagnostic Tool
As outlined in 3.2.3 Using Debug Routines in the Initialization Code, p.57, it is usually
best to start the development process by writing code to manipulate an LED device
on your target hardware. If no LED is available, it may be possible to manipulate
the state of an externally available pin or trace. In this case, you can connect a logic
analyzer or simple oscilloscope to the pin in order to watch the state of the signal.
By writing LED code first, you validate that the image is created with consistent
addresses. The ability to turn an LED on and off indicates that the code is loaded
where it needs to be, and that the boot loader and the image agree.
If the LED does not operate as expected, you must verify that the image is loaded
in the expected location. The following section presents several methods used to
determine if the code is loaded in the proper place.
4.2.2 Verifying the Image Location
This section discusses how to find addresses and use them to verify your image
location in memory.
Finding Addresses in the Image File
The GNU binary utilities provided with your VxWorks installation include two
command-line tools that are useful for finding the addresses of symbols and code.
The tools are accessed using the commands nm and objdump, with an architecture
specification appended to the name—for example, nmmips or objdumpppc. For
further information on these commands, see the GNU binary utility
documentation or the online help.
Finding Symbol Addresses
You can use nmarch to find a list of symbols included in an image. The output
includes the address that the symbol resolves to, or 00000000 if the symbol is
unresolved.