This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: printf


On Thu, Dec 07, 2000 at 10:30:17AM -0800, Fabrice Gautier wrote:

> > > The best way would be for eCos to use semihosting when using a
> > > JTAG device... Does the soon(?)-coming ARM Integrator port plan
> > > to suport that?
> > 
> > I don't see how you could do semihosting when using JTAG.  
> 
> Multi-ICE, AXD (the new ARM Debugger) and the ARM C library do
> it very well. This is done using a software interrupt. Somehow
> the debugger or the multi-ICE catch the call in the swi handler
> (a breakpoint) then I guess that the Multi-ICE should detect
> the parameter passed to the software interrupt, execute the
> function on the host set the result in the target and then
> restart the target.

OK, I can see how that could work.  The user-code doesn't
really do anything with the JTAG interface, it just calls a
dummy output routine (in the printf example) and expects some
sort of devine intervention to notice the call and do something
about it.  Assuming the C compiler doesn't notice that nothing
is being done and optimize the whole thing away completely. :)

> > The Angel Debugging Protocol used by some JTAG interfaces has
> > support for semihosting, but I think it's only used if you're
> > using the Angel monitor (or other user SW) to process ADP
> > packets on the ARM.
> 
> I guess the Multi-ICE and other ARM product also use ADP. (even
> ARMulator support semihosting )

If the JTAG box (Jeeni or Multi-ICE or whatever is generating
ADP packets) does handle semi-hosting functionality and sends
data to the debugger using the appropriate "channel" (or
whatever it's called) of the ADP connection, then it should be
pretty simple for the rdi target code to pass that data up to
gdb using the same method the "O" packet handler does in the
remote target code does.  That could provide a place to which
"printf" could push bytes.  I don't know what other sort of
semi-hosting (file system access, console input) could be
supported by gdb.

OTOH, it could the debugger rather than the JTAG box that sets
the breakpoint and figures out what needs to be done when the
breakpoint is reached.  If you want that functionality built
into gdb, it would require a lot more work: gdb doesn't really
do that sort of thing.

OTOH, you might be able to do it from the gdb command line by
setting a breakpoint and defining a macro to be executed when
the breakpoint is hit.  The macro would display the parameters
of the dummy routine, and then continue.

> In the ARM debugger you have some options to enable or disable
> semihosting, so probably your gdb would have to handle the
> call. I think the ARM debugger has some DLL to do that. The
> easiest way to handle that with eCos would probably to have
> some kind of translator program that catch and handle the
> semihosted calls

-- 
Grant Edwards
grante@visi.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]