Any objections?

The attached patch enforces "reset init" as the behaviour for "reset"
(no args) always.

This helps reduce confusion.

A warning is logged if the deprecated syntax is used. The option
old reset_mode option is simply ignored.

-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
Index: C:/workspace/trunk/doc/openocd.texi
===================================================================
--- C:/workspace/trunk/doc/openocd.texi (revision 820)
+++ C:/workspace/trunk/doc/openocd.texi (working copy)
@@ -516,7 +516,7 @@
 @section Target configuration
 
 @itemize @bullet
[EMAIL PROTECTED] @b{target} <@var{type}> <@var{endianess}> <@var{reset_mode}> 
<@var{JTAG pos}>
[EMAIL PROTECTED] @b{target} <@var{type}> <@var{endianess}> <@var{JTAG pos}>
 <@var{variant}>
 @cindex target
 Defines a target that should be debugged. Currently supported types are:
@@ -538,29 +538,6 @@
 
 Endianess may be @option{little} or @option{big}.
 
-The reset_mode specifies what should happen to the target when a reset occurs:
[EMAIL PROTECTED] @minus
[EMAIL PROTECTED] @b{reset_halt}
[EMAIL PROTECTED] reset_halt
-Immediately request a target halt after reset. This allows targets to be 
debugged
-from the very first instruction. This is only possible with targets and JTAG
-interfaces that correctly implement the reset signals.
[EMAIL PROTECTED] @b{reset_init}
[EMAIL PROTECTED] reset_init
-Similar to @option{reset_halt}, but executes the script file defined to handle 
the
-'reset' event for the target. Like @option{reset_halt} this only works with
-correct reset implementations.
[EMAIL PROTECTED] @b{reset_run}
[EMAIL PROTECTED] reset_run
-Simply let the target run after a reset.
[EMAIL PROTECTED] @b{run_and_halt}
[EMAIL PROTECTED] run_and_halt
-Let the target run for some time (default: 1s), and then request halt.
[EMAIL PROTECTED] @b{run_and_init}
[EMAIL PROTECTED] run_and_init
-A combination of @option{reset_init} and @option{run_and_halt}. The target is 
allowed
-to run for some time, then halted, and the @option{reset} event script is 
executed. 
[EMAIL PROTECTED] itemize
 
 On JTAG interfaces / targets where system reset and test-logic reset can't be 
driven
 completely independent (like the LPC2000 series), or where the JTAG interface 
is
@@ -591,7 +568,7 @@
 
 @subsection arm7tdmi options
 @cindex arm7tdmi options
-target arm7tdmi <@var{endianess}> <@var{reset_mode}> <@var{jtag#}>
+target arm7tdmi <@var{endianess}> <@var{jtag#}>
 The arm7tdmi target definition requires at least one additional argument, 
specifying
 the position of the target in the JTAG daisy-chain. The first JTAG device is 
number 0.
 The optional [EMAIL PROTECTED] parameter has been removed in recent versions.
@@ -829,6 +806,7 @@
 @cindex step
 Single-step the target at its current code position, or at an optional 
address. 
 
+
 @item @b{reset} [EMAIL 
PROTECTED]|@option{halt}|@option{init}|@option{run_and_halt}
 |@option{run_and_init}]
 @cindex reset
@@ -835,6 +813,8 @@
 Perform a hard-reset. The optional parameter specifies what should happen 
after the reset.
 This optional parameter overrides the setting specified in the configuration 
file,
 making the new behaviour the default for the @option{reset} command.
+
+With no arguments a "reset init" is executed
 @itemize @minus
 @item @b{run}
 @cindex reset run
Index: C:/workspace/trunk/src/target/target.c
===================================================================
--- C:/workspace/trunk/src/target/target.c      (revision 820)
+++ C:/workspace/trunk/src/target/target.c      (working copy)
@@ -1401,15 +1401,25 @@
                                /* what to do on a target reset */
                                (*last_target_p)->reset_mode = RESET_INIT; /* 
default */
                                if (strcmp(args[2], "reset_halt") == 0)
-                                       (*last_target_p)->reset_mode = 
RESET_HALT;
+                               {
+                                       LOG_WARNING("reset_mode argument is 
deprecated. reset_mode = reset_init");
+                               }
                                else if (strcmp(args[2], "reset_run") == 0)
-                                       (*last_target_p)->reset_mode = 
RESET_RUN;
+                               {
+                                       LOG_WARNING("reset_mode argument is 
deprecated. reset_mode = reset_init");
+                               }
                                else if (strcmp(args[2], "reset_init") == 0)
-                                       (*last_target_p)->reset_mode = 
RESET_INIT;
+                               {
+                                       LOG_WARNING("reset_mode argument is 
deprecated. reset_mode = reset_init");
+                               }
                                else if (strcmp(args[2], "run_and_halt") == 0)
-                                       (*last_target_p)->reset_mode = 
RESET_RUN_AND_HALT;
+                               {
+                                       LOG_WARNING("reset_mode argument is 
deprecated. reset_mode = reset_init");
+                               }
                                else if (strcmp(args[2], "run_and_init") == 0)
-                                       (*last_target_p)->reset_mode = 
RESET_RUN_AND_INIT;
+                               {
+                                       LOG_WARNING("reset_mode argument is 
deprecated. reset_mode = reset_init");
+                               }
                                else
                                {
                                        /* Kludge! we want to make this reset 
arg optional while remaining compatible! */
@@ -1785,8 +1795,7 @@
 int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char 
**args, int argc)
 {
        target_t *target = get_current_target(cmd_ctx);
-       enum target_reset_mode reset_mode = target->reset_mode;
-       enum target_reset_mode save = target->reset_mode;
+       enum target_reset_mode reset_mode = RESET_INIT;
        
        LOG_DEBUG("-");
        
@@ -1827,9 +1836,6 @@
        /* reset *all* targets */
        target_process_reset(cmd_ctx);
        
-       /* Restore default reset mode for this target */
-    target->reset_mode = save;
-       
        return ERROR_OK;
 }
 
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to