From b2016dc44319ec6a872efbb656d32999f6732382 Mon Sep 17 00:00:00 2001 From: Daniel Goehring Date: Wed, 5 Mar 2025 17:48:01 -0500 Subject: [PATCH] target/target: fix RTOS thread awareness support This prior patch replaces "LOG_xxx()" with "LOG_TARGET_xxx()" to indicate which target the message belongs to. commit 7f2db80ebc16 ("rtos/hwthread: Use LOG_TARGET_xxx()") To support this change for hardware thread awareness, the target command name needs to be established before calling the "target_configure()" routine. Change-Id: I0dc70c23b84e983a2ee694fb5b9d01758f5c84a3 Signed-off-by: Daniel Goehring Reviewed-on: https://review.openocd.org/c/openocd/+/8800 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/target/target.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/target/target.c b/src/target/target.c index 0e41f0d10..ce468cc90 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -5829,6 +5829,16 @@ static int target_create(struct jim_getopt_info *goi) target->gdb_port_override = NULL; target->gdb_max_connections = 1; + cp = Jim_GetString(new_cmd, NULL); + target->cmd_name = strdup(cp); + if (!target->cmd_name) { + LOG_ERROR("Out of memory"); + free(target->trace_info); + free(target->type); + free(target); + return JIM_ERR; + } + /* Do the rest as "configure" options */ goi->is_configure = true; e = target_configure(goi, target); @@ -5865,19 +5875,6 @@ static int target_create(struct jim_getopt_info *goi) target->endianness = TARGET_LITTLE_ENDIAN; } - cp = Jim_GetString(new_cmd, NULL); - target->cmd_name = strdup(cp); - if (!target->cmd_name) { - LOG_ERROR("Out of memory"); - rtos_destroy(target); - free(target->gdb_port_override); - free(target->trace_info); - free(target->type); - free(target->private_config); - free(target); - return JIM_ERR; - } - if (target->type->target_create) { e = (*(target->type->target_create))(target, goi->interp); if (e != ERROR_OK) {