This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How To Build gdb for OMAP-L137 Montavista Demo as well as setup Eclipse debugging.

Below document will hopefully save others some work.  May be some better ways but this seems to work.  I found the online wiki did not work for OMAP-L137 thus documented the changes I made to get things functional.  Additionally setup needed for Eclipse debugging.



Building GDB into OMAP-L137 MontaVista Distribution


Use In Eclipse


The current demo MontaVista  distribution does not contain GDB and gdbserver for debugging the OMAP-L137 thus leaving it to the developer to create a proper environment.  The current documentation helps but needs some additional changes to function properly.  Additionally the end of this document includes some information on what is needed to setup an Eclipse debug environment.


This document references the wiki link below, providing changes where needed:


                   Cross compiling gdb and gdbserver

·         Download GDB source from  For this example the latest is

·         Configure and cross compile gdb, note that the prefix value used in the configure commands below should reflect the locations you want to use in your actual install, the paths shown here are based on the getting started guide. 

·         Assumtions:

·        Montavista toolchain is installed at /opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin

·        Filesystem is installed at /home/user/workdir/filesys where ‘user’ is installation dependent.

·         Commands which are displayed due to word wrap are actually all on one line.


Configure first (change 'user' to your home directory) and run as root:

 host# cd /home/user/workdir/filesys
 host# tar zxvf gdb-6.8.tar.gz 
 host# cd gdb-6.8
 host# ./configure --host=i686-pc-linux-gnu --target=armv5tl-montavista-linux-gnueabi --prefix=/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le

Note that the install command is expecting to be able to write to your MontaVista installation directory, it is easier to run everything as root, alternately you will have to change permissions on the install /opt directory.  Using 'sudo' had problems as well.


Before cross compiling the Makefile needs to be modified to remove warnings.  If this is not done the script build execution will abort due to warnings.  Find the following lines and make changes (sudo vi Makefile or gedit Makefile), note the file is read only thus run sudo or edit as root:



Change to



CFLAGS = -g -O2

Change to

CFLAGS = -g -w -O2


If for any reason you forget to change the Makefile the cache will remember the prior CFLAGS settings and terminate with errors.  To restart after you run 'make' without the -w you must be sure to run 'make distclean' first, then below if cache is not cleared properly:


rm ./intl/config.cache

rm ./libiberty/config.cache

rm ./opcode/config.cache

rm ./readline/config.cache

rm ./sim/config.cache


(may be a few others but errors when execute 'make && make install' will identify, for some reason 'make distclean' does not seem to run correctly or aborts early).


The cache must be removed else the edit to CFLAGS will be detected and the build aborted.  Alternatively it may be easier to delete the gdb-6.8 directory and simple extract it again.


Assuming CFLAGS changed as directed now do the build:


 host# sudo make && make install


Now cross compile gdbserver as root.  All commands are on same line.  Note to change the /home/user to your user name prior to execution.

 host# cd gdb/gdbserver
 host# CC=/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-gcc ./configure  --host=armv5tl-montavista-linux-gnueabi --prefix=/home/user/workdir/filesys

Do build:

 host# make && make install


Now copy the file system to the target boot device, in this example a formated USB pen drive:


cp -Rf /home/user/workdir/filesys/* /media/disk-1



host IP address: target IP address:


Command line GDB:

·        Run gdbserver on target, reference wiki sample 'c' code for example below.

target# cd /opt/sample
target# /gdb-6.8/gdb/gdbserver/gdbserver ./sample
 Process ./sample created; pid = 733
 Listening on port 10000

At this point of time target is waiting for connection from the host

·        Run gdb on host.  Set /home/user to your home directory in below examples.

·        Note that the sysroot is needed else shared library version problems will occur.

 host# cd /home/user/targetfs/opt/sample  (or wherever your program is)
 host# /opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/armv5tl-montavista-linux-gnueabi-gdb ./sample
 GNU gdb 6.8
 Copyright (C) 2006 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.
 There is absolutely no warranty for GDB.  Type "show warranty" for details.
 This GDB was configured as "--host=i686-pc-linux-gnu --target=armv5tl-montavista-linux-gnueabi"...
 (gdb) set sysroot /home/user/workdir/filesys
 (gdb) set solib-search-path /home/user/workdir/filesys/lib
 (gdb) target remote
 Remote debugging using
 0x400007e0 in _start ()
 from /home/user/targetfs/lib/


Eclipse help:


Assuming Eclipse is installed, and typically project created, reference the below link for background information.  In this case using V3.2.2, an older version but that available with Ubuntu.


Specifically #5, Application Debug with Eclipse and GDB, section 5.4.2.


Create a .gdbinit file in your Eclipse workspace directory.  Place the following in it, replacing /home/user with the proper directory:


set sysroot /home/user/workdir/filesys

set solib-search-path /home/user/workdir/filesys/lib


Under the Eclipse Debugger/Main tab (Run->Debug) set the following (changing /home/user to proper directory):


Debugger:  gdbserver Debugger


stop at startup at:  main   (checked)


GDB Debugger:  /opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/armv5tl-montavista-linux-gnueabi-gdb


GDB Command Line:  /home/user/workspace/.gdbinit


GDB Command Set:  Standard (Linux)


Protocol:  mi2   (this is important else can not mix C and C++ code, also other problems could arise).


In this example using TCP, thus Debugger/Connections tab:


Type:  TCP

Host Name or IP Address:

Port Number:  10000


With the target executing gdbserver click Debug and connection should be made and debugging possible.