jtagspi: fix build on MacOS
[openocd.git] / src / flash / nor / xmc1xxx.c
index 757dd952f5910d863a0d716cf09c3e4072c86e60..9e5f0a3ddd7ce2937ed07380b2eab62112e9bb9b 100644 (file)
@@ -11,6 +11,7 @@
 #endif
 
 #include "imp.h"
+#include <helper/align.h>
 #include <helper/binarybuffer.h>
 #include <target/algorithm.h>
 #include <target/armv7m.h>
@@ -140,9 +141,6 @@ static int xmc1xxx_erase(struct flash_bank *bank, unsigned int first,
                goto err_run;
        }
 
-       for (unsigned int sector = first; sector <= last; sector++)
-               bank->sectors[sector].is_erased = 1;
-
 err_run:
        for (i = 0; i < ARRAY_SIZE(reg_params); i++)
                destroy_reg_param(&reg_params[i]);
@@ -256,12 +254,12 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
        LOG_DEBUG("Infineon XMC1000 write at 0x%08" PRIx32 " (%" PRIu32 " bytes)",
                offset, byte_count);
 
-       if (offset & (NVM_BLOCK_SIZE - 1)) {
+       if (!IS_ALIGNED(offset, NVM_BLOCK_SIZE)) {
                LOG_ERROR("offset 0x%" PRIx32 " breaks required block alignment",
                        offset);
                return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
        }
-       if (byte_count & (NVM_BLOCK_SIZE - 1)) {
+       if (!IS_ALIGNED(byte_count, NVM_BLOCK_SIZE)) {
                LOG_WARNING("length %" PRIu32 " is not block aligned, rounding up",
                        byte_count);
        }
@@ -403,7 +401,7 @@ static int xmc1xxx_protect_check(struct flash_bank *bank)
        return ERROR_OK;
 }
 
-static int xmc1xxx_get_info_command(struct flash_bank *bank, char *buf, int buf_size)
+static int xmc1xxx_get_info_command(struct flash_bank *bank, struct command_invocation *cmd)
 {
        uint32_t chipid[8];
        int i, retval;
@@ -429,7 +427,8 @@ static int xmc1xxx_get_info_command(struct flash_bank *bank, char *buf, int buf_
        }
        LOG_DEBUG("ID[7] = %08" PRIX32, chipid[7]);
 
-       snprintf(buf, buf_size, "XMC%" PRIx32 "00 %" PRIX32 " flash %" PRIu32 "KB ROM %" PRIu32 "KB SRAM %" PRIu32 "KB",
+       command_print_sameline(cmd,
+                       "XMC%" PRIx32 "00 %" PRIX32 " flash %" PRIu32 "KB ROM %" PRIu32 "KB SRAM %" PRIu32 "KB",
                        (chipid[0] >> 12) & 0xff,
                        0xAA + (chipid[7] >> 28) - 1,
                        (((chipid[6] >> 12) & 0x3f) - 1) * 4,

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)