]> git.sur5r.net Git - openocd/commitdiff
Removed target->reset_mode, no longer used
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 1 Sep 2008 07:24:14 +0000 (07:24 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 1 Sep 2008 07:24:14 +0000 (07:24 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@976 b42882b7-edfa-0310-969c-e2dbd0fdcd60

doc/README_TARGET_COMMAND.txt [new file with mode: 0644]
src/target/target.c
src/target/target.h

diff --git a/doc/README_TARGET_COMMAND.txt b/doc/README_TARGET_COMMAND.txt
new file mode 100644 (file)
index 0000000..b02e488
--- /dev/null
@@ -0,0 +1,427 @@
+To be incorporated in openocd.texi...
+
+
+==
+Current as of Aug 30, 2008 - Duane Ellis
+==
+
+===================================================
+Overview - History
+
+  Pre "tcl" - many commands in openocd where implimented as C
+  functions.  Post "tcl" (Jim-Tcl to be more exact, June 2008 ...) TCL
+  became a bigger part of OpenOCD.
+
+One of the biggest changes is the introduction of 'target specific'
+commands. When every you create a target, a special command name is
+created specifically for that target.
+
+       For example - in Tcl/Tk - if you create a button (or any other
+       screen object) you can specify various "button configuration
+       parameters". One of those parameters is the "object cmd/name"
+       [ In TK - this is refered to as the object path ]. Later you
+       can use that 'path' as a command to modify the button, for
+       example to make it "grey", or change the color.
+
+In effect, the "path" function is an 'object oriented command'
+
+The TCL change in OpenOCD follows the same principle, you create a
+target, and a specific "targetname" command is created.
+
+There are two methods of creating a target.
+
+  (1) Depricated: Using the old syntax Target names are autogenerated
+      as: "target0", "target1" etc..
+
+  (2) Using the new syntax, you can specify the name of the target.
+
+As most users will have a single JTAG target, and by default the
+command name will probably default to "target0", thus for reasons of
+simplicity the instructions below use the name 'target0'
+
+Overview - History *END*
+==================================================
+
+OpenOCD has the following 'target' or 'target-like' commands.
+
+(1) targets -(plural) lists all known targets and a little bit of
+    information about each target, most importantly the target
+    *COMMAND*NAME* (it also lists the target number)
+
+(2) target -(singular) used to create, configure list, etc the targets
+
+(3) target0 - the command object for the first target.
+    Unless you specified another name.
+
+===================================================
+
+The "targets" (plural, 1 above) command has 2 functions.
+
+With a parameter, you can change the current command line target.
+
+     NOTE: "with a parameter" is really only useful with 'multiple
+     jtag targets' not something you normally encounter (ie: If you
+     had 2 arm chips - sharing the same JTAG chain)
+
+     # using a target name..
+    (gdb) mon targets target0
+     # or a target by number.
+    (gdb) mon targets 3
+
+Or - plain, without any parameter lists targets, for example:
+
+    (gdb) mon targets
+             CmdName    Type       Endian     ChainPos State     
+         --  ---------- ---------- ---------- -------- ----------
+          0: target0    arm7tdmi   little     0        halted
+
+This shows:
+   (a) in this example, a single target
+   (b) target number 0 (1st column)
+   (c) the 'object name' is target0 (the default name)
+   (d) it is an arm7tdmi
+   (e) little endian 
+   (f) The position in the JTAG chain
+   (g) and is currently halted.
+
+====================================================
+
+The "target" (singular, 2 above) command has the following options:
+
+    target create CMDNAME TYPE  ... config options ...
+         argv[0] = 'target'
+         argv[1] = 'create'
+         argv[2] = the 'object command'
+                  (normally, target0, see (3) above)
+         argv[3] = the target type, ie: arm7tdmi
+         argv[4..N] = configuration parameters
+    
+    target types
+          Lists all supported target types.
+          ie: arm7tdmi, xscale, fericon, cortex-m3
+          
+          The result TCL List of all known target types (and is human
+          readable)
+    target names
+
+          Returns a TCL list of all known target commands (and is
+          human readable)
+
+          Example:
+               foreach t [target names] {
+                   puts [format "Target: %s\n" $t]
+               }
+
+
+    target current
+
+          Returns the TCL command name of the current target.
+
+          Example:
+               set ct [target current]
+               set t  [$ct cget -type]
+               
+               puts "Current target name is: $ct, and is a: $t"
+
+
+    target number <VALUE>
+
+          Returns the TCL command name of the specified target.
+          For example 
+
+              set thename [target number $x]
+              puts [format "Target %d is: %s\n" $x $thename]
+
+          For instance, assuming the defaults
+
+              target number 0
+
+          Would return 'target0' (or whatever you called it)
+
+    target count
+
+          Returns the larget+1 target number.
+          For example:
+
+              set c [target count]
+              for { set x 0 } { $x < $c } { incr x } {
+                  # Assuming you have this function..
+                  print_target_details $x
+              }
+
+====================================================
+
+"target0" - (#3 above) the "Target Object" command.
+
+  Once a target is 'created' a command object by that targets name is
+  created, for example
+
+  target create BiGRed arm7tdmi -endian little -chain-position 3
+
+Would create a [case sensative] "command" BiGRed
+
+If you use the old [deprecated] syntax, the name is automatically
+generated and is in the form:
+
+         target0, target1, target2, target3, .... etc.
+
+====================================================
+
+** Target CREATE, CONFIGURE and CGET options **
+
+The commands:
+    
+    target create CMDNAME TYPE  [configure-options]
+    CMDNAME configure [configure-options]
+    CMDNAME cget      [configure-options]
+
+In the 'create' case, one is creating the target and can specify any
+number of configuration parameters.
+
+In the 'CMDNAME cget' case, the goal is to query the target for a
+specific configuration option.
+
+In the 'CMDNAME configure' case, one can change the setting.
+[Not all things can, or should be changed]
+
+In the above, the "default" name target0 is 'target0'
+
+Example:
+
+   From the (gdb) prompt, one can type this:
+
+       (gdb) mon target0 configure -endian big
+
+   And change target0 to 'big-endian'.  This is a contrived example,
+   specifically for this document - don't expect changing endian
+   'mid-operation' to work you should set the endian at creation.
+
+Known options [30/august/2008] are:
+
+[Manditory 'create' Options]
+       -type arm7tdmi|arm720|etc ...
+       -chain-position NUMBER
+       -endian ENDIAN
+
+Optional
+
+       -event EVENTNAME  "tcl-action"
+       -reset RESETACTION
+       -work-area-virt ADDR
+       -work-area-phys ADDR
+       -work-area-size ADDR
+       -work-area-backup BOOLEAN
+
+[Hint: To get a list of avaialable options, try this]
+
+       (gdb) mon target0 cget -BLAHBLAHBLAH
+
+    the abov causes an error - and a helpful list of valid options.
+
+==================================================
+** Example Target Configure Query **
+
+One can query any of the above options at run time, for example:
+
+ (gdb) mon target0 cget -OPTION [param]
+
+Example TCL script
+
+    # For all targets...
+    set c [target count]
+    for { set x 0 } { $x < $c } { incr x ] {
+      set n [target number $x]
+      set t [$n cget -type]
+      set e [$n cget -endian]
+      puts [format "%d: %s, %s, endian: %s\n" $x $n $t $n]
+   }
+
+Might produce:
+      0: pic32chip, mips_m4k, endain: little
+      1: arm7, arm7tdmi, endian: big
+      2: blackfin, bf534, endian: little
+
+Notice the above example is not target0, target1, target2 Why? Because
+in this contrived multi-target example - more human understandable
+target names might be helpful. 
+
+For example these two are the same:
+
+   (gdb) mon blackfin configure -event FOO {puts "Hi mom"}
+
+or:
+   (gdb) mon [target number 2] configure -event FOO {puts "Hi mom"}
+
+In the second case, we use [] to get the command name of target #2, in
+this contrived example - it is "blackfin"
+
+====================================================
+** TWO Important Configure Options Are: **
+
+Two important configuration options are:
+
+    "-event" and "-reset"
+
+The "-reset" option specifies what should happen when the chip is
+reset, for example should it 'halt', 're-init', or what.
+
+The "-event" option less you specifiy a TCL command to occur when a
+specific event occurs.
+
+====================================================
+** Target Events * Overview **
+
+At various points in time - certian 'target' events happen.  You can
+create a custom event action to occur at that time.
+
+For example - after reset, the PLLs and CLOCKs may need to be
+reconfigured, or perhaps the SDRAM needs to be re-initialized
+
+Often the easiest way to do that is to create a simple script file
+containing the series of (mww [poke memory]) commands you would type
+by hand, to reconfigure the target clocks. You could specify the
+"event action" like this:
+
+   (gdb) mon target0 configure -event reset-init "script cfg.clocks"
+
+In the above example, when the event "reset-init" occurs, the
+"action-string" will be evaluated as if you typed it at the console
+
+Option1 - 
+
+       The simple approach (above) is to create a script file with
+       lots of "mww" (memory write word) commands to configure your
+       targets clocks and/or external memory.
+
+Option2 -
+
+       You can instead create a fancy Tcl procedure and invoke that
+       procedure instead of sourcing a file.
+
+       [Infact, "script" is a TCL procedure that loads a file]
+
+==================================================
+
+** Target Events * Details **
+
+There are many events one could use, to get a current list of events
+type the following invalid command, you'll get a helpful "runtime
+error" message, see below: [list valid as of 30/august/2008]
+
+   (gdb) mon target0 cget -event FAFA
+
+Runtime error, file "../../../openocd23/src/helper/command.c", line 433:
+    -event: Unknown: FAFA, try one of: old-pre_reset, 
+    old-gdb_program_config, old-post_reset, halted, 
+    resumed, resume-start, resume-end, reset-start, 
+    reset-assert-pre, reset-assert-post, 
+    reset-deassert-pre, reset-deassert-post, 
+    reset-halt-pre, reset-halt-post, reset-wait-pre, 
+    reset-wait-post, reset-init, reset-end, 
+    examine-start, examine-end, debug-halted, 
+    debug-resumed, gdb-attach, gdb-detach, 
+    gdb-flash-write-start, gdb-flash-write-end, 
+    gdb-flash-erase-start, gdb-flash-erase-end, 
+    resume-start, resume-ok, or resume-end
+
+NOTE:
+
+    The event-names "old-*" are deprecated and exist only to help old
+    scripts continue to function, and the old "target_script" command
+    to work. Please do not rely on them.
+
+These are some other important names.
+
+    gdb-flash-erase-start
+    gdb-flash-erase-end
+    gdb-flash-write-start
+    gdb-flash-write-end
+
+    These occur when GDB/OpenOCD attempts to erase & program the FLASH
+    chip via GDB.
+
+    For example - some PCBs may have a simple GPIO pin that acts like
+    a "flash write protect" you might need to write a script that
+    disables "write protect"
+
+==================================================
+
+** How to get a list of current event actions **
+
+To get a list of current 'event actions', type the following command:
+
+   (gdb) mon target0 eventlist
+
+    Event actions for target (0) target0
+
+    Event                     | Body
+    ------------------------- | ----------------------------------------
+    old-post_reset            | script event/sam7x256_reset.script
+    ***END***
+
+Here is a simple example for all targets:
+
+   (gdb)  mon foreach x [target names] { $x eventlist }
+
+The above uses some TCL tricks:
+
+   (a) foreach VARIABLE  LIST  BODY
+
+   (b) to generate the list, we use [target names]
+   
+   (c) the BODY, contains $x - the loop variable
+       and expands to the target specific name
+
+====================================================
+
+Recalling the earlier discussion - the "object command" there are 
+other things you can do besides "configure" the target.
+
+Note: Many of these commands exist as "global" commands, and they also
+exist as target specific commands.
+
+For example, the "mww" (memory write word) operates on the current target
+if you have more then 1 target, you must switch
+
+In contrast to the normal commands, these commands operate on the
+specific target. For example, the command "mww" writes data to the
+*current* command line target. 
+
+Often, you have only a single target - but if you have multiple
+targets (ie: a PIC32 and an at91sam7 - your reset-init scripts might
+get a bit more complicated, ie: you must specify which of the two
+chips you want to write to. Writing 'pic32' clock configuration to an
+at91sam7 does not work)
+
+The commands are: [as of 30/august/2008]
+
+    TNAME  mww ADDRESS VALUE
+    TNAME  mwh ADDRESS VALUE
+    TNAME  mwb ADDRESS VALUE
+          Write(poke): 32, 16, 8bit values to memory.
+
+    TNAME  mdw ADDRESS VALUE
+    TNAME  mdh ADDRESS VALUE
+    TNAME  mdb ADDRESS VALUE
+          Human 'hexdump' with ascii 32, 16, 8bit values
+
+    TNAME  mem2array  [see mem2array command]
+    TNAME  array2mem  [see array2mem command]
+
+    TNAME  curstate
+         Returns the current state of the target.
+
+
+    TNAME examine
+         See 'advanced target reset'
+    TNAME poll
+         See 'advanced target reset'
+    TNAME reset assert
+         See 'advanced target reset'
+    TNAME reset deassert
+         See 'advanced target reset'
+    TNAME halt
+         See 'advanced target reset'
+    TNAME waitstate STATENAME
+         See 'advanced target reset'
index 08a0505f2331b003aa4423e76cd2debb53740750..ee65147c6d3ef98c2a9d45718128653ce309e8d4 100644 (file)
@@ -160,7 +160,7 @@ const Jim_Nvp nvp_target_event[] = {
        { .value = TARGET_EVENT_OLD_gdb_program_config , .name = "old-gdb_program_config" },
        { .value = TARGET_EVENT_OLD_post_reset         , .name = "old-post_reset" },
        { .value = TARGET_EVENT_OLD_pre_resume         , .name = "old-pre_resume" },
-       
+
 
        { .value = TARGET_EVENT_HALTED, .name = "halted" },
        { .value = TARGET_EVENT_RESUMED, .name = "resumed" },
@@ -188,7 +188,7 @@ const Jim_Nvp nvp_target_event[] = {
 
        { .value = TARGET_EVENT_EXAMINE_START, .name = "examine-start" },
        { .value = TARGET_EVENT_EXAMINE_START, .name = "examine-end" },
-       
+
 
        { .value = TARGET_EVENT_DEBUG_HALTED, .name = "debug-halted" },
        { .value = TARGET_EVENT_DEBUG_RESUMED, .name = "debug-resumed" },
@@ -342,7 +342,7 @@ target_t* get_target_by_num(int num)
        while (target){
                if( target->target_number == num ){
                        return target;
-               } 
+               }
                target = target->next;
        }
 
@@ -758,8 +758,8 @@ int target_call_event_callbacks(target_t *target, enum target_event event)
        target_event_callback_t *callback = target_event_callbacks;
        target_event_callback_t *next_callback;
 
-       LOG_DEBUG("target event %i (%s)", 
-                         event, 
+       LOG_DEBUG("target event %i (%s)",
+                         event,
                          Jim_Nvp_value2name_simple( nvp_target_event, event )->name );
 
        target_handle_event( target, event );
@@ -1000,7 +1000,7 @@ int target_arch_state(struct target_s *target)
                return ERROR_OK;
        }
 
-       LOG_USER("target state: %s", 
+       LOG_USER("target state: %s",
                 Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name);
 
        if (target->state!=TARGET_HALTED)
@@ -1394,18 +1394,18 @@ int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **
                        if( 0 == strcmp( args[0], target->cmd_name ) ){
                                /* MATCH */
                                goto Match;
-                       } 
+                       }
                  }
                }
                /* no match, try as number */
-               
+
                int num = strtoul(args[0], &cp, 0 );
                if( *cp != 0 ){
                        /* then it was not a number */
                        command_print( cmd_ctx, "Target: %s unknown, try one of:\n", args[0] );
                        goto DumpTargets;
                }
-                       
+
                target = get_target_by_num( num );
                if( target == NULL ){
                        command_print(cmd_ctx,"Target: %s is unknown, try one of:\n", args[0] );
@@ -1422,11 +1422,11 @@ int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **
        while (target)
        {
                /* XX: abcdefghij abcdefghij abcdefghij abcdefghij */
-               command_print(cmd_ctx, "%2d: %-10s %-10s %-10s %8d %s", 
+               command_print(cmd_ctx, "%2d: %-10s %-10s %-10s %8d %s",
                                          target->target_number,
                                          target->cmd_name,
-                                         target->type->name, 
-                                         Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness )->name, 
+                                         target->type->name,
+                                         Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness )->name,
                                          target->chain_position,
                                          Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
                target = target->next;
@@ -1689,14 +1689,14 @@ int target_wait_state(target_t *target, enum target_state state, int ms)
                if (once)
                {
                        once=0;
-                       LOG_DEBUG("waiting for target %s...", 
+                       LOG_DEBUG("waiting for target %s...",
                              Jim_Nvp_value2name_simple(nvp_target_state,state)->name);
                }
 
                gettimeofday(&now, NULL);
                if ((now.tv_sec > timeout.tv_sec) || ((now.tv_sec == timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
                {
-                       LOG_ERROR("timed out while waiting for target %s", 
+                       LOG_ERROR("timed out while waiting for target %s",
                              Jim_Nvp_value2name_simple(nvp_target_state,state)->name);
                        return ERROR_FAIL;
                }
@@ -2801,7 +2801,7 @@ static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
        command_context_t *context;
        target_t *target;
-       
+
        context = Jim_GetAssocData(interp, "context");
        if (context == NULL){
                LOG_ERROR("array2mem: no command context");
@@ -2812,10 +2812,10 @@ static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                LOG_ERROR("array2mem: no current target");
                return JIM_ERR;
        }
-       
+
        return target_array2mem( interp,target, argc, argv );
 }
-                          
+
 
 static int target_array2mem(Jim_Interp *interp, target_t *target, int argc, Jim_Obj *const *argv)
 {
@@ -2955,7 +2955,7 @@ target_all_handle_event( enum target_event e )
        target_t *target;
 
 
-       LOG_DEBUG( "**all*targets: event: %d, %s", 
+       LOG_DEBUG( "**all*targets: event: %d, %s",
                   e,
                   Jim_Nvp_value2name_simple( nvp_target_event, e )->name );
 
@@ -2990,7 +2990,7 @@ target_handle_event( target_t *target, enum target_event e )
                teap = teap->next;
        }
        if( !done ){
-               LOG_DEBUG( "event: %d %s - no action", 
+               LOG_DEBUG( "event: %d %s - no action",
                                   e,
                                   Jim_Nvp_value2name_simple( nvp_target_event, e )->name );
        }
@@ -2998,7 +2998,7 @@ target_handle_event( target_t *target, enum target_event e )
 
 enum target_cfg_param {
        TCFG_TYPE,
-       TCFG_EVENT, 
+       TCFG_EVENT,
        TCFG_RESET,
        TCFG_WORK_AREA_VIRT,
        TCFG_WORK_AREA_PHYS,
@@ -3021,10 +3021,10 @@ static Jim_Nvp nvp_config_opts[] = {
        { .name = "-endian" ,          .value = TCFG_ENDIAN },
        { .name = "-variant",          .value = TCFG_VARIANT },
        { .name = "-chain-position",   .value = TCFG_CHAIN_POSITION },
-       
+
        { .name = NULL, .value = -1 }
 };
-         
+
 
 static int
 target_configure( Jim_GetOptInfo *goi,
@@ -3093,7 +3093,7 @@ target_configure( Jim_GetOptInfo *goi,
                                if( goi->argc == 0 ){
                                        Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
                                        return JIM_ERR;
-                               }  
+                               }
                        } else {
                                if( goi->argc != 0 ){
                                        Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name?");
@@ -3101,10 +3101,10 @@ target_configure( Jim_GetOptInfo *goi,
                                }
                        }
 
-       
-                       { 
+
+                       {
                                target_event_action_t *teap;
-                               
+
                                teap = target->event_action;
                                /* replace existing? */
                                while( teap ){
@@ -3113,7 +3113,7 @@ target_configure( Jim_GetOptInfo *goi,
                                        }
                                        teap = teap->next;
                                }
-                               
+
                                if( goi->isconfigure ){
                                        if( teap == NULL ){
                                                /* create new */
@@ -3126,7 +3126,7 @@ target_configure( Jim_GetOptInfo *goi,
                                        }
                                        teap->body  = Jim_DuplicateObj( goi->interp, o );
                                        /*
-                                        * FIXME: 
+                                        * FIXME:
                                         *     Tcl/TK - "tk events" have a nice feature.
                                         *     See the "BIND" command.
                                         *    We should support that here.
@@ -3153,32 +3153,6 @@ target_configure( Jim_GetOptInfo *goi,
                        /* loop for more */
                        break;
 
-               case TCFG_RESET:
-                       if( goi->isconfigure ){
-                               e = Jim_GetOpt_Nvp( goi, nvp_reset_modes, &n );
-                               if( e != JIM_OK ){
-                                       Jim_GetOpt_NvpUnknown( goi, nvp_reset_modes, 1 );
-                                       return e;
-                               }
-                               if( n->value == RESET_UNKNOWN ){
-                                       Jim_SetResultString( interp, "'unknown' is not a valid selection",-1);
-                                       return JIM_ERR;
-                               }
-                               target->reset_mode = n->value;
-                       } else {
-                               if( goi->argc != 0 ){
-                                       goto no_params;
-                               }
-                       }
-                       n = Jim_Nvp_value2name_simple( nvp_reset_modes, target->reset_mode );
-                       if( n->name == NULL ){
-                               target->reset_mode = RESET_HALT;
-                               n = Jim_Nvp_value2name_simple( nvp_reset_modes, target->reset_mode );
-                       }
-                       Jim_SetResultString( goi->interp, n->name, -1 );
-                       /* loop for more */
-                       break;
-                       
                case TCFG_WORK_AREA_VIRT:
                        if( goi->isconfigure ){
                                target_free_all_working_areas(target);
@@ -3191,11 +3165,11 @@ target_configure( Jim_GetOptInfo *goi,
                                if( goi->argc != 0 ){
                                        goto no_params;
                                }
-                       } 
+                       }
                        Jim_SetResult( interp, Jim_NewIntObj( goi->interp, target->working_area_virt ) );
                        /* loop for more */
                        break;
-                               
+
                case TCFG_WORK_AREA_PHYS:
                        if( goi->isconfigure ){
                                target_free_all_working_areas(target);
@@ -3208,7 +3182,7 @@ target_configure( Jim_GetOptInfo *goi,
                                if( goi->argc != 0 ){
                                        goto no_params;
                                }
-                       } 
+                       }
                        Jim_SetResult( interp, Jim_NewIntObj( goi->interp, target->working_area_phys ) );
                        /* loop for more */
                        break;
@@ -3225,7 +3199,7 @@ target_configure( Jim_GetOptInfo *goi,
                                if( goi->argc != 0 ){
                                        goto no_params;
                                }
-                       } 
+                       }
                        Jim_SetResult( interp, Jim_NewIntObj( goi->interp, target->working_area_size ) );
                        /* loop for more */
                        break;
@@ -3243,7 +3217,7 @@ target_configure( Jim_GetOptInfo *goi,
                                if( goi->argc != 0 ){
                                        goto no_params;
                                }
-                       } 
+                       }
                        Jim_SetResult( interp, Jim_NewIntObj( goi->interp, target->working_area_size ) );
                        /* loop for more e*/
                        break;
@@ -3265,7 +3239,7 @@ target_configure( Jim_GetOptInfo *goi,
                        if( n->name == NULL ){
                                target->endianness = TARGET_LITTLE_ENDIAN;
                                n = Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness );
-                       } 
+                       }
                        Jim_SetResultString( goi->interp, n->name, -1 );
                        /* loop for more */
                        break;
@@ -3287,7 +3261,7 @@ target_configure( Jim_GetOptInfo *goi,
                                if( goi->argc != 0 ){
                                        goto no_params;
                                }
-                       } 
+                       }
                        Jim_SetResultString( goi->interp, target->variant,-1 );
                        /* loop for more */
                        break;
@@ -3304,7 +3278,7 @@ target_configure( Jim_GetOptInfo *goi,
                                if( goi->argc != 0 ){
                                        goto no_params;
                                }
-                       } 
+                       }
                        Jim_SetResult( interp, Jim_NewIntObj( goi->interp, target->chain_position ) );
                        /* loop for more e*/
                        break;
@@ -3318,7 +3292,7 @@ target_configure( Jim_GetOptInfo *goi,
 /** this is the 'tcl' handler for the target specific command */
 static int
 tcl_target_func( Jim_Interp *interp,
-                                int argc, 
+                                int argc,
                                 Jim_Obj *const *argv )
 {
        Jim_GetOptInfo goi;
@@ -3334,12 +3308,12 @@ tcl_target_func( Jim_Interp *interp,
        enum {
                TS_CMD_CONFIGURE,
                TS_CMD_CGET,
-               
+
                TS_CMD_MWW, TS_CMD_MWH, TS_CMD_MWB,
                TS_CMD_MDW, TS_CMD_MDH, TS_CMD_MDB,
                TS_CMD_MRW, TS_CMD_MRH, TS_CMD_MRB,
                TS_CMD_MEM2ARRAY, TS_CMD_ARRAY2MEM,
-               TS_CMD_EXAMINE, 
+               TS_CMD_EXAMINE,
                TS_CMD_POLL,
                TS_CMD_RESET,
                TS_CMD_HALT,
@@ -3347,7 +3321,7 @@ tcl_target_func( Jim_Interp *interp,
                TS_CMD_EVENTLIST,
                TS_CMD_CURSTATE,
        };
-       
+
        static const Jim_Nvp target_options[] = {
                { .name = "configure", .value = TS_CMD_CONFIGURE },
                { .name = "cget", .value = TS_CMD_CGET },
@@ -3412,7 +3386,7 @@ tcl_target_func( Jim_Interp *interp,
                 * argv[2] = data
                 * argv[3] = optional count.
                 */
-                 
+
                if( (goi.argc == 3) || (goi.argc == 4) ){
                        /* all is well */
                } else {
@@ -3420,7 +3394,7 @@ tcl_target_func( Jim_Interp *interp,
                        Jim_SetResult_sprintf( goi.interp, "expected: %s ADDR DATA [COUNT]", n->name );
                        return JIM_ERR;
                }
-               
+
                e = Jim_GetOpt_Wide( &goi, &a );
                if( e != JIM_OK ){
                        goto mwx_error;
@@ -3438,7 +3412,7 @@ tcl_target_func( Jim_Interp *interp,
                } else {
                        c = 1;
                }
-                       
+
                switch( n->value ){
                case TS_CMD_MWW:
                        target_buffer_set_u32( target, target_buf, b );
@@ -3515,7 +3489,7 @@ tcl_target_func( Jim_Interp *interp,
                                Jim_SetResult_sprintf( interp, "error reading target @ 0x%08lx", (int)(a) );
                                return JIM_ERR;
                        }
-                       
+
                        Jim_fprintf( interp, interp->cookie_stdout, "0x%08x ", (int)(a) );
                        switch( b ){
                        case 4:
@@ -3549,7 +3523,7 @@ tcl_target_func( Jim_Interp *interp,
                        }
                        /* ascii-ify the bytes */
                        for( x = 0 ; x < y ; x++ ){
-                               if( (target_buf[x] >= 0x20) && 
+                               if( (target_buf[x] >= 0x20) &&
                                        (target_buf[x] <= 0x7e) ){
                                        /* good */
                                } else {
@@ -3633,7 +3607,7 @@ tcl_target_func( Jim_Interp *interp,
                target->type->halt( target );
                return JIM_OK;
        case TS_CMD_WAITSTATE:
-               // params:  <name>  statename timeoutmsecs 
+               // params:  <name>  statename timeoutmsecs
                if( goi.argc != 2 ){
                        Jim_SetResult_sprintf( goi.interp, "%s STATENAME TIMEOUTMSECS", n->name );
                        return JIM_ERR;
@@ -3650,7 +3624,7 @@ tcl_target_func( Jim_Interp *interp,
                e = target_wait_state( target, n->value, a );
                if( e == ERROR_OK ){
                        Jim_SetResult_sprintf( goi.interp,
-                                                                  "target: %s wait %s fails %d", 
+                                                                  "target: %s wait %s fails %d",
                                                                   target->cmd_name,
                                                                   n->name,
                                                                   target_strerror_safe(e) );
@@ -3666,12 +3640,12 @@ tcl_target_func( Jim_Interp *interp,
                        target_event_action_t *teap;
                        teap = target->event_action;
                        command_print( cmd_ctx, "Event actions for target (%d) %s\n",
-                                                  target->target_number, 
+                                                  target->target_number,
                                                   target->cmd_name );
                        command_print( cmd_ctx, "%-25s | Body", "Event");
                        command_print( cmd_ctx, "------------------------- | ----------------------------------------");
                        while( teap ){
-                               command_print( cmd_ctx, 
+                               command_print( cmd_ctx,
                                                           "%-25s | %s",
                                                           Jim_Nvp_value2name_simple( nvp_target_event, teap->event )->name,
                                                           Jim_GetString( teap->body, NULL ) );
@@ -3685,7 +3659,7 @@ tcl_target_func( Jim_Interp *interp,
                        Jim_WrongNumArgs( goi.interp, 0, argv, "[no parameters]");
                        return JIM_ERR;
                }
-               Jim_SetResultString( goi.interp, 
+               Jim_SetResultString( goi.interp,
                                                         Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name,-1);
                return JIM_OK;
        }
@@ -3695,8 +3669,8 @@ tcl_target_func( Jim_Interp *interp,
 
 static int
 target_create( Jim_GetOptInfo *goi )
-{      
-       
+{
+
        Jim_Obj *new_cmd;
        Jim_Cmd *cmd;
        const char *cp;
@@ -3721,7 +3695,7 @@ target_create( Jim_GetOptInfo *goi )
                Jim_SetResult_sprintf(goi->interp, "Command/target: %s Exists", cp);
                return JIM_ERR;
        }
-       
+
        /* TYPE */
        e = Jim_GetOpt_String( goi, &cp2, NULL );
        cp = cp2;
@@ -3736,12 +3710,12 @@ target_create( Jim_GetOptInfo *goi )
                Jim_SetResult_sprintf( goi->interp, "Unknown target type %s, try one of ", cp );
                for( x = 0 ; target_types[x] ; x++ ){
                        if( target_types[x+1] ){
-                               Jim_AppendStrings( goi->interp, 
+                               Jim_AppendStrings( goi->interp,
                                                                   Jim_GetResult(goi->interp),
                                                                   target_types[x]->name,
                                                                   ", ", NULL);
                        } else {
-                               Jim_AppendStrings( goi->interp, 
+                               Jim_AppendStrings( goi->interp,
                                                                   Jim_GetResult(goi->interp),
                                                                   " or ",
                                                                   target_types[x]->name,NULL );
@@ -3750,7 +3724,7 @@ target_create( Jim_GetOptInfo *goi )
                return JIM_ERR;
        }
 
-               
+
        /* Create it */
        target = calloc(1,sizeof(target_t));
        /* set target number */
@@ -3760,7 +3734,7 @@ target_create( Jim_GetOptInfo *goi )
        target->type = (target_type_t*)calloc(1,sizeof(target_type_t));
 
        memcpy( target->type, target_types[x], sizeof(target_type_t));
-       
+
        /* will be set by "-endian" */
        target->endianness = TARGET_ENDIAN_UNKNOWN;
 
@@ -3768,7 +3742,7 @@ target_create( Jim_GetOptInfo *goi )
        target->working_area_size   = 0x0;
        target->working_areas       = NULL;
        target->backup_working_area = 0;
-       
+
        target->state               = TARGET_UNKNOWN;
        target->debug_reason        = DBG_REASON_UNDEFINED;
        target->reg_cache           = NULL;
@@ -3776,7 +3750,7 @@ target_create( Jim_GetOptInfo *goi )
        target->watchpoints         = NULL;
        target->next                = NULL;
        target->arch_info           = NULL;
-       
+
        /* initialize trace information */
        target->trace_info = malloc(sizeof(trace_t));
        target->trace_info->num_trace_points         = 0;
@@ -3786,7 +3760,7 @@ target_create( Jim_GetOptInfo *goi )
        target->trace_info->trace_history            = NULL;
        target->trace_info->trace_history_pos        = 0;
        target->trace_info->trace_history_overflowed = 0;
-       
+
        target->dbgmsg          = NULL;
        target->dbg_msg_enabled = 0;
 
@@ -3858,9 +3832,9 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                TG_CMD_COUNT,
        };
        const char *target_cmds[] = {
-               "create", "types", "names", "current", "number", 
+               "create", "types", "names", "current", "number",
                "count",
-               NULL // terminate 
+               NULL // terminate
        };
 
        LOG_DEBUG("Target command params:");
@@ -3887,9 +3861,9 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                /* YES IT IS OLD SYNTAX */
                Jim_Obj *new_argv[10];
                int      new_argc;
-               
-               /* target_old_syntax 
-                * 
+
+               /* target_old_syntax
+                *
                 * argv[0] typename (above)
                 * argv[1] endian
                 * argv[2] reset method, deprecated/ignored
@@ -3936,14 +3910,14 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                 *   argv[8] = -variant
                 *   argv[9] = "somestring"
                 */
-               
+
                /* don't let these be released */
                for( x = 0 ; x < new_argc ; x++ ){
                        Jim_IncrRefCount( new_argv[x]);
                }
                /* call our self */
                LOG_DEBUG("Target OLD SYNTAX - converted to new syntax");
-               
+
                r = jim_target( goi.interp, new_argc, new_argv );
 
                /* release? these items */
@@ -3995,7 +3969,7 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                                                                   Jim_NewStringObj( goi.interp, target->cmd_name, -1 ) );
                        target = target->next;
                }
-               return JIM_OK;          
+               return JIM_OK;
        case TG_CMD_CREATE:
                if( goi.argc < 3 ){
                        Jim_WrongNumArgs( goi.interp, goi.argc, goi.argv, "?name  ... config options ...");
@@ -4027,7 +4001,7 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                        Jim_WrongNumArgs( goi.interp, 0, goi.argv, "<no parameters>");
                        return JIM_ERR;
                }
-               Jim_SetResult( goi.interp, 
+               Jim_SetResult( goi.interp,
                                           Jim_NewIntObj( goi.interp, max_target_number()));
                return JIM_OK;
        }
index c6f6beddc12f8bdced3842f14bbbbd7033e70014..f6f5177e63d68158505b4cd786a040f2a4ea38cf 100644 (file)
@@ -244,7 +244,6 @@ typedef struct target_s
        int target_number;                  /* generaly, target index but may not be in order */
        int chain_position;                 /* where on the jtag chain is this */
        const char *variant;                /* what varient of this chip is it? */
-       enum target_reset_mode reset_mode;  /* how should this target be reset */
        target_event_action_t *event_action;
 
        int reset_halt;                                         /* attempt resetting the CPU into the halted mode? */