Re: Help with building gdb with BDM support for the Coldfire

"Mark Giacobbe" <[email protected]> Wed, 14 May 2008 10:50:19 -0400
Newsgroups gmane.comp.hardware.motorola.microcontrollers.coldfire
Message-ID <[email protected]>
The observations that I see makes sense.  Since none of the registers are
programmed, cs0 will always respond to any memory access, and cs0 is
programmed by hardware to always to a 32 bit access.

Here is the patch of my changes.  Please look it over and I'm sure I forgot
to change something.

Thanks for your help
Mark

diff -Naur /opt/old/m68k-bdm-1.4-pre2/m68k/autom4te.cache/requests
/opt/m68k-bdm-1.4-pre2/m68k/autom4te.cache/requests
--- /opt/old/m68k-bdm-1.4-pre2/m68k/autom4te.cache/requests    2008-03-18
04:04:19.000000000 -0400
+++ /opt/m68k-bdm-1.4-pre2/m68k/autom4te.cache/requests    2008-05-08
09:17:15.000000000 -0400
@@ -82,15 +82,15 @@
                         'configure.ac'
                       ],
                       {
-                        'AM_PROG_F77_C_O' => 1,
                         '_LT_AC_TAGCONFIG' => 1,
-                        'm4_pattern_forbid' => 1,
+                        'AM_PROG_F77_C_O' => 1,
                         'AC_INIT' => 1,
+                        'm4_pattern_forbid' => 1,
                         'AC_CANONICAL_TARGET' => 1,
-                        'AC_CONFIG_LIBOBJ_DIR' => 1,
                         'AC_SUBST' => 1,
-                        'AC_CANONICAL_HOST' => 1,
+                        'AC_CONFIG_LIBOBJ_DIR' => 1,
                         'AC_FC_SRCEXT' => 1,
+                        'AC_CANONICAL_HOST' => 1,
                         'AC_PROG_LIBTOOL' => 1,
                         'AM_INIT_AUTOMAKE' => 1,
                         'AC_CONFIG_SUBDIRS' => 1,
@@ -98,8 +98,8 @@
                         'LT_CONFIG_LTDL_DIR' => 1,
                         'AC_REQUIRE_AUX_FILE' => 1,
                         'AC_CONFIG_LINKS' => 1,
-                        'LT_SUPPORTED_TAG' => 1,
                         'm4_sinclude' => 1,
+                        'LT_SUPPORTED_TAG' => 1,
                         'AM_MAINTAINER_MODE' => 1,
                         'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
                         '_m4_warn' => 1,
@@ -116,11 +116,11 @@
                         'AH_OUTPUT' => 1,
                         '_AM_SUBST_NOTMAKE' => 1,
                         'AC_CONFIG_AUX_DIR' => 1,
-                        'm4_pattern_allow' => 1,
-                        'AM_PROG_CC_C_O' => 1,
                         'sinclude' => 1,
-                        'AM_CONDITIONAL' => 1,
+                        'AM_PROG_CC_C_O' => 1,
+                        'm4_pattern_allow' => 1,
                         'AC_CANONICAL_SYSTEM' => 1,
+                        'AM_CONDITIONAL' => 1,
                         'AC_CONFIG_HEADERS' => 1,
                         'AC_DEFINE_TRACE_LITERAL' => 1,
                         'm4_include' => 1,
diff -Naur /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-bdm-low.c
/opt/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-bdm-low.c
--- /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-bdm-low.c    2008-02-13
16:05:52.000000000 -0500
+++ /opt/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-bdm-low.c    2008-05-08
13:38:09.000000000 -0400
@@ -58,6 +58,7 @@
 #define M68K_BDM_MARCH_CF5272     (5)
 #define M68K_BDM_MARCH_CF5282     (6)
 #define M68K_BDM_MARCH_CFV4E      (7)
+#define M68K_BDM_MARCH_CF5307     (8)

 /*
  * The CPU labels.
@@ -69,6 +70,7 @@
 #define M68K_BDM_MARCH_CF5235_LABEL    "CF5235"
 #define M68K_BDM_MARCH_CF5272_LABEL    "CF5272"
 #define M68K_BDM_MARCH_CF5282_LABEL    "CF5282"
+#define M68K_BDM_MARCH_CF5307_LABEL    "CF5307"
 #define M68K_BDM_MARCH_CFV4E_LABEL     "CFV4E"

 /*
@@ -395,6 +397,38 @@
   { "accext01", M68K_BDM_REG_TYPE_INT32,         40, BDM_REG_CTRL (0x807)
},
   { "accext32", M68K_BDM_REG_TYPE_INT32,         41, BDM_REG_CTRL (0x808) }
 };
+/*
+ * 5307 V3 Coldfire Register set
+ */
+static struct m68k_bdm_reg_mapping m68k_bdm_cf5307_reg_map[] = {
+  { "d0",       M68K_BDM_REG_TYPE_INT32,         0,  BDM_REG_D0 },
+  { "d1",       M68K_BDM_REG_TYPE_INT32,         1,  BDM_REG_D1 },
+  { "d2",       M68K_BDM_REG_TYPE_INT32,         2,  BDM_REG_D2 },
+  { "d3",       M68K_BDM_REG_TYPE_INT32,         3,  BDM_REG_D3 },
+  { "d4",       M68K_BDM_REG_TYPE_INT32,         4,  BDM_REG_D4 },
+  { "d5",       M68K_BDM_REG_TYPE_INT32,         5,  BDM_REG_D5 },
+  { "d6",       M68K_BDM_REG_TYPE_INT32,         6,  BDM_REG_D6 },
+  { "d7",       M68K_BDM_REG_TYPE_INT32,         7,  BDM_REG_D7 },
+  { "a0",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 8,  BDM_REG_A0 },
+  { "a1",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 9,  BDM_REG_A1 },
+  { "a2",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 10, BDM_REG_A2 },
+  { "a3",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 11, BDM_REG_A3 },
+  { "a4",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 12, BDM_REG_A4 },
+  { "a5",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 13, BDM_REG_A5 },
+  { "fp",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 14, BDM_REG_A6 },
+  { "sp",       M68K_BDM_REG_TYPE_VOID_DATA_PTR, 15, BDM_REG_A7 },
+  { "ps",       M68K_BDM_REG_TYPE_INT32,         16, BDM_REG_SR },
+  { "pc",       M68K_BDM_REG_TYPE_INT32,         17, BDM_REG_RPC },
+  { "vbr",      M68K_BDM_REG_TYPE_VOID_DATA_PTR, 18, BDM_REG_CTRL (0x801)
},
+  { "cacr",     M68K_BDM_REG_TYPE_INT32,         19, BDM_REG_CTRL (0x002)
},
+  { "acr0",     M68K_BDM_REG_TYPE_INT32,         20, BDM_REG_CTRL (0x004)
},
+  { "acr1",     M68K_BDM_REG_TYPE_INT32,         21, BDM_REG_CTRL (0x005)
},
+  { "rambar",   M68K_BDM_REG_TYPE_INT32,         22, BDM_REG_CTRL (0xc04)
},
+  { "mbar",     M68K_BDM_REG_TYPE_INT32,         23, BDM_REG_CTRL (0xc0f)
},
+  { "macsr",    M68K_BDM_REG_TYPE_INT32,         24, BDM_REG_CTRL (0x804)
},
+  { "mask",     M68K_BDM_REG_TYPE_INT32,         25, BDM_REG_CTRL (0x805)
},
+  { "acc",      M68K_BDM_REG_TYPE_INT32,         26, BDM_REG_CTRL (0x806) }
+};

 /*
  * V4E Coldfire Register set.
@@ -510,6 +544,8 @@
     m68k_bdm_cf5272_reg_map, M68K_BDM_REG_NUMBER (m68k_bdm_cf5272_reg_map)
},
   { "m68k-cf5282.xml",
     m68k_bdm_cf5282_reg_map, M68K_BDM_REG_NUMBER (m68k_bdm_cf5282_reg_map)
},
+  { "m68k-cf5307.xml",
+    m68k_bdm_cf5307_reg_map, M68K_BDM_REG_NUMBER (m68k_bdm_cf5307_reg_map)
},
   { "m68k-cfv4e.xml",
     m68k_bdm_cfv4e_reg_map, M68K_BDM_REG_NUMBER (m68k_bdm_cfv4e_reg_map) }
 };
@@ -1667,6 +1703,11 @@
         m68k_bdm_cpu_label = M68K_BDM_MARCH_CFV4E_LABEL;
         printf_filtered ("m68k-bdm: detected V4e core\n");
       }
+    else if (m68k_bdm_cf_debug_ver == 1) {
+        m68k_bdm_cpu_type = M68K_BDM_MARCH_CF5307;
+        m68k_bdm_cpu_label = M68K_BDM_MARCH_CF5307_LABEL;
+        printf_filtered ("m68k-bdm: detected MCF5307\n");
+      }
       break;

     default:
diff -Naur /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-cf5307.xml
/opt/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-cf5307.xml
--- /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-cf5307.xml    1969-12-31
19:00:00.000000000 -0500
+++ /opt/m68k-bdm-1.4-pre2/m68k/gdbserver/m68k-cf5307.xml    2008-05-08
13:42:18.000000000 -0400
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007 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 feature SYSTEM "gdb-target.dtd">
+<target>
+  <!-- The 68000 standard registers  -->
+  <xi:include href="m68k-core.xml"/>
+  <!-- This is the name used m68k-tdep.c in GDB. -->
+  <feature name="org.gnu.gdb.coldfire.core">
+    <!-- The 5307 specific registers  -->
+    <reg name="vbr"      bitsize="32" group="system" regnum="18"/>
+    <reg name="cacr"     bitsize="32" group="system" regnum="19"/>
+    <reg name="acr0"     bitsize="32" group="system" regnum="20"/>
+    <reg name="acr1"     bitsize="32" group="system" regnum="21"/>
+    <reg name="rambar"   bitsize="32" group="system" regnum="22"/>
+    <reg name="mbar"     bitsize="32" group="debug"  regnum="23"/>
+    <reg name="macsr"    bitsize="32"                regnum="24"/>
+    <reg name="mask"     bitsize="32"                regnum="25"/>
+    <reg name="acc"      bitsize="32"                regnum="26"/>
+  </feature>
+</target>
diff -Naur /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.am
/opt/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.am
--- /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.am    2008-03-06
05:35:40.000000000 -0500
+++ /opt/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.am    2008-05-08
09:15:38.000000000 -0400
@@ -29,7 +29,8 @@
     $(srcdir)/m68k-cf5235.xml \
     $(srcdir)/m68k-cf5272.xml \
     $(srcdir)/m68k-cf5282.xml \
-    $(srcdir)/m68k-cfv4e.xml
+    $(srcdir)/m68k-cfv4e.xml \
+    $(srcdir)/m68k-cf5307.xml

 ##
 ## Only way I know of anding in automake.
diff -Naur /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.in
/opt/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.in
--- /opt/old/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.in    2008-03-18
04:04:18.000000000 -0400
+++ /opt/m68k-bdm-1.4-pre2/m68k/gdbserver/Makefile.in    2008-05-08
09:17:16.000000000 -0400
@@ -198,7 +198,8 @@
     $(srcdir)/m68k-cf5235.xml \
     $(srcdir)/m68k-cf5272.xml \
     $(srcdir)/m68k-cf5282.xml \
-    $(srcdir)/m68k-cfv4e.xml
+    $(srcdir)/m68k-cfv4e.xml \
+    $(srcdir)/m68k-cf5307.xml

 @TBLCF_USB_TRUE@TBLCF_USB_LIB = $(top_builddir)/tblcf/libtblcf.a
 @LIBUSB_PATH_TRUE@AM_LDFLAGS = -L@LIBUSB_LIB_DIR@

On Thu, May 8, 2008 at 8:16 PM, Chris Johns <[email protected]>
wrote:

> Mark Giacobbe wrote:
>
>> I may have spoke to soon about my changes working.  Looking deeper, it
>> seems if I do a info all-registers, I get the V4E set, which is probably why
>> none of my changes are really working.
>>
>>
> Ah ok. Nice observation.
>
>  I'm going to keep looking, but if you have any other suggestions or places
>> to look at, I'll be glad to hear them!! :)
>>
>> I'll try to send my patches for your review to see if I missed anything.
>>
>>
> Please send the patch to me and I will take a look. It could be something
> simple that I forgot to mention.
>
>
> Regards
> Chris
> ---
> [email protected]              Send a post to the list.
> [email protected]        Join the list.
> [email protected]    Join the list in digest mode.
> [email protected]     Leave the list.
>
>