From: Jonathan Larmour <jifl@eCosCentric.com>
To: gdb-patches@sourceware.org
Subject: Re: [patch] Add support for ARMv7M devices.
Date: Wed, 10 Nov 2010 02:21:00 -0000 [thread overview]
Message-ID: <4CDA01A4.8020606@eCosCentric.com> (raw)
In-Reply-To: <20101103131734.GA5925@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]
On 03/11/10 13:17, Daniel Jacobowitz wrote:
> On Wed, Nov 03, 2010 at 03:21:24AM +0000, Jonathan Larmour wrote:
>> I think there's a more general issue here about whether it's expected to
>> maintain support for existing working stub implementations such that they
>> can be used as they have been used even when GDB is upgraded. Changing the
>> interface with GDB remote stubs used to be a big no-no for GDB.
>
> In general, I want to keep existing stubs working. But someone who
> has access to an affected stub needs to lend a hand here; I don't and
> can't test anything.
I believe I've now worked out a solution, and it's not that complicated in
fact. See the attached patch. The key seems to be to let remote.c choose
the tdesc.
2010-11-09 Jonathan Larmour <jifl@eCosCentric.com>
* arm-tdep.c (arm_gdbarch_init): Allow M-profile targets' remote
stubs to provide 'g' packets with or without FPA registers.
> With stubs out there sending both FPA-regs+fake-CPSR and
> FPA-regs+XPSR, I don't know how to make it work; in fact, I don't know
> how FPA-regs+XPSR ever worked.
It's clearly impossible to tell the difference between fake-CPSR and XPSR.
But even an XML target description can't make that case work right, so I
don't think that's too bad for us not to cope with. Unless you have some
ideas (a 'set' option seems overkill).
Jifl
--
eCosCentric Limited http://www.eCosCentric.com/ The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------ Opinions==mine
[-- Attachment #2: mprofile-backcompat.patch --]
[-- Type: text/plain, Size: 5878 bytes --]
diff -x CVS -x .svn -x '*~' -x '.#*' -x autom4te.cache -urpN src.old/gdb/arm-tdep.c src/gdb/arm-tdep.c
--- src.old/gdb/arm-tdep.c 2010-11-10 01:25:08.000000000 +0000
+++ src/gdb/arm-tdep.c 2010-11-10 02:00:31.000000000 +0000
@@ -42,6 +42,7 @@
#include "prologue-value.h"
#include "target-descriptions.h"
#include "user-regs.h"
+#include "remote.h"
#include "arm-tdep.h"
#include "gdb/sim-arm.h"
@@ -54,6 +55,7 @@
#include "vec.h"
#include "features/arm-with-m.c"
+#include "features/arm-with-m-fpa.c"
static int arm_debug;
@@ -7130,7 +7132,7 @@ arm_gdbarch_init (struct gdbarch_info in
&& (attr_arch == TAG_CPU_ARCH_V6_M
|| attr_arch == TAG_CPU_ARCH_V6S_M
|| attr_profile == 'M'))
- tdesc = tdesc_arm_with_m;
+ is_m = 1;
#endif
}
@@ -7192,6 +7194,8 @@ arm_gdbarch_init (struct gdbarch_info in
else
is_m = 1;
}
+ else
+ is_m = 0;
tdesc_data = tdesc_data_alloc ();
@@ -7566,6 +7570,29 @@ arm_gdbarch_init (struct gdbarch_info in
user_reg_add (gdbarch, arm_register_aliases[i].name,
value_of_arm_user_reg, &arm_register_aliases[i].regnum);
+ if (is_m)
+ {
+ /* For backward-compatibility we allow two 'g' packet lengths with
+ the remote protocol depending on whether FPA registers are
+ supplied. M-profile targets do not have FPA registers, but some
+ stubs already exist in the wild which use a 'g' packet which
+ supplies them albeit with dummy values. The packet format which
+ includes FPA registers should be considered deprecated for
+ M-profile targets.
+
+ The register sizes are fixed for these target descriptions in the
+ XML files, so we can hard-code them: r0-12,sp,lr,pc,xpsr for
+ tdesc_arm_with_m; and additionally f0-f7 and fps for
+ tdesc_arm_with_m_fpa. */
+
+ register_remote_g_packet_guess (gdbarch,
+ 17 * INT_REGISTER_SIZE,
+ tdesc_arm_with_m);
+ register_remote_g_packet_guess (gdbarch,
+ 18 * INT_REGISTER_SIZE +
+ 8 * FP_REGISTER_SIZE,
+ tdesc_arm_with_m_fpa);
+ }
return gdbarch;
}
@@ -7609,6 +7636,7 @@ _initialize_arm_tdep (void)
/* Initialize the standard target descriptions. */
initialize_tdesc_arm_with_m ();
+ initialize_tdesc_arm_with_m_fpa ();
/* Get the number of possible sets of register names defined in opcodes. */
num_disassembly_options = get_arm_regname_num_options ();
diff -x CVS -x .svn -x '*~' -x '.#*' -x autom4te.cache -urpN src.old/gdb/features/arm-with-m-fpa.c src/gdb/features/arm-with-m-fpa.c
--- src.old/gdb/features/arm-with-m-fpa.c 1970-01-01 01:00:00.000000000 +0100
+++ src/gdb/features/arm-with-m-fpa.c 2010-11-10 02:00:31.000000000 +0000
@@ -0,0 +1,46 @@
+/* THIS FILE IS GENERATED. Original: arm-with-m-fpa.xml */
+
+#include "defs.h"
+#include "osabi.h"
+#include "target-descriptions.h"
+
+struct target_desc *tdesc_arm_with_m_fpa;
+static void
+initialize_tdesc_arm_with_m_fpa (void)
+{
+ struct target_desc *result = allocate_target_description ();
+ struct tdesc_feature *feature;
+ struct tdesc_type *field_type, *type;
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.arm.m-profile");
+ tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "sp", 13, 1, NULL, 32, "data_ptr");
+ tdesc_create_reg (feature, "lr", 14, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "pc", 15, 1, NULL, 32, "code_ptr");
+ tdesc_create_reg (feature, "xpsr", 25, 1, NULL, 32, "int");
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.arm.fpa");
+ tdesc_create_reg (feature, "f0", 16, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "f1", 17, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "f2", 18, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "f3", 19, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "f4", 20, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "f5", 21, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "f6", 22, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "f7", 23, 1, NULL, 96, "arm_fpa_ext");
+ tdesc_create_reg (feature, "fps", 24, 1, NULL, 32, "int");
+
+ tdesc_arm_with_m_fpa = result;
+}
diff -x CVS -x .svn -x '*~' -x '.#*' -x autom4te.cache -urpN src.old/gdb/features/arm-with-m-fpa.xml src/gdb/features/arm-with-m-fpa.xml
--- src.old/gdb/features/arm-with-m-fpa.xml 1970-01-01 01:00:00.000000000 +0100
+++ src/gdb/features/arm-with-m-fpa.xml 2010-11-10 02:00:31.000000000 +0000
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+ <xi:include href="arm-m-profile.xml"/>
+ <xi:include href="arm-fpa.xml"/>
+</target>
next prev parent reply other threads:[~2010-11-10 2:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-09 14:03 Kazu Hirata
2010-06-09 22:29 ` Doug Evans
2010-06-09 23:04 ` Richard Earnshaw
2010-06-24 16:42 ` Daniel Jacobowitz
2010-06-24 20:04 ` Richard Earnshaw
2010-08-16 18:06 ` Daniel Jacobowitz
2010-08-17 9:00 ` Matthew Gretton-Dann
2010-08-24 15:56 ` Daniel Jacobowitz
2010-10-29 23:47 ` Jonathan Larmour
2010-11-01 3:40 ` Daniel Jacobowitz
2010-11-03 3:21 ` Jonathan Larmour
2010-11-03 13:17 ` Daniel Jacobowitz
2010-11-10 2:21 ` Jonathan Larmour [this message]
2010-06-10 8:56 ` Matthew Gretton-Dann
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=4CDA01A4.8020606@eCosCentric.com \
--to=jifl@ecoscentric.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).