Fix GCC7 warnings about string truncation
[openocd.git] / src / target / arm_adi_v5.c
index 39f2b399bfbee1ac6678483304c0de2718cfef34..2006290237eda467361c12a66bc1253a65135e94 100644 (file)
@@ -346,8 +346,10 @@ static int mem_ap_write(struct adiv5_ap *ap, const uint8_t *buffer, uint32_t siz
                        case 4:
                                outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
                                outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
+                               /* fallthrough */
                        case 2:
                                outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
+                               /* fallthrough */
                        case 1:
                                outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
                        }
@@ -509,8 +511,10 @@ static int mem_ap_read(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint
                        case 4:
                                *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
                                *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
+                               /* fallthrough */
                        case 2:
                                *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
+                               /* fallthrough */
                        case 1:
                                *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
                        }
@@ -519,8 +523,10 @@ static int mem_ap_read(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint
                        case 4:
                                *buffer++ = *read_ptr >> 8 * (address++ & 3);
                                *buffer++ = *read_ptr >> 8 * (address++ & 3);
+                               /* fallthrough */
                        case 2:
                                *buffer++ = *read_ptr >> 8 * (address++ & 3);
+                               /* fallthrough */
                        case 1:
                                *buffer++ = *read_ptr >> 8 * (address++ & 3);
                        }
@@ -1053,7 +1059,7 @@ static int dap_rom_display(struct command_context *cmd_ctx,
        int retval;
        uint64_t pid;
        uint32_t cid;
-       char tabs[7] = "";
+       char tabs[16] = "";
 
        if (depth > 16) {
                command_print(cmd_ctx, "\tTables too deep");
@@ -1359,6 +1365,41 @@ static int dap_info_command(struct command_context *cmd_ctx,
        return ERROR_OK;
 }
 
+int adiv5_jim_configure(struct target *target, Jim_GetOptInfo *goi)
+{
+       struct adiv5_private_config *pc;
+       const char *arg;
+       jim_wide ap_num;
+       int e;
+
+       /* check if argv[0] is for us */
+       arg = Jim_GetString(goi->argv[0], NULL);
+       if (strcmp(arg, "-ap-num"))
+               return JIM_CONTINUE;
+
+       e = Jim_GetOpt_String(goi, &arg, NULL);
+       if (e != JIM_OK)
+               return e;
+
+       if (goi->argc == 0) {
+               Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-ap-num ?ap-number? ...");
+               return JIM_ERR;
+       }
+
+       e = Jim_GetOpt_Wide(goi, &ap_num);
+       if (e != JIM_OK)
+               return e;
+
+       if (target->private_config == NULL) {
+               pc = calloc(1, sizeof(struct adiv5_private_config));
+               target->private_config = pc;
+               pc->ap_num = ap_num;
+       }
+
+
+       return JIM_OK;
+}
+
 COMMAND_HANDLER(handle_dap_info_command)
 {
        struct target *target = get_current_target(CMD_CTX);

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)