kinetis flash: use longword write when writing into pflash
[openocd.git] / src / flash / mflash.c
index 43721280e943d0cf7bac8d78a8b984445c39d0dc..ba34422237d10cd3c6ac9e1f6e3a30a59f7e5f96 100644 (file)
@@ -720,14 +720,20 @@ COMMAND_HANDLER(mg_write_cmd)
        if (ret != ERROR_OK)
                return ret;
 
+       int filesize;
        buffer = malloc(MG_FILEIO_CHUNK);
        if (!buffer) {
                fileio_close(&fileio);
                return ERROR_FAIL;
        }
+       int retval = fileio_size(&fileio, &filesize);
+       if (retval != ERROR_OK) {
+               fileio_close(&fileio);
+               return retval;
+       }
 
-       cnt = fileio.size / MG_FILEIO_CHUNK;
-       res = fileio.size % MG_FILEIO_CHUNK;
+       cnt = filesize / MG_FILEIO_CHUNK;
+       res = filesize % MG_FILEIO_CHUNK;
 
        struct duration bench;
        duration_start(&bench);
@@ -752,8 +758,8 @@ COMMAND_HANDLER(mg_write_cmd)
        if (duration_measure(&bench) == ERROR_OK)
        {
                command_print(CMD_CTX, "wrote %ld bytes from file %s "
-                               "in %fs (%0.3f kB/s)", (long)fileio.size, CMD_ARGV[1],
-                               duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
+                               "in %fs (%0.3f kB/s)", (long)filesize, CMD_ARGV[1],
+                               duration_elapsed(&bench), duration_kbps(&bench, filesize));
        }
 
        free(buffer);
@@ -1121,7 +1127,7 @@ static int mg_storage_config(void)
                        != ERROR_OK)
                return ret;
 
-       mg_gen_ataid((mg_io_type_drv_info *)buff);
+       mg_gen_ataid((mg_io_type_drv_info *)(void *)buff);
 
        if ((ret = mg_mflash_do_write_sects(buff, 0, 1, mg_vcmd_update_stgdrvinfo))
                        != ERROR_OK)
@@ -1149,7 +1155,7 @@ static int mg_boot_config(void)
        buff[0] = mg_op_mode_snd;               /* operation mode */
        buff[1] = MG_UNLOCK_OTP_AREA;
        buff[2] = 4;                            /* boot size */
-       *((uint32_t *)(buff + 4)) = 0;          /* XIP size */
+       *((uint32_t *)(void *)(buff + 4)) = 0;          /* XIP size */
 
        if ((ret = mg_mflash_do_write_sects(buff, 0, 1, mg_vcmd_update_xipinfo))
                        != 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)