streamline and document helptext mode displays
[fw/openocd] / src / flash / nor / tcl.c
index 5ba941b36f4e528a53b598c08c76dc9dafe1e78d..ad2b8f11d89402673d880b509f4f5a0adab35879 100644 (file)
@@ -439,7 +439,7 @@ COMMAND_HANDLER(handle_flash_write_image_command)
 
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               command_print(CMD_CTX, "wrote %" PRIu32 " byte from file %s "
+               command_print(CMD_CTX, "wrote %" PRIu32 " bytes from file %s "
                                "in %fs (%0.3f kb/s)", written, CMD_ARGV[0],
                                duration_elapsed(&bench), duration_kbps(&bench, written));
        }
@@ -534,14 +534,16 @@ COMMAND_HANDLER(handle_flash_fill_command)
 
        for (wrote = 0; wrote < (count*wordsize); wrote += cur_size)
        {
-               cur_size = MIN((count*wordsize - wrote), sizeof(chunk));
                struct flash_bank *bank;
+
                bank = get_flash_bank_by_addr(target, address);
                if (bank == NULL)
                {
                        retval = ERROR_FAIL;
                        goto done;
                }
+
+               cur_size = MIN((count * wordsize - wrote), chunksize);
                err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size);
                if (err != ERROR_OK)
                {
@@ -576,7 +578,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
                                duration_elapsed(&bench), duration_kbps(&bench, wrote));
        }
 
-       done:
+done:
        free(readback);
        free(chunk);
 
@@ -623,9 +625,9 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
 
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
        {
-               command_print(CMD_CTX, "wrote %zu byte from file %s to flash bank %u"
+               command_print(CMD_CTX, "wrote %ld bytes from file %s to flash bank %u"
                                " at offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
-                               fileio.size, CMD_ARGV[1], p->bank_number, offset,
+                               (long)fileio.size, CMD_ARGV[1], p->bank_number, offset,
                                duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
        }
 
@@ -697,21 +699,21 @@ static const struct command_registration flash_exec_command_handlers[] = {
                .name = "fillw",
                .handler = &handle_flash_fill_command,
                .mode = COMMAND_EXEC,
-               .usage = "<bank> <address> <word_pattern> <count>",
+               .usage = "<address> <word_pattern> <count>",
                .help = "fill with pattern (no autoerase)",
        },
        {
                .name = "fillh",
                .handler = &handle_flash_fill_command,
                .mode = COMMAND_EXEC,
-               .usage = "<bank> <address> <halfword_pattern> <count>",
+               .usage = "<address> <halfword_pattern> <count>",
                .help = "fill with pattern",
        },
        {
                .name = "fillb",
                .handler = &handle_flash_fill_command,
                .mode = COMMAND_EXEC,
-               .usage = "<bank> <address> <byte_pattern> <count>",
+               .usage = "<address> <byte_pattern> <count>",
                .help = "fill with pattern",
 
        },
@@ -726,7 +728,7 @@ static const struct command_registration flash_exec_command_handlers[] = {
                .name = "write_image",
                .handler = &handle_flash_write_image_command,
                .mode = COMMAND_EXEC,
-               .usage = "<bank> [erase] [unlock] <file> [offset] [type]",
+               .usage = "[erase] [unlock] <file> [offset] [type]",
                .help = "write an image to flash"
        },
        {