m68k serial GDB hookup rfc

Joel Sherrill joel.sherrill at OARcorp.com
Mon May 13 13:34:30 UTC 2002

Thomas Doerfler wrote:
> Hi,
> in the last weeks I have adapted the GDB m68k serial debug
> stub (m68k-stub) to an RTEMS system (at leasdt for MC68040 and
> for CPU32 targets). Instead of adding polled serial I/O
> functions dedicated to the specific hardware, I have written a
> submodule that should be able to hook up to any polled termios
> device driver. SO I think this might become a rather universal
> solution for adding a serial GDB/debug link to many RTEMS
> systems.
> Now I am looking for a rather universal, configurable
> solution to optionally add the debugging stub to a given
> application. The best point to initialize the stub would be in
> bsppost.c , short time after the drivers have been initalized.
> What I would like to do is the following:
> - add sort of a serdbg section to the configuration structures
> to the application's "init" module, containing the serial
> device name to use, the baud rate, a flag, whether execution
> should stop in bsppost or should continue automatically.
> - add a call to the serial debug init function to "bsppost".
> But this call should only be taken, when the serial
> configuration data is present or filled out
> - add the "m68k-stub" and related functions to either
> "libcpu/shared" or "libcpu/m68k/shared", depending whether
> this code is CPU/model dependent or not.

m68k-stub should be in libcpu/m68k/shared or libbsp/m68k/shared.
the rtems-stub-glue should be one level above that (libbsp/shared
or libcpu/shared).

> - move the "thread awareness code" available for the MIPS
> serial debugging to "libcpu/shared", because it looks rather
> CPU independent

The thread awareness code isn't nearly as CPU dependent as
it looks.  The bottom portion of rtems-stub-glue.c is intended
to be the only portion of this file that is CPU dependent.
If another CPU-stub.c supported the commands like mips-stub.c 
does, it should be able to use the same support code in

The bottom part of rtems-stub-glue.c probably should be
split apart of rtems-stub-glue.c should be moved to
libbsp/shared.  I anticipated doing so eventually.

The command set supported by mips-stub.c is (I think) the full
set needed to do efficient thread aware debugging.  Please
enhance other m68k-stub to support the entire set of commands.
Using the support routines in rtems-stub-glue.c should allows
you to largely lift code.

> What I would like to get with this is:
> - adding/ommitting the serial debug code simply by
> adding/ommitting the corresponding configuration settings in
> the init module (existing applications should link without
> code modification)
> - the debug code should not be linked to an RTEMS system that
> does not need/use it.

I agree totally but don't have a firm opinion on the mechanics.

> I am still not yet sure how to implement the optional addition
> of the debug code. Is it ok if I add an optional table to
> "confdefs.h", to modify the shared/bsppost.c, to add some
> stuff to libcpu/shared etc?
> Any comments welcome...
> Bye,
>         Thomas.
> --------------------------------------------
> IMD Ingenieurbuero fuer Microcomputertechnik
> Thomas Doerfler           Herbststrasse 8
> D-82178 Puchheim          Germany
> email:    Thomas.Doerfler at imd-systems.de
> PGP public key available at: http://www.imd-
> systems.de/pgp_key.htm

Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the users mailing list