Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir.prus@gmail.com>
To: gdb-patches@sourceware.org
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [WIP] Bare-metal register browsing
Date: Mon, 27 Apr 2015 18:39:00 -0000	[thread overview]
Message-ID: <553E7F2D.6000707@gmail.com> (raw)
Message-ID: <20150427183900.QAaI4Ll1KUIPLrMM-wtdFwljZAjG82b3NHl7DzXPGpk@z> (raw)
In-Reply-To: <864mo5yi1x.fsf@gmail.com>


On 04/24/2015 12:47 PM, Yao Qi wrote:>

Vladimir Prus <vladimir@codesourcery.com> writes:
 >
 > Hi Vladimir,
 >
 >> The attached patches implement accessing peripheral registers on
 >> bare-metal targets. Typically,
 >> these registers are memory-mapped, so one can poke at them using
 >> memory operations, but it's
 >> far from convenient. Also, on some targets the registers might require
 >> a custom way of access,
 >> which makes things even less convenient.
 >>
 >> This patch allows target XML to describe 'spaces' - contains of
 >> registers, which can be further grouped.
 >> Given that descrpiption, GDB allows one to do something like:
 >>
 >> 	(gdb) print $io.GPIO_PORTF.GPIO_PORTFDIR
 >> 	$7 = -1
 >>
 >> to access registers. One can also do
 >>
 >> 	(gdb) ptype $io
 >>
 >> to see top-level register groups in space 'io', and so find the
 >> desired register.
 >
 > What does the xml using 'spaces' look like?  A small example would be
 > useful.  Target description "reg" has already had a component "type",
 > can't we extend "type" for memory-mapped registers?  I am trying to
 > understand how useful it is to add 'spaces' here.

Hi Yao,

Here's extract from an actual file

	<space annex="memory" name="io">
	<group name="UART2">
	<reg bitsize="32" name="UART2CTL" offset="0x4000e030" read-sensitive="no" save-restore="yes" type="UART0_UART0CTL"/>
	<reg bitsize="32" name="UART2LTIM" offset="0x4000e098" read-sensitive="no" save-restore="yes" type="UART0_UART0LTIM"/>
	</group>
	<group name="UART3">
	size="32" name="UART3CTL" offset="0x4000f030" read-sensitive="no" save-restore="yes" type="UART0_UART0CTL"/>
	<reg bitsize="32" name="UART3LTIM" offset="0x4000f098" read-sensitive="no" save-restore="yes" type="UART0_UART0LTIM"/>
	</group>

The full file can be found at https://drive.google.com/open?id=0BzXbGnw_jIF6cThVZHU2T3l0SXM&authuser=0


The space and group elements are not 100% required - it might be possible to instead have something like:

	<struct id="UART2">
		<field offset="0x4000e030" bitsize="32" type="int" name="UAR2CTL"/>
	</struct>
	<struct id="UART3">
		<field offset="0x4000f030" bitsize="32" type="int" name="UART3CTL"/>
	</struct>
	<struct id="io">
		<field name="UART2" type="UART2"/>
		<field name="UART3" type="UART3"/>
	</struct>
	<reg name="io" type="io"/>

But it seems to me that this overloading of existing concepts might not be perfect:

- Normally, top level 'reg' element are accessed using ordinary packets, so we'd need to special case 'reg' above
- Using 'reg' element to refer to large number of registers, and using 'field' to refer to registers can be
   confusing.
- GDB type system does not support 'offset' field for physical address, and unlike space, there is no easy
   place to add this information.

So it seems to me that the original syntax is more straight-forward representation of hardware.

Thanks,
Volodya

-- 
Vladimir Prus
CodeSourcery / Mentor Embedded
http://vladimirprus.com


-- 
Vladimir Prus
CodeSourcery / Mentor Embedded
http://vladimirprus.com


  reply	other threads:[~2015-04-27 18:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20  6:30 Vladimir Prus
2015-04-24  9:47 ` Yao Qi
2015-04-27 18:25   ` Vladimir Prus [this message]
2015-04-27 18:39     ` Vladimir Prus
2015-06-01 18:36     ` Vladimir Prus
2015-06-02 13:00     ` Yao Qi
2015-06-03 19:49       ` Vladimir Prus
2015-06-04 14:38         ` Yao Qi
2015-06-09 20:50           ` Vladimir Prus
2015-06-11  8:56             ` Yao Qi
2015-06-15 13:51               ` Vladimir Prus

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=553E7F2D.6000707@gmail.com \
    --to=vladimir.prus@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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