flash/kinetis: use coherent indentation in struct initialization
[openocd.git] / src / flash / nor / kinetis.c
index 86fad7215c5402c87666df8b774daed0a90ee6c2..9b2c014ca928e8fe585c010c225bb907a93d3f52 100644 (file)
@@ -393,7 +393,7 @@ static bool fcf_fopt_configured;
 static bool create_banks;
 
 
-struct flash_driver kinetis_flash;
+const struct flash_driver kinetis_flash;
 static int kinetis_write_inner(struct flash_bank *bank, const uint8_t *buffer,
                        uint32_t offset, uint32_t count);
 static int kinetis_probe_chip(struct kinetis_chip *k_chip);
@@ -1035,7 +1035,7 @@ static int kinetis_disable_wdog_algo(struct target *target, size_t code_size, co
                armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
                armv7m_info.core_mode = ARM_MODE_THREAD;
 
-               init_reg_param(&reg_params[0], "r0", 32, PARAM_IN);
+               init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
                buf_set_u32(reg_params[0].value, 0, 32, wdog_base);
 
                retval = target_run_algorithm(target, 0, NULL, 1, reg_params,
@@ -1755,13 +1755,15 @@ static int kinetis_write_sections(struct flash_bank *bank, const uint8_t *buffer
                        result = target_write_memory(bank->target, k_chip->progr_accel_ram,
                                                4, size_aligned / 4, buffer_aligned);
 
-                       LOG_DEBUG("section @ %08" PRIx32 " aligned begin %" PRIu32 ", end %" PRIu32,
+                       LOG_DEBUG("section @ " TARGET_ADDR_FMT " aligned begin %" PRIu32
+                                       ", end %" PRIu32,
                                        bank->base + offset, align_begin, align_end);
                } else
                        result = target_write_memory(bank->target, k_chip->progr_accel_ram,
                                                4, size_aligned / 4, buffer);
 
-               LOG_DEBUG("write section @ %08" PRIx32 " with length %" PRIu32 " bytes",
+               LOG_DEBUG("write section @ " TARGET_ADDR_FMT " with length %" PRIu32
+                               " bytes",
                          bank->base + offset, size);
 
                if (result != ERROR_OK) {
@@ -1776,12 +1778,14 @@ static int kinetis_write_sections(struct flash_bank *bank, const uint8_t *buffer
                                0, 0, 0, 0,  &ftfx_fstat);
 
                if (result != ERROR_OK) {
-                       LOG_ERROR("Error writing section at %08" PRIx32, bank->base + offset);
+                       LOG_ERROR("Error writing section at " TARGET_ADDR_FMT,
+                                       bank->base + offset);
                        break;
                }
 
                if (ftfx_fstat & 0x01) {
-                       LOG_ERROR("Flash write error at %08" PRIx32, bank->base + offset);
+                       LOG_ERROR("Flash write error at " TARGET_ADDR_FMT,
+                                       bank->base + offset);
                        if (k_bank->prog_base == 0 && offset == FCF_ADDRESS + FCF_SIZE
                                        && (k_chip->flash_support & FS_WIDTH_256BIT)) {
                                LOG_ERROR("Flash write immediately after the end of Flash Config Field shows error");
@@ -1820,7 +1824,7 @@ static int kinetis_write_inner(struct flash_bank *bank, const uint8_t *buffer,
                }
        }
 
-       LOG_DEBUG("flash write @ %08" PRIx32, bank->base + offset);
+       LOG_DEBUG("flash write @ " TARGET_ADDR_FMT, bank->base + offset);
 
        if (fallback == 0) {
                /* program section command */
@@ -1873,12 +1877,14 @@ static int kinetis_write_inner(struct flash_bank *bank, const uint8_t *buffer,
                                                0, 0, 0, 0,  &ftfx_fstat);
 
                                if (result != ERROR_OK) {
-                                       LOG_ERROR("Error writing longword at %08" PRIx32, bank->base + offset);
+                                       LOG_ERROR("Error writing longword at " TARGET_ADDR_FMT,
+                                                       bank->base + offset);
                                        break;
                                }
 
                                if (ftfx_fstat & 0x01)
-                                       LOG_ERROR("Flash write error at %08" PRIx32, bank->base + offset);
+                                       LOG_ERROR("Flash write error at " TARGET_ADDR_FMT,
+                                                       bank->base + offset);
 
                                buffer += 4;
                                offset += 4;
@@ -2769,7 +2775,7 @@ static int kinetis_info(struct flash_bank *bank, char *buf, int buf_size)
        uint32_t size_k = bank->size / 1024;
 
        snprintf(buf, buf_size,
-               "%s %s: %" PRIu32 "k %s bank %s at 0x%08" PRIx32,
+               "%s %s: %" PRIu32 "k %s bank %s at " TARGET_ADDR_FMT,
                bank->driver->name, k_chip->name,
                size_k, bank_class_names[k_bank->flash_class],
                bank->name, bank->base);
@@ -3068,7 +3074,8 @@ static const struct command_registration kinetis_security_command_handlers[] = {
                .usage = "",
                .handler = kinetis_mdm_mass_erase,
        },
-       {       .name = "reset",
+       {
+               .name = "reset",
                .mode = COMMAND_EXEC,
                .help = "Issue a reset via the MDM-AP",
                .usage = "",
@@ -3137,7 +3144,7 @@ static const struct command_registration kinetis_command_handler[] = {
 
 
 
-struct flash_driver kinetis_flash = {
+const struct flash_driver kinetis_flash = {
        .name = "kinetis",
        .commands = kinetis_command_handler,
        .flash_bank_command = kinetis_flash_bank_command,

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)