From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20535 invoked by alias); 19 Jul 2009 14:16:52 -0000 Received: (qmail 20522 invoked by uid 22791); 19 Jul 2009 14:16:51 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f203.google.com (HELO mail-pz0-f203.google.com) (209.85.222.203) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 19 Jul 2009 14:16:44 +0000 Received: by pzk41 with SMTP id 41so1398083pzk.12 for ; Sun, 19 Jul 2009 07:16:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.147.19 with SMTP id u19mr728103wfd.153.1248013001570; Sun, 19 Jul 2009 07:16:41 -0700 (PDT) In-Reply-To: <4A2AFD8F.5090304@duaneellis.com> References: <4A2AFD8F.5090304@duaneellis.com> Date: Sun, 19 Jul 2009 14:16:00 -0000 Message-ID: <3a665c760907190716s716e1102h2ce2a8e6aec2e2ed@mail.gmail.com> Subject: Re: how to debug mips or arm platform applications by cgdb From: loody To: Duane Ellis Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00126.txt.bz2 Hi: 2009/6/7 Duane Ellis : > >>> Would someone tell me how to debug mips or arm applications by CGDB. > > By CGDB, I presume you mean "cross gdb". > > You need to describe your target better. > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > (A) =A0Is your target running linux? > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > If so, if your development host is not your target, (ie: cross work), you > need a "gdb-server" application for your target. That "gdb server" would > talk via RS232 (serial) or TCP/IP (ethernet) back to your development hos= t. > > You can "simulate" the TCP environment quite easily using "local host" on > your development host so you can more easily understand how this works. It > can be confusing the first few times you do it. > > You can learn how to run "gdb server" on your development host, (aka: "lo= cal > host"), and connect to the server using the GDB command: "target remote > localhost:port" ... =A0 90% of the battle is understanding how "gdbserver= and > target remote works" - doing that with "localhost" and a "development host > program" is sometimes a little easier to understand and figure out. > > Only then - change "target remote localhost" to =A0 "target remote > ". > First all, I have to appreciate your kind and detail help and sorry for late replying this letter. My cgdb is an application which combine curses (terminal-based) interface to the GNU Debugger (GDB). It is a more light weight process than ddd. But your explanation is the answer of next question I want to ask :) I intend to use cgdb instead of sde-insight to debug the program running on the target board. But I don't realize the whole story at all until reading your letter. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > (B) is your target running standalone - no operating system, or something > other then linux. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > For example, you might be debugging "UBOOT" or some other FLASH MEMORY ty= pe > device, perhaps like: 'contiki' or 'freertos' or 'ethernut' > > Some use JTAG to debug the Linux Kernel. > > In this case, 2 options: > > (a) A serial rom monitor that talks the GDB protocol (very rare these day= s, > most people use jtag). > > (b) A JTAG dongle, and software for that jtag dongle that understands the > GDB protocol. > > You'll need to *PURCHASE* a jtag dongle (or make one) - I highly recommen= d a > "USB based ftdi-2232 based dongle", and *STRONGLY* do not recommend a > "printer-port" solution. > > The "jtag dongle method" - is 80% identical to the GDBREMOTE example abov= e - > but is more complicated (20%) because you have to create an initialization > script to setup your target board, program the cpu clocks, erase & program > the flash memory, stuff like that. > > A *VERY* common JTAG solution (de-facto for ARM) is: =A0"openocd" - see: > =A0http://openocd.berlios.de/web > > In the JTAG dongle case, GDB talks "target remote" to a > GDB server program running on Linux, or Windows, or in some cases the DON= GLE is really a tiny > computer that talks the GDBSERVER protocol over Ethernet (the Zylin zy1000 > is an example, it actually runs OpenOCD inside). from the case you mention above, there seems a gdbserver running on the dongle not on the target board such that when we send gdb protocol from host to the dongle, it can translate it to the proper jtag instructions to handle the target board. Is my assumption correct? Thanks for your help, miloody