Re: [patch] Add support for ARMv7M devices.

Jonathan Larmour
2010-10-29T23:47:10Z

On 16/08/10 19:05, Daniel Jacobowitz wrote:
> On Thu, Jun 24, 2010 at 09:03:52PM +0100, Richard Earnshaw wrote:
>> I'd suggest
>>
>> org.gnu.gdb.arm.m-profile
>
> Here's a version addressing comments from Richard, Matthew, and Doug,
> and also incorporating Jonathan Larmour's changes.
>
> I've moved the is_m check lower in arm_pc_is_thumb, to make "set arm
> force-mode" continue to do something sensible; you could arguably push
> it further down, but this is at least an improvement.
>
> Tested on ARM EABI and by hand; any comments?

Sorry that it's taken me until now to try out this patch. I also see it's
checked in to CVS which is fair enough.

> 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?

> I wouldn't be surprised at an error - any target
> which does that, probably also supplies the FPA registers.

Indeed it does. And that makes GDB unhappy, claiming the response to the
$g packet is too long.

> 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. If
we change the register layout to avoid the FPA registers in the future,
then GDB <= 7.2 won't work, although for that scenario there is at least
the possibility of implementing the XML.

But I can't do anything about the existing stubs out there, other than get
users to reflash their targets which isn't great, or just not use GDB
>7.2. The existing GDB debug stubs don't return any XML target
description, so we can't go back and add that obviously. So there is a
backward compatibility issue.

I also wonder about any JTAG debuggers which support Cortex-M (e.g.
Ronetix PEEDI). Do they return XML data? I haven't actually tried it with
Cortex-M, but looking at a GDB protocol trace with the PEEDI on a
different ARM target, no XML info is provided. If that's also true for
Cortex-M (which seems likely) then these JTAG debuggers will also stop
working. That would probably adversely affect a lot more people than just
the developers using the eCos GDB stubs.

So I think an alternative may be needed. Either the auto-detection you
refer to (although I smell layering violation), or perhaps a 'set' command.

Jifl