- str9xpec driver was using stricmp, changed to strcmp for posix compatibility
[openocd.git] / src / flash / flash.c
index 58a467d2b30b66e53186d2dc658e7abb8473f67d..eaa1e17eecb2011a67768fddcd388d2c8b51d711 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "flash.h"
 #include "command.h"
-#include "log.h"
 #include "target.h"
 #include "time_support.h"
 
@@ -36,6 +35,7 @@
 
 #include <fileio.h>
 #include <image.h>
+#include "log.h"
 
 /* command handlers */
 int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@@ -55,6 +55,8 @@ extern flash_driver_t cfi_flash;
 extern flash_driver_t at91sam7_flash;
 extern flash_driver_t str7x_flash;
 extern flash_driver_t str9x_flash;
+extern flash_driver_t stellaris_flash;
+extern flash_driver_t str9xpec_flash;
 
 flash_driver_t *flash_drivers[] =
 {
@@ -63,6 +65,8 @@ flash_driver_t *flash_drivers[] =
        &at91sam7_flash,
        &str7x_flash,
        &str9x_flash,
+       &stellaris_flash,
+       &str9xpec_flash,
        NULL,
 };
 
@@ -371,9 +375,10 @@ int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, cha
                int last = strtoul(args[2], NULL, 0);
                int retval;
                flash_bank_t *p = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
-               struct timeval start, end, duration;
-
-               gettimeofday(&start, NULL);
+               duration_t duration;
+               char *duration_text;
+       
+               duration_start_measure(&duration);
        
                if (!p)
                {
@@ -409,10 +414,10 @@ int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, cha
                }
                else
                {
-                       gettimeofday(&end, NULL);       
-                       timeval_subtract(&duration, &end, &start);
-               
-                       command_print(cmd_ctx, "erased sectors %i through %i on flash bank %i in %is %ius", first, last, strtoul(args[0], 0, 0), duration.tv_sec, duration.tv_usec);
+                       duration_stop_measure(&duration, &duration_text);       
+                       
+                       command_print(cmd_ctx, "erased sectors %i through %i on flash bank %i in %s", first, last, strtoul(args[0], 0, 0), duration_text);
+                       free(duration_text);
                }
        }
        else
@@ -511,8 +516,6 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
        
        duration_start_measure(&duration);
        
-       identify_image_type(&image.type, (argc == 4) ? args[3] : NULL);
-
        image.base_address_set = 1;
        image.base_address = strtoul(args[1], NULL, 0);
        
@@ -526,7 +529,7 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
                return ERROR_OK;
        }
        
-       if (image_open(&image, args[1], FILEIO_READ) != ERROR_OK)
+       if (image_open(&image, args[1], (argc == 4) ? args[3] : NULL) != ERROR_OK)
        {
                command_print(cmd_ctx, "flash write error: %s", image.error_str);
                return ERROR_OK;

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)