finish removing deprecated/obsolete commands
[openocd.git] / src / target / target.c
index 5eec09c8953e3178d84da60cb70380448c6227a9..90c143ff541ed0d59508dec1e20b30fad93ff191 100644 (file)
@@ -1282,10 +1282,10 @@ void target_free_all_working_areas(struct target_s *target)
 int target_register_commands(struct command_context_s *cmd_ctx)
 {
 
-       register_command(cmd_ctx, NULL, "targets", handle_targets_command, COMMAND_EXEC, "change the current command line target (one parameter) or lists targets (with no parameter)");
-
-
-
+       register_command(cmd_ctx, NULL, "targets",
+                       handle_targets_command, COMMAND_EXEC,
+                       "change current command line target (one parameter) "
+                       "or list targets (no parameters)");
 
        register_jim(cmd_ctx, "target", jim_target, "configure target");
 
@@ -2507,20 +2507,17 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm
        uint32_t min_address = 0;
        uint32_t max_address = 0xffffffff;
        int i;
-       int retvaltemp;
-
        image_t image;
 
-       duration_t duration;
-       char *duration_text;
-
        int retval = parse_load_image_command_args(cmd_ctx, args, argc,
                        &image, &min_address, &max_address);
        if (ERROR_OK != retval)
                return retval;
 
        target_t *target = get_current_target(cmd_ctx);
-       duration_start_measure(&duration);
+
+       struct duration bench;
+       duration_start(&bench);
 
        if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK)
        {
@@ -2580,20 +2577,13 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm
                free(buffer);
        }
 
-       if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+       if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               image_close(&image);
-               return retvaltemp;
+               command_print(cmd_ctx, "downloaded %" PRIu32 " bytes "
+                               "in %fs (%0.3f kb/s)", image_size,
+                               duration_elapsed(&bench), duration_kbps(&bench, image_size));
        }
 
-       if (retval == ERROR_OK)
-       {
-               command_print(cmd_ctx, "downloaded %u byte in %s",
-                                         (unsigned int)image_size,
-                                         duration_text);
-       }
-       free(duration_text);
-
        image_close(&image);
 
        return retval;
@@ -2607,8 +2597,6 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm
        uint8_t buffer[560];
        int retvaltemp;
 
-       duration_t duration;
-       char *duration_text;
 
        target_t *target = get_current_target(cmd_ctx);
 
@@ -2628,7 +2616,8 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm
                return ERROR_OK;
        }
 
-       duration_start_measure(&duration);
+       struct duration bench;
+       duration_start(&bench);
 
        int retval = ERROR_OK;
        while (size > 0)
@@ -2654,14 +2643,11 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm
        if ((retvaltemp = fileio_close(&fileio)) != ERROR_OK)
                return retvaltemp;
 
-       if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
-               return retvaltemp;
-
-       if (retval == ERROR_OK)
+       if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               command_print(cmd_ctx, "dumped %lld byte in %s",
-                               fileio.size, duration_text);
-               free(duration_text);
+               command_print(cmd_ctx,
+                               "dumped %lld bytes in %fs (%0.3f kb/s)", fileio.size,
+                               duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
        }
 
        return retval;
@@ -2673,15 +2659,12 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
        uint32_t buf_cnt;
        uint32_t image_size;
        int i;
-       int retval, retvaltemp;
+       int retval;
        uint32_t checksum = 0;
        uint32_t mem_checksum = 0;
 
        image_t image;
 
-       duration_t duration;
-       char *duration_text;
-
        target_t *target = get_current_target(cmd_ctx);
 
        if (argc < 1)
@@ -2695,7 +2678,8 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
                return ERROR_FAIL;
        }
 
-       duration_start_measure(&duration);
+       struct duration bench;
+       duration_start(&bench);
 
        if (argc >= 2)
        {
@@ -2802,20 +2786,12 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
                image_size += buf_cnt;
        }
 done:
-
-       if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
-       {
-               image_close(&image);
-               return retvaltemp;
-       }
-
-       if (retval == ERROR_OK)
+       if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               command_print(cmd_ctx, "verified %u bytes in %s",
-                                         (unsigned int)image_size,
-                                         duration_text);
+               command_print(cmd_ctx, "verified %" PRIu32 " bytes "
+                               "in %fs (%0.3f kb/s)", image_size,
+                               duration_elapsed(&bench), duration_kbps(&bench, image_size));
        }
-       free(duration_text);
 
        image_close(&image);
 
@@ -4672,15 +4648,13 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
 
        image_t image;
 
-       duration_t duration;
-       char *duration_text;
-
        int retval = parse_load_image_command_args(cmd_ctx, args, argc,
                        &image, &min_address, &max_address);
        if (ERROR_OK != retval)
                return retval;
 
-       duration_start_measure(&duration);
+       struct duration bench;
+       duration_start(&bench);
 
        if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK)
        {
@@ -4753,13 +4727,16 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
                free(buffer);
        }
 
-       duration_stop_measure(&duration, &duration_text);
-       if (retval == ERROR_OK)
+       if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               command_print(cmd_ctx, "Loaded %u bytes in %s", (unsigned int)image_size, duration_text);
-               command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so.");
+               command_print(cmd_ctx, "Loaded %" PRIu32 " bytes "
+                               "in %fs (%0.3f kb/s)", image_size, 
+                               duration_elapsed(&bench), duration_kbps(&bench, image_size));
+
+               command_print(cmd_ctx,
+                               "WARNING: image has not been loaded to target!"
+                               "You can issue a 'fast_load' to finish loading.");
        }
-       free(duration_text);
 
        image_close(&image);
 

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)