Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Christopher Friedt <chrisfriedt@gmail.com>
To: Pedro Alves <palves@redhat.com>, Yao Qi <qiyaoltc@gmail.com>,
	gdb-patches@sourceware.org,
		Tristan Gingold <gingold@adacore.com>
Subject: Re: cortex-m xml register descriptions for m-system
Date: Tue, 15 Dec 2015 15:35:00 -0000	[thread overview]
Message-ID: <CAF4BF-Tk0yEgjpf=ujaLJbrFtkp_ujKYv4rpjtqTBdYXMYFQ4A@mail.gmail.com> (raw)
In-Reply-To: <566F5B1A.8040703@redhat.com>

Just so we can have consensus, please indicate what you think is the
best solution - Pedro, Yao, & Tristan.

Based on Tristan's feedback as well, it confirms that these registers
are necessary for DWARF handling.

On Mon, Dec 14, 2015 at 7:13 PM, Pedro Alves <palves@redhat.com> wrote:
> <!DOCTYPE feature SYSTEM "gdb-target.dtd">
> <feature name="org.gnu.gdb.arm.m-profile">
>   <reg name="r0" bitsize="32"/>
>   <reg name="r1" bitsize="32"/>
>   <reg name="r2" bitsize="32"/>
>   <reg name="r3" bitsize="32"/>
>   <reg name="r4" bitsize="32"/>
>   <reg name="r5" bitsize="32"/>
>   <reg name="r6" bitsize="32"/>
>   <reg name="r7" bitsize="32"/>
>   <reg name="r8" bitsize="32"/>
>   <reg name="r9" bitsize="32"/>
>   <reg name="r10" bitsize="32"/>
>   <reg name="r11" bitsize="32"/>
>   <reg name="r12" bitsize="32"/>
>   <reg name="sp" bitsize="32" type="data_ptr"/>
>   <reg name="lr" bitsize="32"/>
>   <reg name="pc" bitsize="32" type="code_ptr"/>
>   <reg name="xpsr" bitsize="32"/>
>
>   <!-- System registers below.  Note these are not
>        _required_ by org.gnu.gdb.arm.m-profile.   -->
>   <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>

I do like Pedro's suggestion. The above XML could be called arm-7m-profile.xml .

Based on Yao's feedback and the ARMv6M A.R.M., I would also suggest
something like the following for arm-6m-profile.xml.

Please note, I suggest using adding regnum="25" for the xpsr in both cases.

<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.arm.m-profile">
  <reg name="r0" bitsize="32"/>
  <reg name="r1" bitsize="32"/>
  <reg name="r2" bitsize="32"/>
  <reg name="r3" bitsize="32"/>
  <reg name="r4" bitsize="32"/>
  <reg name="r5" bitsize="32"/>
  <reg name="r6" bitsize="32"/>
  <reg name="r7" bitsize="32"/>
  <reg name="r8" bitsize="32"/>
  <reg name="r9" bitsize="32"/>
  <reg name="r10" bitsize="32"/>
  <reg name="r11" bitsize="32"/>
  <reg name="r12" bitsize="32"/>
  <reg name="sp" bitsize="32" type="data_ptr"/>
  <reg name="lr" bitsize="32"/>
  <reg name="pc" bitsize="32" type="code_ptr"/>
  <reg name="xpsr" bitsize="32" regnum="25"/>

  <!-- System registers below.  Note these are not
       _required_ by org.gnu.gdb.arm.m-profile.   -->
  <reg name="msp" bitsize="32" type="data_ptr"/>
  <reg name="psp" bitsize="32" type="data_ptr"/>
  <reg name="primask" bitsize="1" type="int8"/>

  <!-- Slack for unused basepri and faultmask registers.
       See arm-fpa.xml.  -->
  <reg name="" bitsize="8" type="int8" regnum="16"/>
  <reg name="" bitsize="8" type="int8" regnum="16"/>

   <reg name="control" bitsize="3" type="int8"/>
</feature>

It borrows from arm-with-m-fpa-layout.xml in that it specifies some
nameless registers (which I assume are ignored by gdb - Pedro, can you
confirm?). The benefit is that the regnum fields of the 6m and 7m
profiles would align easily, simplifying stub implementation. It's a
bit messy though.

Let's call the above 'option A'.

Let's call the alternative below 'option B'.

Common / base case for all ARM Cortex-M devices
arm-m-profile.xml

<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.arm.m-profile">
  <reg name="r0" bitsize="32"/>
  <reg name="r1" bitsize="32"/>
  <reg name="r2" bitsize="32"/>
  <reg name="r3" bitsize="32"/>
  <reg name="r4" bitsize="32"/>
  <reg name="r5" bitsize="32"/>
  <reg name="r6" bitsize="32"/>
  <reg name="r7" bitsize="32"/>
  <reg name="r8" bitsize="32"/>
  <reg name="r9" bitsize="32"/>
  <reg name="r10" bitsize="32"/>
  <reg name="r11" bitsize="32"/>
  <reg name="r12" bitsize="32"/>
  <reg name="sp" bitsize="32" type="data_ptr"/>
  <reg name="lr" bitsize="32"/>
  <reg name="pc" bitsize="32" type="code_ptr"/>
  <reg name="xpsr" bitsize="32" regnum="25"/>

  <!-- System registers below.  Note these are not
       _required_ by org.gnu.gdb.arm.m-profile.   -->
  <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="control" bitsize="3" type="int8"/>
</feature>

Additional registers for ARMv7M

arm-7m-profile.xml

<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.arm.m-profile">
  <reg name="r0" bitsize="32"/>
  <reg name="r1" bitsize="32"/>
  <reg name="r2" bitsize="32"/>
  <reg name="r3" bitsize="32"/>
  <reg name="r4" bitsize="32"/>
  <reg name="r5" bitsize="32"/>
  <reg name="r6" bitsize="32"/>
  <reg name="r7" bitsize="32"/>
  <reg name="r8" bitsize="32"/>
  <reg name="r9" bitsize="32"/>
  <reg name="r10" bitsize="32"/>
  <reg name="r11" bitsize="32"/>
  <reg name="r12" bitsize="32"/>
  <reg name="sp" bitsize="32" type="data_ptr"/>
  <reg name="lr" bitsize="32"/>
  <reg name="pc" bitsize="32" type="code_ptr"/>
  <reg name="xpsr" bitsize="32" regnum="25"/>

  <!-- System registers below.  Note these are not
       _required_ by org.gnu.gdb.arm.m-profile.   -->
  <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="control" bitsize="3" type="int8"/>
  <reg name="basepri" bitsize="8" type="int8"/>
  <reg name="faultmask" bitsize="1" type="int8"/>
</feature>

If we can improve 'option B' via <xi:include> and reuse
arm-m-profile.xml, please let me know.

Thanks,

C


  reply	other threads:[~2015-12-15 15:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 17:05 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF4BF-Tk0yEgjpf=ujaLJbrFtkp_ujKYv4rpjtqTBdYXMYFQ4A@mail.gmail.com' \
    --to=chrisfriedt@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gingold@adacore.com \
    --cc=palves@redhat.com \
    --cc=qiyaoltc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox