Here is the patch on jtag_reset_on_init (again).
This fixes the problem with Olimex dongle (on power-on it drives srst
low) but will also fix libftd2xx.so library (asserts srst for > 250ms).
On Thu, 2009-10-01 at 07:32 +0200, Øyvind Harboe wrote:
> > 1. put reset_on_init patch that I submitted earlier and make it
> > dependent on hardware used to access JTAG.
>
> Where is this patch?
>
> > 2. put in udev rules a small program that will de-assert srst. I am not
> > sure if would be committed to openocd tree?
> >
> > Comments or ideas?
>
> Remove the initial scan of JTAG in OpenOCD?
>
> When and how to scan the JTAG chain should be more under the
> control of the config script I think.
>
> E.g. we've been talking about autoconfig and at that point it makes
> a LOT more sense to scan the JTAG chain in the config script.
>
Index: src/jtag/core.c
===================================================================
--- src/jtag/core.c (revision 2796)
+++ src/jtag/core.c (working copy)
@@ -95,6 +95,7 @@
static int jtag_ntrst_delay = 0; /* default to no nTRST delay */
static int jtag_nsrst_assert_width = 0; /* width of assertion */
static int jtag_ntrst_assert_width = 0; /* width of assertion */
+static bool jtag_reset_on_init = false; /* reset JTAG on init */
typedef struct jtag_event_callback_s
{
@@ -1323,6 +1324,8 @@
int retval;
if ((retval = jtag_interface_init(cmd_ctx)) != ERROR_OK)
return retval;
+ if (jtag_reset_on_init)
+ return jtag_init_reset(cmd_ctx);
if (jtag_init_inner(cmd_ctx) == ERROR_OK)
{
return ERROR_OK;
@@ -1507,3 +1510,11 @@
{
return jtag_ntrst_assert_width;
}
+void jtag_set_reset_on_init(bool state)
+{
+ jtag_reset_on_init = state;
+}
+bool jtag_get_reset_on_init(void)
+{
+ return jtag_reset_on_init;
+}
Index: src/jtag/jtag.h
===================================================================
--- src/jtag/jtag.h (revision 2796)
+++ src/jtag/jtag.h (working copy)
@@ -295,6 +295,9 @@
void jtag_set_ntrst_assert_width(unsigned delay);
unsigned jtag_get_ntrst_assert_width(void);
+void jtag_set_reset_on_init(bool state);
+bool jtag_get_reset_on_init(void);
+
/// @returns The current state of TRST.
int jtag_get_trst(void);
/// @returns The current state of SRST.
Index: src/jtag/tcl.c
===================================================================
--- src/jtag/tcl.c (revision 2796)
+++ src/jtag/tcl.c (working copy)
@@ -63,7 +63,8 @@
static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
+static int handle_jtag_reset_on_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+
static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@@ -625,7 +626,9 @@
COMMAND_ANY, "jtag_nsrst_assert_width <ms> - delay after asserting srst in ms");
register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width", handle_jtag_ntrst_assert_width_command,
COMMAND_ANY, "jtag_ntrst_assert_width <ms> - delay after asserting trst in ms");
-
+ register_command(cmd_ctx, NULL, "jtag_reset_on_init", handle_jtag_reset_on_init_command,
+ COMMAND_ANY, "jtag_reset_on_init true/false - reset JTAG chain before initializing.");
+
register_command(cmd_ctx, NULL, "scan_chain", handle_scan_chain_command,
COMMAND_EXEC, "print current scan chain configuration");
@@ -1019,6 +1022,28 @@
return ERROR_OK;
}
+static int handle_jtag_reset_on_init_command(struct command_context_s *cmd_ctx,
+ char *cmd, char **args, int argc)
+{
+ if (argc > 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ if (argc == 1)
+ {
+ bool state;
+ if (strcmp(args[0], "true") == 0)
+ state = true;
+ else if (strcmp(args[0], "false") == 0)
+ state = false;
+ else
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ jtag_set_reset_on_init(state);
+ }
+ command_print(cmd_ctx, "reset_on_init is %s",
+ jtag_get_reset_on_init() ? "true": "false");
+ return ERROR_OK;
+}
+
+
static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int retval = ERROR_OK;
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development