Re: [patch] Add support for ARMv7M devices.

Daniel Jacobowitz
2010-11-01T03:40:09Z

On Sat, Oct 30, 2010 at 12:46:53AM +0100, Jonathan Larmour wrote:
> > Jonathan, how's this
> > work for you? If your target does not give GDB any registers, then
> > this ought to just switch an M-profile binary over to the xpsr. If
> > your debug stub previously sends a bogus "cpsr", then it's hard to say
> > what will happen.
>
> I'm not quite sure what you mean by this since the xpsr and cpsr are given
> the same register number so I thought that what happens at the remote
> protocol level would be the same?

The T bit is in a different place. There's at least one existing stub
which fakes a "CPSR" register when debugging Cortex-M devices with an
XPSR, and moves the T bit to a different place.

Are your stubs returning FPA registers and a fake CPSR, or are they
returning FPA registers and an XPSR? Both are pretty wonky.

> > If it's
> > really necessary, we can try to auto-detect that case in the remote
> > protocol, but really this is what the XML register descriptions are
> > for.
>
> It does create a problem for me at least because we have existing GDB
> stubs implementations programmed into flash on Cortex-M targets (it's hard
> to do anything else but program into flash with these small chips). So CVS
> GDB (and presumably GDB 7.3+) will no longer work with these
> targets.

Sure it will. You can override this by providing an appropriate XML
file to GDB via set tdesc filename (barring discussion, above, of the
T bit). One which matches your stub.

Or, you can implement the auto-detection somehow; GDB has
infrastructure for that in general, but this case is a bit peculiar.
I don't know enough about what your stub returns to say for sure.

> I also wonder about any JTAG debuggers which support Cortex-M (e.g.
> Ronetix PEEDI).

I do not have access to any debugger which supports Cortex-M and the
GDB protocol but not XML, sorry. Someone who does needs to figure out
what they do.

--
Daniel Jacobowitz
CodeSourcery