- only if "reset halt" or "reset init" are issued will the reset vector be set up
[openocd.git] / src / target / target.c
index f90834d1bd8263c006922ed4e8d843022fa3b041..bfe0f14aeb6a41b35d7420fcab69d921a08a597e 100644 (file)
@@ -297,7 +297,11 @@ int target_process_reset(struct command_context_s *cmd_ctx)
                target->type->assert_reset(target);
                target = target->next;
        }
-       jtag_execute_queue();
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
+       {
+               LOG_WARNING("JTAG communication failed asserting reset.");
+               retval = ERROR_OK;
+       }
        
        /* request target halt if necessary, and schedule further action */
        target = targets;
@@ -330,13 +334,24 @@ int target_process_reset(struct command_context_s *cmd_ctx)
                target = target->next;
        }
        
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
+       {
+               LOG_WARNING("JTAG communication failed while reset was asserted. Consider using srst_only for reset_config.");
+               retval = ERROR_OK;              
+       }
+       
        target = targets;
        while (target)
        {
                target->type->deassert_reset(target);
                target = target->next;
        }
-       jtag_execute_queue();
+       
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
+       {
+               LOG_WARNING("JTAG communication failed while deasserting reset.");
+               retval = ERROR_OK;
+       }
        
        LOG_DEBUG("Waiting for halted stated as approperiate");
        
@@ -784,7 +799,7 @@ int target_free_all_working_areas(struct target_s *target)
 
 int target_register_commands(struct command_context_s *cmd_ctx)
 {
-       register_command(cmd_ctx, NULL, "target", handle_target_command, COMMAND_CONFIG, NULL);
+       register_command(cmd_ctx, NULL, "target", handle_target_command, COMMAND_CONFIG, "target <cpu> [reset_init default - DEPRECATED] <chainpos> <endianness> <variant> [cpu type specifc args]");
        register_command(cmd_ctx, NULL, "targets", handle_targets_command, COMMAND_EXEC, NULL);
        register_command(cmd_ctx, NULL, "daemon_startup", handle_daemon_startup_command, COMMAND_CONFIG, NULL);
        register_command(cmd_ctx, NULL, "target_script", handle_target_script_command, COMMAND_CONFIG, NULL);
@@ -1191,6 +1206,7 @@ int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **a
                                }
                                
                                /* 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;
                                else if (strcmp(args[2], "reset_run") == 0)
@@ -1203,8 +1219,9 @@ int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **a
                                        (*last_target_p)->reset_mode = RESET_RUN_AND_INIT;
                                else
                                {
-                                       LOG_ERROR("unknown target startup mode %s", args[2]);
-                                       return ERROR_COMMAND_SYNTAX_ERROR;
+                                       /* Kludge! we want to make this reset arg optional while remaining compatible! */
+                                       args--;
+                                       argc++;
                                }
                                (*last_target_p)->run_and_halt_time = 1000; /* default 1s */
                                
@@ -2053,14 +2070,13 @@ int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, ch
        
        if (argc < 1)
        {
-               command_print(cmd_ctx, "usage: verify_image <file> [offset] [type]");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        
        if (!target)
        {
                LOG_ERROR("no target selected");
-               return ERROR_OK;
+               return ERROR_FAIL;
        }
        
        duration_start_measure(&duration);
@@ -2078,9 +2094,9 @@ int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, ch
 
        image.start_address_set = 0;
 
-       if (image_open(&image, args[0], (argc == 3) ? args[2] : NULL) != ERROR_OK)
+       if ((retval=image_open(&image, args[0], (argc == 3) ? args[2] : NULL)) != ERROR_OK)
        {
-               return ERROR_OK;
+               return retval;
        }
        
        image_size = 0x0;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)