From 30631224da59608d93f56bac0f68acd6c8fd32ac Mon Sep 17 00:00:00 2001 From: Jan Matyas Date: Mon, 17 Oct 2022 08:24:05 +0200 Subject: [PATCH] adapter: Improve three adapter-related prints - Do not warn the user about adapter speed not being set if the selected adapter does not support configurable speed. This would be confusing to users. - Minor reword in the "adapter speed is not selected" warning. - Print the adapter name in the "adapter doesn't support configurable speed" log entry - Another minor reword: autoselect --> autoselecting Signed-off-by: Jan Matyas Change-Id: I4c198b547544fd8199921f092153562c5f159134 Reviewed-on: https://review.openocd.org/c/openocd/+/7269 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/jtag/adapter.c | 8 +++++--- src/transport/transport.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c index b7feac575..eb73fcb9a 100644 --- a/src/jtag/adapter.c +++ b/src/jtag/adapter.c @@ -136,9 +136,11 @@ int adapter_init(struct command_context *cmd_ctx) int retval; - if (adapter_config.clock_mode == CLOCK_MODE_UNSELECTED) { + /* If the adapter supports configurable speed but the speed is not configured, + * provide a hint to the user. */ + if (adapter_driver->speed && adapter_config.clock_mode == CLOCK_MODE_UNSELECTED) { LOG_WARNING("An adapter speed is not selected in the init scripts." - " OpenOCD will try to run the adapter at the low speed (%d kHz)", + " OpenOCD will try to run the adapter at very low speed (%d kHz).", DEFAULT_CLOCK_SPEED_KHZ); LOG_WARNING("To remove this warnings and achieve reasonable communication speed with the target," " set \"adapter speed\" or \"jtag_rclk\" in the init scripts."); @@ -153,7 +155,7 @@ int adapter_init(struct command_context *cmd_ctx) adapter_config.adapter_initialized = true; if (!adapter_driver->speed) { - LOG_INFO("This adapter doesn't support configurable speed"); + LOG_INFO("Note: The adapter \"%s\" doesn't support configurable speed", adapter_driver->name); return ERROR_OK; } diff --git a/src/transport/transport.c b/src/transport/transport.c index d72a48baa..c05db3f00 100644 --- a/src/transport/transport.c +++ b/src/transport/transport.c @@ -104,7 +104,7 @@ int allow_transports(struct command_context *ctx, const char * const *vector) /* autoselect if there's no choice ... */ if (!vector[1]) { - LOG_INFO("only one transport option; autoselect '%s'", vector[0]); + LOG_INFO("only one transport option; autoselecting '%s'", vector[0]); return transport_select(ctx, vector[0]); }