Difference between revisions of "OpenOCD Snowball"

From eLinux.org
Jump to: navigation, search
(= SMP Support)
Line 1: Line 1:
== Introduction ==
+
= Introduction =
 
The Snowball is supported on main branch of http://openocd.sourceforge.net.<br>
 
The Snowball is supported on main branch of http://openocd.sourceforge.net.<br>
 
For using this solution, you need at least:<br>
 
For using this solution, you need at least:<br>
Line 8: Line 8:
 
[[Eclipse]] can be used as a [[GDB]] front end.<br>
 
[[Eclipse]] can be used as a [[GDB]] front end.<br>
  
== JTAG Hardware HowTos ==
+
= JTAG Hardware HowTos =
 
Following list provides some usb dongle that have tested with snowball :<br>
 
Following list provides some usb dongle that have tested with snowball :<br>
 
* [http://www.amontec.com/jtagkey2.shtml Amontec JTAGKey2]<br>
 
* [http://www.amontec.com/jtagkey2.shtml Amontec JTAGKey2]<br>
Line 16: Line 16:
 
The openocd application is available in source code. Follow the following step, for building the application.
 
The openocd application is available in source code. Follow the following step, for building the application.
  
== Known Issues ==
+
= Known Issues =
  
==== While power saving is enabled, the openocd polling is failing because dap is not powered? ====
+
== While power saving is enabled, the openocd polling is failing because dap is not powered? ==
  
 
Apply following patch to openocd and rebuild.
 
Apply following patch to openocd and rebuild.
Line 73: Line 73:
 
  1.7.4.1
 
  1.7.4.1
  
=== SMP Support ===
+
== SMP Support ==
 
   
 
   
 
Apply the following patch for smp support.
 
Apply the following patch for smp support.

Revision as of 11:13, 19 April 2012

Introduction

The Snowball is supported on main branch of http://openocd.sourceforge.net.
For using this solution, you need at least:
- a usb jtag dongle,
- an openocd excutable running on linux host machine,
- a gdb cross compile for arm platform.

Eclipse can be used as a GDB front end.

JTAG Hardware HowTos

Following list provides some usb dongle that have tested with snowball :

The openocd application is available in source code. Follow the following step, for building the application.

Known Issues

While power saving is enabled, the openocd polling is failing because dap is not powered?

Apply following patch to openocd and rebuild.

From c3ab72ab20273a54e9f47fce05cedf159847a33d Mon Sep 17 00:00:00 2001
From: Michel Jaouen <michel.jaouen@stericsson.com>
Date: Tue, 26 Jul 2011 11:16:29 +0200
Subject: [PATCH] remove warning when board in sleep

---
 src/target/adi_v5_jtag.c |    8 ++++----
 src/target/cortex_a.c    |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c
index 75461c3..eb9627d 100644
--- a/src/target/adi_v5_jtag.c
+++ b/src/target/adi_v5_jtag.c
@@ -296,9 +296,9 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap)
 					dap->ap_csw_value,
 					dap->ap_tar_value);
 
-			if (ctrlstat & SSTICKYORUN)
-				LOG_ERROR("JTAG-DP OVERRUN - check clock, "
-					"memaccess, or reduce jtag speed");
+			//if (ctrlstat & SSTICKYORUN)
+			//	LOG_ERROR("JTAG-DP OVERRUN - check clock, "
+			//		"memaccess, or reduce jtag speed");
 
 			if (ctrlstat & SSTICKYERR)
 				LOG_ERROR("JTAG-DP STICKY ERROR");
@@ -331,7 +331,7 @@ static int jtagdp_transaction_endcheck(struct adiv5_dap *dap)
 
 			if ((retval = dap_run(dap)) != ERROR_OK)
 				return retval;
-			LOG_ERROR("MEM_AP_CSW 0x%" PRIx32 ", MEM_AP_TAR 0x%"
+			LOG_DEBUG("MEM_AP_CSW 0x%" PRIx32 ", MEM_AP_TAR 0x%"
 					PRIx32, mem_ap_csw, mem_ap_tar);
 
 		}
diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c
index 2370d95..1223087 100755
--- a/src/target/cortex_a.c
+++ b/src/target/cortex_a.c
@@ -844,7 +844,7 @@ static int cortex_a8_poll(struct target *target)
 			armv7a->debug_base + CPUDBG_DSCR, &dscr);
 	if (retval != ERROR_OK)
 	{
-		return retval;
+		return ERROR_OK;
 	}
 	cortex_a8->cpudbg_dscr = dscr;
 
-- 
1.7.4.1

SMP Support

Apply the following patch for smp support.

From 3c35988a8dd4e6c1a18b7156bc1367258e9e2fb9 Mon Sep 17 00:00:00 2001
From: Michel Jaouen <michel.jaouen@stericsson.com>
Date: Fri, 30 Sep 2011 14:45:21 +0200
Subject: [PATCH] OpenOCD : add smp remote protocol message

---
 gdb/remote.c |   71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 243bdd7..7ce402e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10552,6 +10552,72 @@ remote_upload_trace_state_variables (struct uploaded_tsv **utsvp)
     }
   return 0;
 }
+#define OPENOCD_SMP
+#ifdef OPENOCD_SMP
+static int dummy = 0;
+static int get_core(void)
+{
+	struct remote_state *rs = get_remote_state ();
+	int core = -1;
+	if (!remote_desc)
+    error (_("command can only be used with remote target"));
+	if (remote_desc)
+	{
+		//puts_filtered("sending jc\n");
+		putpkt("jc");
+		//puts_filtered("Jc sent\n");
+		getpkt(&rs->buf, &rs->buf_size, 0);
+		//		print_packet (rs->buf);
+		hex2bin(rs->buf,(gdb_byte *)&core,4);
+	}
+	else return dummy;
+	return core;
+}
+
+static int set_core(int core)
+{
+	char tmp[16];
+	struct remote_state *rs = get_remote_state ();
+	dummy = core;
+	if (!remote_desc)
+    error (_("command can only be used with remote target"));
+	else	{
+		sprintf(tmp,"Jc%x",core);
+		//puts_filtered(tmp);
+		putpkt(tmp);
+		getpkt (&rs->buf, &rs->buf_size, 0);
+	}
+	return 0;
+}
+
+static void smp_value_read (struct value *v)
+{
+	int core = get_core();
+	memcpy (value_contents_all_raw (v),
+			&core,
+			4);
+}
+
+static void smp_value_write (struct value *v, struct value * from)
+{
+	int core;
+	memcpy (&core,value_contents_all_raw (from), 4);
+	set_core(core);
+}
+
+static struct lval_funcs smp_value_funcs = { smp_value_read, smp_value_write };
+
+
+
+static struct value *smp_make_value (struct gdbarch *gdbarch,
+		struct internalvar *var)
+{
+	struct type *type = arch_integer_type (gdbarch, 32, 1, "DWORD32");
+    return allocate_computed_value (type, &smp_value_funcs, NULL);
+}
+#endif
+
+
 
 void
 _initialize_remote (void)
@@ -10559,7 +10625,10 @@ _initialize_remote (void)
   struct remote_state *rs;
   struct cmd_list_element *cmd;
   char *cmd_name;
-
+  /* smp specific  */
+#ifdef OPENOCD_SMP
+  create_internalvar_type_lazy ("_core", smp_make_value);
+#endif
   /* architecture specific data */
   remote_gdbarch_data_handle =
     gdbarch_data_register_post_init (init_remote_state);
-- 
1.7.4.1