Use boolean argument for register_get_by_name()
[openocd.git] / src / target / target.c
index d60e642c94632e6c061811a134b70f812ccfc069..dbc99b41cfcd7eb5dffb39851160b21deed51f87 100644 (file)
@@ -158,7 +158,7 @@ static LIST_HEAD(target_reset_callback_list);
 static LIST_HEAD(target_trace_callback_list);
 static const int polling_interval = 100;
 
-static const Jim_Nvp nvp_assert[] = {
+static const struct jim_nvp nvp_assert[] = {
        { .name = "assert", NVP_ASSERT },
        { .name = "deassert", NVP_DEASSERT },
        { .name = "T", NVP_ASSERT },
@@ -168,7 +168,7 @@ static const Jim_Nvp nvp_assert[] = {
        { .name = NULL, .value = -1 }
 };
 
-static const Jim_Nvp nvp_error_target[] = {
+static const struct jim_nvp nvp_error_target[] = {
        { .value = ERROR_TARGET_INVALID, .name = "err-invalid" },
        { .value = ERROR_TARGET_INIT_FAILED, .name = "err-init-failed" },
        { .value = ERROR_TARGET_TIMEOUT, .name = "err-timeout" },
@@ -185,16 +185,16 @@ static const Jim_Nvp nvp_error_target[] = {
 
 static const char *target_strerror_safe(int err)
 {
-       const Jim_Nvp *n;
+       const struct jim_nvp *n;
 
-       n = Jim_Nvp_value2name_simple(nvp_error_target, err);
+       n = jim_nvp_value2name_simple(nvp_error_target, err);
        if (n->name == NULL)
                return "unknown";
        else
                return n->name;
 }
 
-static const Jim_Nvp nvp_target_event[] = {
+static const struct jim_nvp nvp_target_event[] = {
 
        { .value = TARGET_EVENT_GDB_HALT, .name = "gdb-halt" },
        { .value = TARGET_EVENT_HALTED, .name = "halted" },
@@ -237,7 +237,7 @@ static const Jim_Nvp nvp_target_event[] = {
        { .name = NULL, .value = -1 }
 };
 
-static const Jim_Nvp nvp_target_state[] = {
+static const struct jim_nvp nvp_target_state[] = {
        { .name = "unknown", .value = TARGET_UNKNOWN },
        { .name = "running", .value = TARGET_RUNNING },
        { .name = "halted",  .value = TARGET_HALTED },
@@ -246,7 +246,7 @@ static const Jim_Nvp nvp_target_state[] = {
        { .name = NULL, .value = -1 },
 };
 
-static const Jim_Nvp nvp_target_debug_reason[] = {
+static const struct jim_nvp nvp_target_debug_reason[] = {
        { .name = "debug-request",             .value = DBG_REASON_DBGRQ },
        { .name = "breakpoint",                .value = DBG_REASON_BREAKPOINT },
        { .name = "watchpoint",                .value = DBG_REASON_WATCHPOINT },
@@ -259,7 +259,7 @@ static const Jim_Nvp nvp_target_debug_reason[] = {
        { .name = NULL, .value = -1 },
 };
 
-static const Jim_Nvp nvp_target_endian[] = {
+static const struct jim_nvp nvp_target_endian[] = {
        { .name = "big",    .value = TARGET_BIG_ENDIAN },
        { .name = "little", .value = TARGET_LITTLE_ENDIAN },
        { .name = "be",     .value = TARGET_BIG_ENDIAN },
@@ -267,7 +267,7 @@ static const Jim_Nvp nvp_target_endian[] = {
        { .name = NULL,     .value = -1 },
 };
 
-static const Jim_Nvp nvp_reset_modes[] = {
+static const struct jim_nvp nvp_reset_modes[] = {
        { .name = "unknown", .value = RESET_UNKNOWN },
        { .name = "run",     .value = RESET_RUN },
        { .name = "halt",    .value = RESET_HALT },
@@ -279,7 +279,7 @@ const char *debug_reason_name(struct target *t)
 {
        const char *cp;
 
-       cp = Jim_Nvp_value2name_simple(nvp_target_debug_reason,
+       cp = jim_nvp_value2name_simple(nvp_target_debug_reason,
                        t->debug_reason)->name;
        if (!cp) {
                LOG_ERROR("Invalid debug reason: %d", (int)(t->debug_reason));
@@ -291,7 +291,7 @@ const char *debug_reason_name(struct target *t)
 const char *target_state_name(struct target *t)
 {
        const char *cp;
-       cp = Jim_Nvp_value2name_simple(nvp_target_state, t->state)->name;
+       cp = jim_nvp_value2name_simple(nvp_target_state, t->state)->name;
        if (!cp) {
                LOG_ERROR("Invalid target state: %d", (int)(t->state));
                cp = "(*BUG*unknown*BUG*)";
@@ -306,7 +306,7 @@ const char *target_state_name(struct target *t)
 const char *target_event_name(enum target_event event)
 {
        const char *cp;
-       cp = Jim_Nvp_value2name_simple(nvp_target_event, event)->name;
+       cp = jim_nvp_value2name_simple(nvp_target_event, event)->name;
        if (!cp) {
                LOG_ERROR("Invalid target event: %d", (int)(event));
                cp = "(*BUG*unknown*BUG*)";
@@ -317,7 +317,7 @@ const char *target_event_name(enum target_event event)
 const char *target_reset_mode_name(enum target_reset_mode reset_mode)
 {
        const char *cp;
-       cp = Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode)->name;
+       cp = jim_nvp_value2name_simple(nvp_reset_modes, reset_mode)->name;
        if (!cp) {
                LOG_ERROR("Invalid target reset mode: %d", (int)(reset_mode));
                cp = "(*BUG*unknown*BUG*)";
@@ -661,8 +661,8 @@ static int target_process_reset(struct command_invocation *cmd, enum target_rese
 {
        char buf[100];
        int retval;
-       Jim_Nvp *n;
-       n = Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode);
+       struct jim_nvp *n;
+       n = jim_nvp_value2name_simple(nvp_reset_modes, reset_mode);
        if (n->name == NULL) {
                LOG_ERROR("invalid reset mode");
                return ERROR_FAIL;
@@ -1506,6 +1506,13 @@ unsigned target_address_bits(struct target *target)
        return 32;
 }
 
+unsigned int target_data_bits(struct target *target)
+{
+       if (target->type->data_bits)
+               return target->type->data_bits(target);
+       return 32;
+}
+
 static int target_profiling(struct target *target, uint32_t *samples,
                        uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
 {
@@ -1823,7 +1830,7 @@ int target_call_event_callbacks(struct target *target, enum target_event event)
        }
 
        LOG_DEBUG("target event %i (%s) for core %s", event,
-                       Jim_Nvp_value2name_simple(nvp_target_event, event)->name,
+                       jim_nvp_value2name_simple(nvp_target_event, event)->name,
                        target_name(target));
 
        target_handle_event(target, event);
@@ -1842,7 +1849,7 @@ int target_call_reset_callbacks(struct target *target, enum target_reset_mode re
        struct target_reset_callback *callback;
 
        LOG_DEBUG("target reset %i (%s)", reset_mode,
-                       Jim_Nvp_value2name_simple(nvp_reset_modes, reset_mode)->name);
+                       jim_nvp_value2name_simple(nvp_reset_modes, reset_mode)->name);
 
        list_for_each_entry(callback, &target_reset_callback_list, list)
                callback->callback(target, reset_mode, callback->priv);
@@ -2335,7 +2342,7 @@ int target_profiling_default(struct target *target, uint32_t *samples,
 
        uint32_t sample_count = 0;
        /* hopefully it is safe to cache! We want to stop/restart as quickly as possible. */
-       struct reg *reg = register_get_by_name(target->reg_cache, "pc", 1);
+       struct reg *reg = register_get_by_name(target->reg_cache, "pc", true);
 
        int retval = ERROR_OK;
        for (;;) {
@@ -2402,10 +2409,13 @@ static int target_write_buffer_default(struct target *target,
        target_addr_t address, uint32_t count, const uint8_t *buffer)
 {
        uint32_t size;
+       unsigned int data_bytes = target_data_bits(target) / 8;
 
-       /* Align up to maximum bytes. The loop condition makes sure the next pass
+       /* Align up to maximum bytes. The loop condition makes sure the next pass
         * will have something to do with the size we leave to it. */
-       for (size = 1; size < 4 && count >= size * 2 + (address & size); size *= 2) {
+       for (size = 1;
+                       size < data_bytes && count >= size * 2 + (address & size);
+                       size *= 2) {
                if (address & size) {
                        int retval = target_write_memory(target, address, size, 1, buffer);
                        if (retval != ERROR_OK)
@@ -2463,10 +2473,13 @@ int target_read_buffer(struct target *target, target_addr_t address, uint32_t si
 static int target_read_buffer_default(struct target *target, target_addr_t address, uint32_t count, uint8_t *buffer)
 {
        uint32_t size;
+       unsigned int data_bytes = target_data_bits(target) / 8;
 
-       /* Align up to maximum bytes. The loop condition makes sure the next pass
+       /* Align up to maximum bytes. The loop condition makes sure the next pass
         * will have something to do with the size we leave to it. */
-       for (size = 1; size < 4 && count >= size * 2 + (address & size); size *= 2) {
+       for (size = 1;
+                       size < data_bytes && count >= size * 2 + (address & size);
+                       size *= 2) {
                if (address & size) {
                        int retval = target_read_memory(target, address, size, 1, buffer);
                        if (retval != ERROR_OK)
@@ -2859,7 +2872,7 @@ COMMAND_HANDLER(handle_targets_command)
                                marker,
                                target_name(target),
                                target_type_name(target),
-                               Jim_Nvp_value2name_simple(nvp_target_endian,
+                               jim_nvp_value2name_simple(nvp_target_endian,
                                        target->endianness)->name,
                                target->tap->dotted_name,
                                state);
@@ -3121,7 +3134,7 @@ COMMAND_HANDLER(handle_reg_command)
                }
        } else {
                /* access a single register by its name */
-               reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], 1);
+               reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], true);
 
                if (!reg)
                        goto not_found;
@@ -3239,7 +3252,7 @@ int target_wait_state(struct target *target, enum target_state state, int ms)
                        once = false;
                        then = timeval_ms();
                        LOG_DEBUG("waiting for target %s...",
-                               Jim_Nvp_value2name_simple(nvp_target_state, state)->name);
+                               jim_nvp_value2name_simple(nvp_target_state, state)->name);
                }
 
                if (cur-then > 500)
@@ -3247,7 +3260,7 @@ int target_wait_state(struct target *target, enum target_state state, int ms)
 
                if ((cur-then) > ms) {
                        LOG_ERROR("timed out while waiting for target %s",
-                               Jim_Nvp_value2name_simple(nvp_target_state, state)->name);
+                               jim_nvp_value2name_simple(nvp_target_state, state)->name);
                        return ERROR_FAIL;
                }
        }
@@ -3297,8 +3310,8 @@ COMMAND_HANDLER(handle_reset_command)
 
        enum target_reset_mode reset_mode = RESET_RUN;
        if (CMD_ARGC == 1) {
-               const Jim_Nvp *n;
-               n = Jim_Nvp_name2value_simple(nvp_reset_modes, CMD_ARGV[0]);
+               const struct jim_nvp *n;
+               n = jim_nvp_name2value_simple(nvp_reset_modes, CMD_ARGV[0]);
                if ((n->name == NULL) || (n->value == RESET_UNKNOWN))
                        return ERROR_COMMAND_SYNTAX_ERROR;
                reset_mode = n->value;
@@ -4775,7 +4788,7 @@ void target_handle_event(struct target *target, enum target_event e)
                                           target_name(target),
                                           target_type_name(target),
                                           e,
-                                          Jim_Nvp_value2name_simple(nvp_target_event, e)->name,
+                                          jim_nvp_value2name_simple(nvp_target_event, e)->name,
                                           Jim_GetString(teap->body, NULL));
 
                        /* Override current target by the target an event
@@ -4799,7 +4812,7 @@ void target_handle_event(struct target *target, enum target_event e)
                        if (retval != JIM_OK) {
                                Jim_MakeErrorMessage(teap->interp);
                                LOG_USER("Error executing event %s on target %s:\n%s",
-                                                 Jim_Nvp_value2name_simple(nvp_target_event, e)->name,
+                                                 jim_nvp_value2name_simple(nvp_target_event, e)->name,
                                                  target_name(target),
                                                  Jim_GetString(Jim_GetResult(teap->interp), NULL));
                                /* clean both error code and stacktrace before return */
@@ -4840,7 +4853,7 @@ enum target_cfg_param {
        TCFG_GDB_MAX_CONNECTIONS,
 };
 
-static Jim_Nvp nvp_config_opts[] = {
+static struct jim_nvp nvp_config_opts[] = {
        { .name = "-type",             .value = TCFG_TYPE },
        { .name = "-event",            .value = TCFG_EVENT },
        { .name = "-work-area-virt",   .value = TCFG_WORK_AREA_VIRT },
@@ -4858,9 +4871,9 @@ static Jim_Nvp nvp_config_opts[] = {
        { .name = NULL, .value = -1 }
 };
 
-static int target_configure(Jim_GetOptInfo *goi, struct target *target)
+static int target_configure(struct jim_getopt_info *goi, struct target *target)
 {
-       Jim_Nvp *n;
+       struct jim_nvp *n;
        Jim_Obj *o;
        jim_wide w;
        int e;
@@ -4868,7 +4881,7 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
        /* parse config or cget options ... */
        while (goi->argc > 0) {
                Jim_SetEmptyResult(goi->interp);
-               /* Jim_GetOpt_Debug(goi); */
+               /* jim_getopt_debug(goi); */
 
                if (target->type->target_jim_configure) {
                        /* target defines a configure function */
@@ -4884,9 +4897,9 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
                        }
                        /* otherwise we 'continue' below */
                }
-               e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n);
+               e = jim_getopt_nvp(goi, nvp_config_opts, &n);
                if (e != JIM_OK) {
-                       Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0);
+                       jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
                        return e;
                }
                switch (n->value) {
@@ -4915,9 +4928,9 @@ no_params:
                                return JIM_ERR;
                        }
 
-                       e = Jim_GetOpt_Nvp(goi, nvp_target_event, &n);
+                       e = jim_getopt_nvp(goi, nvp_target_event, &n);
                        if (e != JIM_OK) {
-                               Jim_GetOpt_NvpUnknown(goi, nvp_target_event, 1);
+                               jim_getopt_nvp_unknown(goi, nvp_target_event, 1);
                                return e;
                        }
 
@@ -4958,7 +4971,7 @@ no_params:
                                        }
                                        teap->event = n->value;
                                        teap->interp = goi->interp;
-                                       Jim_GetOpt_Obj(goi, &o);
+                                       jim_getopt_obj(goi, &o);
                                        if (teap->body)
                                                Jim_DecrRefCount(teap->interp, teap->body);
                                        teap->body  = Jim_DuplicateObj(goi->interp, o);
@@ -4994,7 +5007,7 @@ no_params:
                case TCFG_WORK_AREA_VIRT:
                        if (goi->isconfigure) {
                                target_free_all_working_areas(target);
-                               e = Jim_GetOpt_Wide(goi, &w);
+                               e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
                                target->working_area_virt = w;
@@ -5010,7 +5023,7 @@ no_params:
                case TCFG_WORK_AREA_PHYS:
                        if (goi->isconfigure) {
                                target_free_all_working_areas(target);
-                               e = Jim_GetOpt_Wide(goi, &w);
+                               e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
                                target->working_area_phys = w;
@@ -5026,7 +5039,7 @@ no_params:
                case TCFG_WORK_AREA_SIZE:
                        if (goi->isconfigure) {
                                target_free_all_working_areas(target);
-                               e = Jim_GetOpt_Wide(goi, &w);
+                               e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
                                target->working_area_size = w;
@@ -5041,7 +5054,7 @@ no_params:
                case TCFG_WORK_AREA_BACKUP:
                        if (goi->isconfigure) {
                                target_free_all_working_areas(target);
-                               e = Jim_GetOpt_Wide(goi, &w);
+                               e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
                                /* make this exactly 1 or 0 */
@@ -5057,9 +5070,9 @@ no_params:
 
                case TCFG_ENDIAN:
                        if (goi->isconfigure) {
-                               e = Jim_GetOpt_Nvp(goi, nvp_target_endian, &n);
+                               e = jim_getopt_nvp(goi, nvp_target_endian, &n);
                                if (e != JIM_OK) {
-                                       Jim_GetOpt_NvpUnknown(goi, nvp_target_endian, 1);
+                                       jim_getopt_nvp_unknown(goi, nvp_target_endian, 1);
                                        return e;
                                }
                                target->endianness = n->value;
@@ -5067,10 +5080,10 @@ no_params:
                                if (goi->argc != 0)
                                        goto no_params;
                        }
-                       n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness);
+                       n = jim_nvp_value2name_simple(nvp_target_endian, target->endianness);
                        if (n->name == NULL) {
                                target->endianness = TARGET_LITTLE_ENDIAN;
-                               n = Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness);
+                               n = jim_nvp_value2name_simple(nvp_target_endian, target->endianness);
                        }
                        Jim_SetResultString(goi->interp, n->name, -1);
                        /* loop for more */
@@ -5078,7 +5091,7 @@ no_params:
 
                case TCFG_COREID:
                        if (goi->isconfigure) {
-                               e = Jim_GetOpt_Wide(goi, &w);
+                               e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
                                target->coreid = (int32_t)w;
@@ -5102,7 +5115,7 @@ no_params:
                                }
 
                                target_free_all_working_areas(target);
-                               e = Jim_GetOpt_Obj(goi, &o_t);
+                               e = jim_getopt_obj(goi, &o_t);
                                if (e != JIM_OK)
                                        return e;
                                tap = jtag_tap_by_jim_obj(goi->interp, o_t);
@@ -5119,7 +5132,7 @@ no_params:
                        break;
                case TCFG_DBGBASE:
                        if (goi->isconfigure) {
-                               e = Jim_GetOpt_Wide(goi, &w);
+                               e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
                                target->dbgbase = (uint32_t)w;
@@ -5156,7 +5169,7 @@ no_params:
                                }
 
                                const char *s;
-                               e = Jim_GetOpt_String(goi, &s, NULL);
+                               e = jim_getopt_string(goi, &s, NULL);
                                if (e != JIM_OK)
                                        return e;
                                free(target->gdb_port_override);
@@ -5165,7 +5178,7 @@ no_params:
                                if (goi->argc != 0)
                                        goto no_params;
                        }
-                       Jim_SetResultString(goi->interp, target->gdb_port_override ? : "undefined", -1);
+                       Jim_SetResultString(goi->interp, target->gdb_port_override ? target->gdb_port_override : "undefined", -1);
                        /* loop for more */
                        break;
 
@@ -5177,7 +5190,7 @@ no_params:
                                        return JIM_ERR;
                                }
 
-                               e = Jim_GetOpt_Wide(goi, &w);
+                               e = jim_getopt_wide(goi, &w);
                                if (e != JIM_OK)
                                        return e;
                                target->gdb_max_connections = (w < 0) ? CONNECTION_LIMIT_UNLIMITED : (int)w;
@@ -5198,9 +5211,9 @@ no_params:
 static int jim_target_configure(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
 {
        struct command *c = jim_to_command(interp);
-       Jim_GetOptInfo goi;
+       struct jim_getopt_info goi;
 
-       Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1);
+       jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
        goi.isconfigure = !strcmp(c->name, "configure");
        if (goi.argc < 1) {
                Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
@@ -5241,8 +5254,8 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv
 {
        bool allow_defer = false;
 
-       Jim_GetOptInfo goi;
-       Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1);
+       struct jim_getopt_info goi;
+       jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
        if (goi.argc > 1) {
                const char *cmd_name = Jim_GetString(argv[0], NULL);
                Jim_SetResultFormatted(goi.interp,
@@ -5253,7 +5266,7 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv
            strcmp(Jim_GetString(argv[1], NULL), "allow-defer") == 0) {
                /* consume it */
                Jim_Obj *obj;
-               int e = Jim_GetOpt_Obj(&goi, &obj);
+               int e = jim_getopt_obj(&goi, &obj);
                if (e != JIM_OK)
                        return e;
                allow_defer = true;
@@ -5337,8 +5350,8 @@ static int jim_target_poll(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
 static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
-       Jim_GetOptInfo goi;
-       Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1);
+       struct jim_getopt_info goi;
+       jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
 
        if (goi.argc != 2) {
                Jim_WrongNumArgs(interp, 0, argv,
@@ -5346,15 +5359,15 @@ static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                return JIM_ERR;
        }
 
-       Jim_Nvp *n;
-       int e = Jim_GetOpt_Nvp(&goi, nvp_assert, &n);
+       struct jim_nvp *n;
+       int e = jim_getopt_nvp(&goi, nvp_assert, &n);
        if (e != JIM_OK) {
-               Jim_GetOpt_NvpUnknown(&goi, nvp_assert, 1);
+               jim_getopt_nvp_unknown(&goi, nvp_assert, 1);
                return e;
        }
        /* the halt or not param */
        jim_wide a;
-       e = Jim_GetOpt_Wide(&goi, &a);
+       e = jim_getopt_wide(&goi, &a);
        if (e != JIM_OK)
                return e;
 
@@ -5375,7 +5388,7 @@ static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                target_reset_examined(target);
 
        /* determine if we should halt or not. */
-       target->reset_halt = !!a;
+       target->reset_halt = (a != 0);
        /* When this happens - all workareas are invalid. */
        target_free_all_working_areas_restore(target, 0);
 
@@ -5404,8 +5417,8 @@ static int jim_target_halt(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
 static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
-       Jim_GetOptInfo goi;
-       Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1);
+       struct jim_getopt_info goi;
+       jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
 
        /* params:  <name>  statename timeoutmsecs */
        if (goi.argc != 2) {
@@ -5415,14 +5428,14 @@ static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *a
                return JIM_ERR;
        }
 
-       Jim_Nvp *n;
-       int e = Jim_GetOpt_Nvp(&goi, nvp_target_state, &n);
+       struct jim_nvp *n;
+       int e = jim_getopt_nvp(&goi, nvp_target_state, &n);
        if (e != JIM_OK) {
-               Jim_GetOpt_NvpUnknown(&goi, nvp_target_state, 1);
+               jim_getopt_nvp_unknown(&goi, nvp_target_state, 1);
                return e;
        }
        jim_wide a;
-       e = Jim_GetOpt_Wide(&goi, &a);
+       e = jim_getopt_wide(&goi, &a);
        if (e != JIM_OK)
                return e;
        struct command_context *cmd_ctx = current_command_context(interp);
@@ -5457,7 +5470,7 @@ COMMAND_HANDLER(handle_target_event_list)
        command_print(CMD, "------------------------- | "
                        "----------------------------------------");
        while (teap) {
-               Jim_Nvp *opt = Jim_Nvp_value2name_simple(nvp_target_event, teap->event);
+               struct jim_nvp *opt = jim_nvp_value2name_simple(nvp_target_event, teap->event);
                command_print(CMD, "%-25s | %s",
                                opt->name, Jim_GetString(teap->body, NULL));
                teap = teap->next;
@@ -5479,17 +5492,17 @@ static int jim_target_current_state(Jim_Interp *interp, int argc, Jim_Obj *const
 }
 static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
-       Jim_GetOptInfo goi;
-       Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1);
+       struct jim_getopt_info goi;
+       jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
        if (goi.argc != 1) {
                const char *cmd_name = Jim_GetString(argv[0], NULL);
                Jim_SetResultFormatted(goi.interp, "%s <eventname>", cmd_name);
                return JIM_ERR;
        }
-       Jim_Nvp *n;
-       int e = Jim_GetOpt_Nvp(&goi, nvp_target_event, &n);
+       struct jim_nvp *n;
+       int e = jim_getopt_nvp(&goi, nvp_target_event, &n);
        if (e != JIM_OK) {
-               Jim_GetOpt_NvpUnknown(&goi, nvp_target_event, 1);
+               jim_getopt_nvp_unknown(&goi, nvp_target_event, 1);
                return e;
        }
        struct command_context *cmd_ctx = current_command_context(interp);
@@ -5658,7 +5671,7 @@ static const struct command_registration target_instance_command_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 
-static int target_create(Jim_GetOptInfo *goi)
+static int target_create(struct jim_getopt_info *goi)
 {
        Jim_Obj *new_cmd;
        Jim_Cmd *cmd;
@@ -5677,7 +5690,7 @@ static int target_create(Jim_GetOptInfo *goi)
        }
 
        /* COMMAND */
-       Jim_GetOpt_Obj(goi, &new_cmd);
+       jim_getopt_obj(goi, &new_cmd);
        /* does this command exist? */
        cmd = Jim_GetCommand(goi->interp, new_cmd, JIM_ERRMSG);
        if (cmd) {
@@ -5687,7 +5700,7 @@ static int target_create(Jim_GetOptInfo *goi)
        }
 
        /* TYPE */
-       e = Jim_GetOpt_String(goi, &cp, NULL);
+       e = jim_getopt_string(goi, &cp, NULL);
        if (e != JIM_OK)
                return e;
        struct transport *tr = get_current_transport();
@@ -5991,8 +6004,8 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
 static int jim_target_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
-       Jim_GetOptInfo goi;
-       Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1);
+       struct jim_getopt_info goi;
+       jim_getopt_setup(&goi, interp, argc - 1, argv + 1);
        if (goi.argc < 3) {
                Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv,
                        "<name> <target_type> [<target_options> ...]");
@@ -6677,15 +6690,15 @@ static const struct command_registration target_exec_command_handlers[] = {
                .handler = handle_target_reset_nag,
                .mode = COMMAND_ANY,
                .help = "Nag after each reset about options that could have been "
-                               "enabled to improve performance. ",
+                               "enabled to improve performance.",
                .usage = "['enable'|'disable']",
        },
        {
                .name = "ps",
                .handler = handle_ps_command,
                .mode = COMMAND_EXEC,
-               .help = "list all tasks ",
-               .usage = " ",
+               .help = "list all tasks",
+               .usage = "",
        },
        {
                .name = "test_mem_access",

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)