Change-Id: Ia600948b99a229ef0490b7f576df62f880db8546
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7500
Tested-by: jenkins
.keep_client_alive_handler = NULL,
};
.keep_client_alive_handler = NULL,
};
-static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_arm_tpiu_swo_enable)
- struct command *c = jim_to_command(interp);
- struct arm_tpiu_swo_object *obj = c->jim_handler_data;
- struct command_context *cmd_ctx = current_command_context(interp);
+ struct arm_tpiu_swo_object *obj = CMD_DATA;
uint32_t value;
int retval;
uint32_t value;
int retval;
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- if (cmd_ctx->mode == COMMAND_CONFIG) {
+ if (CMD_CTX->mode == COMMAND_CONFIG) {
LOG_DEBUG("%s: enable deferred", obj->name);
obj->deferred_enable = true;
LOG_DEBUG("%s: enable deferred", obj->name);
obj->deferred_enable = true;
if (transport_is_hla() && obj->spot.ap_num != 0) {
if (transport_is_hla() && obj->spot.ap_num != 0) {
- LOG_ERROR("Invalid access port 0x%" PRIx64 ". Only AP#0 allowed with hla transport", obj->spot.ap_num);
- return JIM_ERR;
+ command_print(CMD,
+ "Invalid access port 0x%" PRIx64 ". Only AP#0 allowed with hla transport",
+ obj->spot.ap_num);
+ return ERROR_FAIL;
}
if (!obj->traceclkin_freq) {
}
if (!obj->traceclkin_freq) {
- LOG_ERROR("Trace clock-in frequency not set");
- return JIM_ERR;
+ command_print(CMD, "Trace clock-in frequency not set");
+ return ERROR_FAIL;
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
if (!obj->swo_pin_freq)
LOG_DEBUG("SWO pin frequency not set, will be autodetected by the adapter");
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
if (!obj->swo_pin_freq)
LOG_DEBUG("SWO pin frequency not set, will be autodetected by the adapter");
- struct target *target = get_current_target(cmd_ctx);
+ struct target *target = get_current_target(CMD_CTX);
/* START_DEPRECATED_TPIU */
if (obj->recheck_ap_cur_target) {
if (strcmp(target->type->name, "cortex_m") &&
strcmp(target->type->name, "hla_target")) {
LOG_ERROR(MSG "Current target is not a Cortex-M nor a HLA");
/* START_DEPRECATED_TPIU */
if (obj->recheck_ap_cur_target) {
if (strcmp(target->type->name, "cortex_m") &&
strcmp(target->type->name, "hla_target")) {
LOG_ERROR(MSG "Current target is not a Cortex-M nor a HLA");
}
if (!target_was_examined(target)) {
LOG_ERROR(MSG "Current target not examined yet");
}
if (!target_was_examined(target)) {
LOG_ERROR(MSG "Current target not examined yet");
}
struct cortex_m_common *cm = target_to_cm(target);
obj->recheck_ap_cur_target = false;
}
struct cortex_m_common *cm = target_to_cm(target);
obj->recheck_ap_cur_target = false;
if (!obj->ap) {
obj->ap = dap_get_ap(obj->spot.dap, obj->spot.ap_num);
if (!obj->ap) {
if (!obj->ap) {
obj->ap = dap_get_ap(obj->spot.dap, obj->spot.ap_num);
if (!obj->ap) {
- LOG_ERROR("Cannot get AP");
- return JIM_ERR;
+ command_print(CMD, "Cannot get AP");
+ return ERROR_FAIL;
retval = wrap_read_u32(target, obj->ap, obj->spot.base + TPIU_DEVID_OFFSET, &value);
if (retval != ERROR_OK) {
retval = wrap_read_u32(target, obj->ap, obj->spot.base + TPIU_DEVID_OFFSET, &value);
if (retval != ERROR_OK) {
- LOG_ERROR("Unable to read %s", obj->name);
- return JIM_ERR;
+ command_print(CMD, "Unable to read %s", obj->name);
+ return retval;
}
switch (obj->pin_protocol) {
case TPIU_SPPR_PROTOCOL_SYNC:
}
switch (obj->pin_protocol) {
case TPIU_SPPR_PROTOCOL_SYNC:
value = 0;
}
if (!value) {
value = 0;
}
if (!value) {
- struct jim_nvp *p;
- jim_nvp_value2name(interp, nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol, &p);
- LOG_ERROR("%s does not support protocol %s", obj->name, p->name);
- return JIM_ERR;
+ struct jim_nvp *p = jim_nvp_value2name_simple(nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol);
+ command_print(CMD, "%s does not support protocol %s", obj->name, p->name);
+ return ERROR_FAIL;
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_SYNC) {
retval = wrap_read_u32(target, obj->ap, obj->spot.base + TPIU_SSPSR_OFFSET, &value);
if (retval != ERROR_OK) {
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_SYNC) {
retval = wrap_read_u32(target, obj->ap, obj->spot.base + TPIU_SSPSR_OFFSET, &value);
if (retval != ERROR_OK) {
- LOG_ERROR("Cannot read TPIU register SSPSR");
- return JIM_ERR;
+ command_print(CMD, "Cannot read TPIU register SSPSR");
+ return retval;
}
if (!(value & BIT(obj->port_width - 1))) {
}
if (!(value & BIT(obj->port_width - 1))) {
- LOG_ERROR("TPIU does not support port-width of %d bits", obj->port_width);
- return JIM_ERR;
+ command_print(CMD, "TPIU does not support port-width of %d bits", obj->port_width);
+ return ERROR_FAIL;
struct arm_tpiu_swo_priv_connection *priv = malloc(sizeof(*priv));
if (!priv) {
LOG_ERROR("Out of memory");
struct arm_tpiu_swo_priv_connection *priv = malloc(sizeof(*priv));
if (!priv) {
LOG_ERROR("Out of memory");
}
priv->obj = obj;
LOG_INFO("starting trace server for %s on %s", obj->name, &obj->out_filename[1]);
retval = add_service(&arm_tpiu_swo_service_driver, &obj->out_filename[1],
CONNECTION_LIMIT_UNLIMITED, priv);
if (retval != ERROR_OK) {
}
priv->obj = obj;
LOG_INFO("starting trace server for %s on %s", obj->name, &obj->out_filename[1]);
retval = add_service(&arm_tpiu_swo_service_driver, &obj->out_filename[1],
CONNECTION_LIMIT_UNLIMITED, priv);
if (retval != ERROR_OK) {
- LOG_ERROR("Can't configure trace TCP port %s", &obj->out_filename[1]);
- return JIM_ERR;
+ command_print(CMD, "Can't configure trace TCP port %s", &obj->out_filename[1]);
+ return retval;
}
} else if (strcmp(obj->out_filename, "-")) {
obj->file = fopen(obj->out_filename, "ab");
if (!obj->file) {
}
} else if (strcmp(obj->out_filename, "-")) {
obj->file = fopen(obj->out_filename, "ab");
if (!obj->file) {
- LOG_ERROR("Can't open trace destination file \"%s\"", obj->out_filename);
- return JIM_ERR;
+ command_print(CMD, "Can't open trace destination file \"%s\"", obj->out_filename);
+ return ERROR_FAIL;
}
}
retval = adapter_config_trace(true, obj->pin_protocol, obj->port_width,
&swo_pin_freq, obj->traceclkin_freq, &prescaler);
if (retval != ERROR_OK) {
}
}
retval = adapter_config_trace(true, obj->pin_protocol, obj->port_width,
&swo_pin_freq, obj->traceclkin_freq, &prescaler);
if (retval != ERROR_OK) {
- LOG_ERROR("Failed to start adapter's trace");
+ command_print(CMD, "Failed to start adapter's trace");
arm_tpiu_swo_close_output(obj);
arm_tpiu_swo_close_output(obj);
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
if (!swo_pin_freq) {
if (obj->swo_pin_freq)
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
if (!swo_pin_freq) {
if (obj->swo_pin_freq)
- LOG_ERROR("Adapter rejected SWO pin frequency %d Hz", obj->swo_pin_freq);
+ command_print(CMD, "Adapter rejected SWO pin frequency %d Hz", obj->swo_pin_freq);
- LOG_ERROR("Adapter does not support auto-detection of SWO pin frequency nor a default value");
+ command_print(CMD,
+ "Adapter does not support auto-detection of SWO pin frequency nor a default value");
arm_tpiu_swo_close_output(obj);
arm_tpiu_swo_close_output(obj);
}
if (obj->swo_pin_freq != swo_pin_freq)
}
if (obj->swo_pin_freq != swo_pin_freq)
/* END_DEPRECATED_TPIU */
obj->enabled = true;
/* END_DEPRECATED_TPIU */
obj->enabled = true;
+ command_print(CMD, "Error!");
if (obj->en_capture) {
obj->en_capture = false;
if (obj->en_capture) {
obj->en_capture = false;
target_unregister_timer_callback(arm_tpiu_swo_poll_trace, obj);
target_unregister_timer_callback(arm_tpiu_swo_poll_trace, obj);
- retval = adapter_config_trace(false, 0, 0, NULL, 0, NULL);
- if (retval != ERROR_OK) {
- LOG_ERROR("Failed to stop adapter's trace");
- return JIM_ERR;
- }
+ int retval1 = adapter_config_trace(false, 0, 0, NULL, 0, NULL);
+ if (retval1 != ERROR_OK)
+ command_print(CMD, "Failed to stop adapter's trace");
}
COMMAND_HANDLER(handle_arm_tpiu_swo_disable)
}
COMMAND_HANDLER(handle_arm_tpiu_swo_disable)
{
.name = "enable",
.mode = COMMAND_ANY,
{
.name = "enable",
.mode = COMMAND_ANY,
- .jim_handler = jim_arm_tpiu_swo_enable,
+ .handler = handle_arm_tpiu_swo_enable,
.usage = "",
.help = "Enables the TPIU/SWO output",
},
.usage = "",
.help = "Enables the TPIU/SWO output",
},
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)