Taskit ARM9 CPU-module with Linux Stamp9261-series Stamp9261 (64F/64R) 542310 Data Sheet

Product codes
542310
Page of 65
Linux Guide
taskit GmbH
5.5. Debugging the sample
The GNU debugger (GDB) is one of the most important debugging tools for Linux. To 
debug an embedded system, set up a gdb server with the gdb package. The gdbserver 
itself is a small application that carries out commands from the gdb, which runs on the 
development system. You will find the gdbserver in the Linux starter kit's root file system, 
in the /usr/bin directory. Before debugging a program, you must compile it with the 
appropriate flags (-g or -ggdb for more information).
cd /develop
arm-linux-3.4.2-gcc -g example1.c -o example1_debug
If you include in debugging information, the binary created is much larger. As long as you 
have the original version with the debugging information on the development system, 
however, you can simply copy the smaller, stripped-down version to the target system. 
You can strip down the debugger using the arm-linux-strip tool.
For remote debugging, you can set up communication between the gdbserver on the taskit 
device and the gdb on the development system either over a serial null modem cable or 
over a TCP/IP connection. The connection via TCP/IP is described below. First you need 
to start the gdbserver on the taskit device, and then create the connection from the gdb on 
the development computer:
gdbserver development_computer_ip:2345 example1_debug
The development computer is entered as host. As port, choose any available port. All 
command line parameters for the program (in this case, led is an integer indicating the 
number of repetitions) must be given in this call. Then you can start the gdb on the other 
system and create the connection to your taskit device:
arm-linux-gdb example1_debug
(GDB) target remote_ip:2345
Now you are ready to start debugging with the usual gdb commands.
5.6. Downsizing the binary
After compiling the example the filesize of the binary can be noticeable reduce by 
removing unneeded informations generated by the compiler as well as debug informations 
(debugging wont be possible any more):
arm-linux-3.4.2-strip example1
Page 17 of 65
Version 1.26
 (2008-04-30)