Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* cortex-m xml register descriptions for m-system
@ 2015-12-14 17:05 Christopher Friedt
  2015-12-14 18:55 ` Pedro Alves
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Christopher Friedt @ 2015-12-14 17:05 UTC (permalink / raw)
  To: gdb-patches

Hi list,

I've been using GDB and OpenOCD to debug ARM Cortex-M devices for
quite a while. One thing that I always noticed when using OpenOCD is
that the m-system registers are listed, which is *incredibly* useful
for writing code on just about any Cortex-M microcontroller.

Somewhat recently, Qemu has also begun to support Cortex-M based
virtual devices, and it seems to be fairly usable.

The down side, is that they do not expose the m-system registers,
simply because binutils-gdb does not (at this time) have an XML file
for them.

Just to catch anyone up to speed who might be reading this, the
m-system registers are

MSP (main stack pointer)
PSP (process stack pointer)
PRIMASK (1-bit register that says if interrupts are enabled)
BASEPRI (8-bit register that sets the NVIC base priority)
FAULTMASK (1-bit register that says if fault interrupts are enabled)
CONTROL (3-bit register that indicates presence of FP, whether PSP is
selected, and whether running in unprivileged mode)

Now, these are "system" registers, and on a full blown microprocessor,
it might be unusual to expose them, but on a microcontroller, it's
quite important. The other debuggers that I have seen (IAR,
specifically) also list the m-system registers along with the general
purpose ones for Cortex-M.

The following XML is sufficient to describe the m-system registers so
that they appear to the GDB client.

<feature name="org.gnu.gdb.arm.m-system">
  <reg name="msp" bitsize="32" type="data_ptr"/>
  <reg name="psp" bitsize="32" type="data_ptr"/>
  <reg name="primask" bitsize="1" type="int8"/>
  <reg name="basepri" bitsize="8" type="int8"/>
  <reg name="faultmask" bitsize="1" type="int8"/>
  <reg name="control" bitsize="3" type="int8"/>
</feature>

The first question I would ask for clarification from the binutils-gdb
developers, is, which regnum is appropriate to assign to each of those
m-system registers? Should these registers enumerate starting with 26
(resuming from the xpsr)?

Just for comparison, the current binutils-gdb arm-m-profile.xml is
here (https://goo.gl/hpTye8), and the openocd variant is here
(http://goo.gl/FFn56X).

The second question I would like to ask is, what is the best way to
add this XML? Should it

1) Should it be inserted directly into arm-m-profile.xml?
2) Should it be included from arm-m-profile.xml as arm-m-system.xml?

IMHO, the 1st or 2nd option would make sense, as all Cortex-M's
contain these registers.

I'm asking because I have a patch ready to submit for this on a whim's
notice, but would just like to get some buy-in ahead of time.


C


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-08-14 18:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 17:05 cortex-m xml register descriptions for m-system Christopher Friedt
2015-12-14 18:55 ` Pedro Alves
2015-12-14 23:11   ` Christopher Friedt
2015-12-15  0:13     ` Pedro Alves
2015-12-15 15:35       ` Christopher Friedt
2015-12-16 13:51         ` Tristan Gingold
2015-12-16 17:13           ` Christopher Friedt
2015-12-17  8:32             ` Tristan Gingold
2018-08-14 18:14               ` Christopher Friedt
2015-12-15 11:44     ` Tristan Gingold
2015-12-15 11:59       ` Pedro Alves
2015-12-15 12:11       ` Pedro Alves
2015-12-15 12:13         ` Pedro Alves
2015-12-15  8:55 ` Yao Qi
2015-12-15 10:25   ` Pedro Alves
2015-12-15 10:32     ` Pedro Alves
2015-12-16  9:49     ` Yao Qi
2015-12-15  9:13 ` Yao Qi
2015-12-15 12:20   ` Christopher Friedt
2015-12-15 15:09     ` Christopher Friedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox