Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Add support for VFP d16 layout  for Cortex-M4
@ 2012-04-19 15:13 Jonathan Larmour
  2012-04-19 15:58 ` Terry Guo
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Jonathan Larmour @ 2012-04-19 15:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ilija Kocho, Terry Guo, Pedro Alves

[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]

As mentioned in my response to the GDB list mail
<http://sourceware.org/ml/gdb/2012-04/msg00149.html>, I have a patch to
allow easy automatic use of Cortex-M targets with a register layout with
16 double precision / 32 single precision regs. This is as used in the
increasingly popular Cortex-M4 core.

I have chosen to use the remote packet guessing approach again, rather
than inferring from the executable's ELF header, because not everyone will
actually want to use hardware FP just because they're using that core, so
what the stub actually supports is a better indicator of what is wanted.

There's a couple of trivial little fixes from earlier changes too (a
comment and missing entries in features/Makefile). FAOD I have
write-after-approval commit perms.

Jifl


2012-04-19  Jonathan Larmour  <jifl@eCosCentric.com>

	* arm-dep.h (VFP_REGISTER_SIZE): Define.
	* features/Makefile: Add arm-with-m* entries currently missing.
	* features/arm-with-m-vfp-d16.xml: New file. Describes
	Cortex-M with VFPv4-sp-d16 FPU register layout.
	* features/arm-with-m-vfp-d16.c: Generate from above.
	* arm-tdep.c: Include arm-with-m-vfp-d16.c.
	(arm-register_g_packet_guesses): Fix comment. Add vfp-d16 guess.
	(_initialise_arm_tdep): Initialize arm-with-m-vfp-d16 tdesc.


arm-tdep.c                      |   12 ++++++++
arm-tdep.h                      |    4 ++
features/Makefile               |    3 +-
features/arm-with-m-vfp-d16.c   |   54
++++++++++++++++++++++++++++++++++++++++
features/arm-with-m-vfp-d16.xml |   13 +++++++++
5 files changed, 84 insertions(+), 2 deletions(-)

-- 
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.
  **   Visit us at NEW:UK - the UK Embedded & Electronics Exhibition  **
  **   ARM Partner Pavilion/Stand #114. 18-19 April. Birmingham NEC   **
------["Si fractum non sit, noli id reficere"]------       Opinions==mine

[-- Attachment #2: vfpd16.patch --]
[-- Type: text/plain, Size: 8020 bytes --]

Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.360
diff -u -5 -p -r1.360 arm-tdep.c
--- arm-tdep.c	27 Mar 2012 15:46:33 -0000	1.360
+++ arm-tdep.c	19 Apr 2012 14:19:39 -0000
@@ -57,10 +57,11 @@
 
 #include "record.h"
 
 #include "features/arm-with-m.c"
 #include "features/arm-with-m-fpa-layout.c"
+#include "features/arm-with-m-vfp-d16.c"
 #include "features/arm-with-iwmmxt.c"
 #include "features/arm-with-vfpv2.c"
 #include "features/arm-with-vfpv3.c"
 #include "features/arm-with-neon.c"
 
@@ -9684,11 +9685,11 @@ arm_register_g_packet_guesses (struct gd
     {
       /* If we know from the executable this is an M-profile target,
 	 cater for remote targets whose register set layout is the
 	 same as the FPA layout.  */
       register_remote_g_packet_guess (gdbarch,
-				      /* r0-r12,sp,lr,pc; f0-f7; fps,cpsr */
+				      /* r0-r12,sp,lr,pc; f0-f7; fps,xpsr */
 				      (16 * INT_REGISTER_SIZE)
 				      + (8 * FP_REGISTER_SIZE)
 				      + (2 * INT_REGISTER_SIZE),
 				      tdesc_arm_with_m_fpa_layout);
 
@@ -9696,10 +9697,18 @@ arm_register_g_packet_guesses (struct gd
       register_remote_g_packet_guess (gdbarch,
 				      /* r0-r12,sp,lr,pc; xpsr */
 				      (16 * INT_REGISTER_SIZE)
 				      + INT_REGISTER_SIZE,
 				      tdesc_arm_with_m);
+
+      /* M-profile plus M4F VFP.  */
+      register_remote_g_packet_guess (gdbarch,
+				      /* r0-r12,sp,lr,pc; d0-d15; fpscr,xpsr */
+				      (16 * INT_REGISTER_SIZE)
+				      + (16 * VFP_REGISTER_SIZE)
+				      + (2 * INT_REGISTER_SIZE),
+				      tdesc_arm_with_m_vfp_d16);
     }
 
   /* Otherwise we don't have a useful guess.  */
 }
 
@@ -10331,10 +10340,11 @@ _initialize_arm_tdep (void)
 				  arm_elf_osabi_sniffer);
 
   /* Initialize the standard target descriptions.  */
   initialize_tdesc_arm_with_m ();
   initialize_tdesc_arm_with_m_fpa_layout ();
+  initialize_tdesc_arm_with_m_vfp_d16 ();
   initialize_tdesc_arm_with_iwmmxt ();
   initialize_tdesc_arm_with_vfpv2 ();
   initialize_tdesc_arm_with_vfpv3 ();
   initialize_tdesc_arm_with_neon ();
 
Index: arm-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.h,v
retrieving revision 1.56
diff -u -5 -p -r1.56 arm-tdep.h
--- arm-tdep.h	27 Mar 2012 15:46:33 -0000	1.56
+++ arm-tdep.h	19 Apr 2012 14:19:39 -0000
@@ -69,10 +69,14 @@ enum gdb_regnum {
 /* Say how long FP registers are.  Used for documentation purposes and
    code readability in this header.  IEEE extended doubles are 80
    bits.  DWORD aligned they use 96 bits.  */
 #define FP_REGISTER_SIZE	12
 
+/* Say how long VFP double precision registers are. Used for documentation
+   purposes and code readability.  These are fixed at 64 bits. */
+#define VFP_REGISTER_SIZE	8
+
 /* Number of machine registers.  The only define actually required 
    is gdbarch_num_regs.  The other definitions are used for documentation
    purposes and code readability.  */
 /* For 26 bit ARM code, a fake copy of the PC is placed in register 25 (PS)
    (and called PS for processor status) so the status bits can be cleared
Index: features/Makefile
===================================================================
RCS file: /cvs/src/src/gdb/features/Makefile,v
retrieving revision 1.26
diff -u -5 -p -r1.26 Makefile
--- features/Makefile	10 Apr 2012 15:44:23 -0000	1.26
+++ features/Makefile	19 Apr 2012 14:19:39 -0000
@@ -28,11 +28,12 @@
 # XML master copies.  This relies on a GDB linked with expat and
 # configured for the correct architecture, so the files are again kept
 # in the GDB repository.  To generate C files:
 #   make GDB=/path/to/gdb XMLTOC="xml files" cfiles
 
-WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \
+WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 \
+	arm-with-m arm-with-m-fpa-layout arm-with-m-vfp-d16 arm-with-neon \
 	i386/i386 i386/i386-linux \
 	i386/i386-mmx i386/i386-mmx-linux \
 	i386/amd64 i386/amd64-linux \
 	i386/i386-avx i386/i386-avx-linux \
 	i386/amd64-avx i386/amd64-avx-linux \
Index: features/arm-with-m-vfp-d16.c
===================================================================
RCS file: features/arm-with-m-vfp-d16.c
diff -N features/arm-with-m-vfp-d16.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ features/arm-with-m-vfp-d16.c	19 Apr 2012 14:19:39 -0000
@@ -0,0 +1,54 @@
+/* THIS FILE IS GENERATED.  Original: arm-with-m-vfp-d16.xml */
+
+#include "defs.h"
+#include "osabi.h"
+#include "target-descriptions.h"
+
+struct target_desc *tdesc_arm_with_m_vfp_d16;
+static void
+initialize_tdesc_arm_with_m_vfp_d16 (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.vfp");
+  tdesc_create_reg (feature, "d0", 26, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d1", 27, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d2", 28, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d3", 29, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d4", 30, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d5", 31, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d6", 32, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d7", 33, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d8", 34, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d9", 35, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d10", 36, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d11", 37, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d12", 38, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d13", 39, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d14", 40, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "d15", 41, 1, NULL, 64, "ieee_double");
+  tdesc_create_reg (feature, "fpscr", 42, 1, "float", 32, "int");
+
+  tdesc_arm_with_m_vfp_d16 = result;
+}
Index: features/arm-with-m-vfp-d16.xml
===================================================================
RCS file: features/arm-with-m-vfp-d16.xml
diff -N features/arm-with-m-vfp-d16.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ features/arm-with-m-vfp-d16.xml	19 Apr 2012 14:19:39 -0000
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010-2012 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"/>
+  <!-- Layout of vfpv4-sp-d16 is identical to vfpv2 -->
+  <xi:include href="arm-vfpv2.xml"/>
+</target>

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

end of thread, other threads:[~2012-04-27 15:54 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 15:13 [patch] Add support for VFP d16 layout for Cortex-M4 Jonathan Larmour
2012-04-19 15:58 ` Terry Guo
2012-04-19 16:09   ` Jonathan Larmour
2012-04-19 16:38     ` Terry Guo
2012-04-19 17:30       ` Jonathan Larmour
2012-04-20  7:51     ` Ilija Kocho
2012-04-20  8:31       ` Terry Guo
2012-04-20  8:54         ` Ilija Kocho
2012-04-20 11:44 ` Pedro Alves
2012-04-20 12:43 ` Pedro Alves
2012-04-20 13:20   ` Terry Guo
2012-04-20 13:22     ` Pedro Alves
2012-04-24  2:49   ` Jonathan Larmour
2012-04-26 20:28     ` Tom Tromey
2012-04-26 23:40       ` Jonathan Larmour
2012-04-27 15:55         ` Tom Tromey
2012-04-26  7:35 ` Sergio Durigan Junior
2012-04-26 15:07   ` Jonathan Larmour
2012-04-26 15:20     ` Pedro Alves
2012-04-26 15:29       ` Jonathan Larmour

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