aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2024-04-09 01:29:34 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2024-05-26 09:57:51 +0000
commitfbea7d5d38d0dcbdd71cb574da9bd12c78b568cf (patch)
tree5abcd2a0804e27e19d754853f82abf5c1b835f02 /src
parentccc5c1642b32ab79d5ab315e4b308e53392a77c4 (diff)
downloadriscv-openocd-fbea7d5d38d0dcbdd71cb574da9bd12c78b568cf.zip
riscv-openocd-fbea7d5d38d0dcbdd71cb574da9bd12c78b568cf.tar.gz
riscv-openocd-fbea7d5d38d0dcbdd71cb574da9bd12c78b568cf.tar.bz2
openocd: drop include of target_type.h
Few files include target_type.h even if it is not needed. Drop the include. Other files access directly to target type's name instead of using the proper API target_type_name(). Use the API and drop the include. Change-Id: I86c0e0bbad51db93500c0efa27b7d6f1a67a02c2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8260 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/psoc6.c1
-rw-r--r--src/rtos/FreeRTOS.c3
-rw-r--r--src/rtos/ThreadX.c3
-rw-r--r--src/rtos/chibios.c7
-rw-r--r--src/rtos/chromium-ec.c7
-rw-r--r--src/rtos/eCos.c7
-rw-r--r--src/rtos/embKernel.c5
-rw-r--r--src/rtos/hwthread.c1
-rw-r--r--src/rtos/mqx.c7
-rw-r--r--src/rtos/nuttx.c1
-rw-r--r--src/rtos/riot.c3
-rw-r--r--src/rtos/rtkernel.c3
-rw-r--r--src/rtos/uCOS-III.c5
-rw-r--r--src/rtos/zephyr.c1
-rw-r--r--src/target/arm_tpiu_swo.c9
-rw-r--r--src/target/target.c4
16 files changed, 26 insertions, 41 deletions
diff --git a/src/flash/nor/psoc6.c b/src/flash/nor/psoc6.c
index b7ba102..859b3e9 100644
--- a/src/flash/nor/psoc6.c
+++ b/src/flash/nor/psoc6.c
@@ -18,7 +18,6 @@
#include "target/target.h"
#include "target/cortex_m.h"
#include "target/breakpoints.h"
-#include "target/target_type.h"
#include "target/algorithm.h"
/**************************************************************************************************
diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c
index e8df030..20977e0 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/FreeRTOS.c
@@ -12,7 +12,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "helper/types.h"
@@ -533,7 +532,7 @@ static bool freertos_detect_rtos(struct target *target)
static int freertos_create(struct target *target)
{
for (unsigned int i = 0; i < ARRAY_SIZE(freertos_params_list); i++)
- if (strcmp(freertos_params_list[i].target_name, target->type->name) == 0) {
+ if (strcmp(freertos_params_list[i].target_name, target_type_name(target)) == 0) {
target->rtos->rtos_specific_params = (void *)&freertos_params_list[i];
return 0;
}
diff --git a/src/rtos/ThreadX.c b/src/rtos/ThreadX.c
index 5bdd007..61c4926 100644
--- a/src/rtos/ThreadX.c
+++ b/src/rtos/ThreadX.c
@@ -12,7 +12,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "helper/types.h"
@@ -608,7 +607,7 @@ static int threadx_get_thread_detail(struct rtos *rtos,
static int threadx_create(struct target *target)
{
for (unsigned int i = 0; i < ARRAY_SIZE(threadx_params_list); i++)
- if (strcmp(threadx_params_list[i].target_name, target->type->name) == 0) {
+ if (strcmp(threadx_params_list[i].target_name, target_type_name(target)) == 0) {
target->rtos->rtos_specific_params = (void *)&threadx_params_list[i];
target->rtos->current_thread = 0;
target->rtos->thread_details = NULL;
diff --git a/src/rtos/chibios.c b/src/rtos/chibios.c
index 2037827..c1e4e84 100644
--- a/src/rtos/chibios.c
+++ b/src/rtos/chibios.c
@@ -15,7 +15,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "target/armv7m.h"
#include "target/cortex_m.h"
#include "rtos.h"
@@ -470,7 +469,7 @@ static int chibios_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
/* Update stacking if it can only be determined from runtime information */
if (!param->stacking_info &&
(chibios_update_stacking(rtos) != ERROR_OK)) {
- LOG_ERROR("Failed to determine exact stacking for the target type %s", rtos->target->type->name);
+ LOG_ERROR("Failed to determine exact stacking for the target type %s", target_type_name(rtos->target));
return -1;
}
@@ -518,12 +517,12 @@ static bool chibios_detect_rtos(struct target *target)
static int chibios_create(struct target *target)
{
for (unsigned int i = 0; i < ARRAY_SIZE(chibios_params_list); i++)
- if (strcmp(chibios_params_list[i].target_name, target->type->name) == 0) {
+ if (strcmp(chibios_params_list[i].target_name, target_type_name(target)) == 0) {
target->rtos->rtos_specific_params = (void *)&chibios_params_list[i];
return 0;
}
LOG_WARNING("Could not find target \"%s\" in ChibiOS compatibility "
- "list", target->type->name);
+ "list", target_type_name(target));
return -1;
}
diff --git a/src/rtos/chromium-ec.c b/src/rtos/chromium-ec.c
index a95969e..dbfe3b3 100644
--- a/src/rtos/chromium-ec.c
+++ b/src/rtos/chromium-ec.c
@@ -14,7 +14,6 @@
#include <helper/bits.h>
#include <rtos/rtos.h>
#include <target/target.h>
-#include <target/target_type.h>
#include "rtos_standard_stackings.h"
@@ -120,7 +119,7 @@ static int chromium_ec_create(struct target *target)
size_t t;
for (t = 0; t < ARRAY_SIZE(chromium_ec_params_list); t++)
- if (!strcmp(chromium_ec_params_list[t].target_name, target->type->name)) {
+ if (!strcmp(chromium_ec_params_list[t].target_name, target_type_name(target))) {
params = malloc(sizeof(*params));
if (!params) {
LOG_ERROR("Chromium-EC: out of memory");
@@ -133,11 +132,11 @@ static int chromium_ec_create(struct target *target)
target->rtos->thread_details = NULL;
target->rtos->thread_count = 0;
- LOG_INFO("Chromium-EC: Using target: %s", target->type->name);
+ LOG_INFO("Chromium-EC: Using target: %s", target_type_name(target));
return ERROR_OK;
}
- LOG_ERROR("Chromium-EC: target not supported: %s", target->type->name);
+ LOG_ERROR("Chromium-EC: target not supported: %s", target_type_name(target));
return ERROR_FAIL;
}
diff --git a/src/rtos/eCos.c b/src/rtos/eCos.c
index 10ed128..7048b00 100644
--- a/src/rtos/eCos.c
+++ b/src/rtos/eCos.c
@@ -10,7 +10,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "target/armv7m.h"
#include "rtos.h"
#include "helper/log.h"
@@ -1137,7 +1136,7 @@ static int ecos_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[
ARRAY_SIZE(ecos_symbol_list), sizeof(struct symbol_table_elem));
/* If the target reference was passed into this function we could limit
- * the symbols we need to lookup to the target->type->name based
+ * the symbols we need to lookup to the target_type_name(target) based
* range. For the moment we need to provide a single vector with all of
* the symbols across all of the supported architectures. */
for (i = 0; i < ARRAY_SIZE(ecos_symbol_list); i++) {
@@ -1189,8 +1188,8 @@ static int ecos_create(struct target *target)
for (unsigned int i = 0; i < ARRAY_SIZE(ecos_params_list); i++) {
const char * const *tnames = ecos_params_list[i].target_names;
while (*tnames) {
- if (strcmp(*tnames, target->type->name) == 0) {
- /* LOG_DEBUG("eCos: matched target \"%s\"", target->type->name); */
+ if (strcmp(*tnames, target_type_name(target)) == 0) {
+ /* LOG_DEBUG("eCos: matched target \"%s\"", target_type_name(target)); */
target->rtos->rtos_specific_params = (void *)&ecos_params_list[i];
ecos_params_list[i].flush_common = true;
ecos_params_list[i].stacking_info = NULL;
diff --git a/src/rtos/embKernel.c b/src/rtos/embKernel.c
index a03b039..7e6de79 100644
--- a/src/rtos/embKernel.c
+++ b/src/rtos/embKernel.c
@@ -12,7 +12,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "helper/types.h"
@@ -110,12 +109,12 @@ static int embkernel_create(struct target *target)
{
size_t i = 0;
while ((i < ARRAY_SIZE(embkernel_params_list)) &&
- (strcmp(embkernel_params_list[i].target_name, target->type->name) != 0))
+ (strcmp(embkernel_params_list[i].target_name, target_type_name(target)) != 0))
i++;
if (i >= ARRAY_SIZE(embkernel_params_list)) {
LOG_WARNING("Could not find target \"%s\" in embKernel compatibility "
- "list", target->type->name);
+ "list", target_type_name(target));
return -1;
}
diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c
index 895f11c..937d01b 100644
--- a/src/rtos/hwthread.c
+++ b/src/rtos/hwthread.c
@@ -7,7 +7,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "target/register.h"
#include <target/smp.h>
#include "rtos.h"
diff --git a/src/rtos/mqx.c b/src/rtos/mqx.c
index d9b6942..b4a1821 100644
--- a/src/rtos/mqx.c
+++ b/src/rtos/mqx.c
@@ -13,7 +13,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "helper/types.h"
@@ -249,13 +248,13 @@ static int mqx_create(
{
/* check target name against supported architectures */
for (unsigned int i = 0; i < ARRAY_SIZE(mqx_params_list); i++) {
- if (strcmp(mqx_params_list[i].target_name, target->type->name) == 0) {
+ if (strcmp(mqx_params_list[i].target_name, target_type_name(target)) == 0) {
target->rtos->rtos_specific_params = (void *)&mqx_params_list[i];
- /* LOG_DEBUG("MQX RTOS - valid architecture: %s", target->type->name); */
+ /* LOG_DEBUG("MQX RTOS - valid architecture: %s", target_type_name(target)); */
return 0;
}
}
- LOG_ERROR("MQX RTOS - could not find target \"%s\" in MQX compatibility list", target->type->name);
+ LOG_ERROR("MQX RTOS - could not find target \"%s\" in MQX compatibility list", target_type_name(target));
return -1;
}
diff --git a/src/rtos/nuttx.c b/src/rtos/nuttx.c
index 0616af0..9100148 100644
--- a/src/rtos/nuttx.c
+++ b/src/rtos/nuttx.c
@@ -12,7 +12,6 @@
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "target/armv7m.h"
#include "target/cortex_m.h"
#include "rtos.h"
diff --git a/src/rtos/riot.c b/src/rtos/riot.c
index be5452e..b90b069 100644
--- a/src/rtos/riot.c
+++ b/src/rtos/riot.c
@@ -12,7 +12,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "helper/types.h"
@@ -391,7 +390,7 @@ static int riot_create(struct target *target)
/* lookup if target is supported by RIOT */
while ((i < RIOT_NUM_PARAMS) &&
- (strcmp(riot_params_list[i].target_name, target->type->name) != 0)) {
+ (strcmp(riot_params_list[i].target_name, target_type_name(target)) != 0)) {
i++;
}
if (i >= RIOT_NUM_PARAMS) {
diff --git a/src/rtos/rtkernel.c b/src/rtos/rtkernel.c
index ba1de25..aebbf3d 100644
--- a/src/rtos/rtkernel.c
+++ b/src/rtos/rtkernel.c
@@ -12,7 +12,6 @@
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "helper/types.h"
@@ -363,7 +362,7 @@ static bool rtkernel_detect_rtos(struct target *target)
static int rtkernel_create(struct target *target)
{
for (size_t i = 0; i < ARRAY_SIZE(rtkernel_params_list); i++) {
- if (strcmp(rtkernel_params_list[i].target_name, target->type->name) == 0) {
+ if (strcmp(rtkernel_params_list[i].target_name, target_type_name(target)) == 0) {
target->rtos->rtos_specific_params = (void *)&rtkernel_params_list[i];
return 0;
}
diff --git a/src/rtos/uCOS-III.c b/src/rtos/uCOS-III.c
index 4d704a4..f19d06e 100644
--- a/src/rtos/uCOS-III.c
+++ b/src/rtos/uCOS-III.c
@@ -14,7 +14,6 @@
#include <helper/types.h>
#include <rtos/rtos.h>
#include <target/target.h>
-#include <target/target_type.h>
#include "rtos_ucos_iii_stackings.h"
@@ -253,7 +252,7 @@ static int ucos_iii_create(struct target *target)
struct ucos_iii_private *params;
for (size_t i = 0; i < ARRAY_SIZE(ucos_iii_params_list); i++)
- if (strcmp(ucos_iii_params_list[i].target_name, target->type->name) == 0) {
+ if (strcmp(ucos_iii_params_list[i].target_name, target_type_name(target)) == 0) {
params = calloc(1, sizeof(*params));
if (!params) {
LOG_ERROR("uCOS-III: out of memory");
@@ -268,7 +267,7 @@ static int ucos_iii_create(struct target *target)
return ERROR_OK;
}
- LOG_ERROR("uCOS-III: target not supported: %s", target->type->name);
+ LOG_ERROR("uCOS-III: target not supported: %s", target_type_name(target));
return ERROR_FAIL;
}
diff --git a/src/rtos/zephyr.c b/src/rtos/zephyr.c
index a4c6090..023db60 100644
--- a/src/rtos/zephyr.c
+++ b/src/rtos/zephyr.c
@@ -20,7 +20,6 @@
#include "rtos.h"
#include "rtos_standard_stackings.h"
#include "target/target.h"
-#include "target/target_type.h"
#include "target/armv7m.h"
#include "target/arc.h"
diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 340d332..b5a4882 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -40,7 +40,6 @@
/* START_DEPRECATED_TPIU */
#include <target/cortex_m.h>
-#include <target/target_type.h>
#define MSG "DEPRECATED \'tpiu config\' command: "
/* END_DEPRECATED_TPIU */
@@ -645,8 +644,8 @@ COMMAND_HANDLER(handle_arm_tpiu_swo_enable)
/* START_DEPRECATED_TPIU */
if (obj->recheck_ap_cur_target) {
- if (strcmp(target->type->name, "cortex_m") &&
- strcmp(target->type->name, "hla_target")) {
+ if (strcmp(target_type_name(target), "cortex_m") &&
+ strcmp(target_type_name(target), "hla_target")) {
LOG_ERROR(MSG "Current target is not a Cortex-M nor a HLA");
return ERROR_FAIL;
}
@@ -1043,8 +1042,8 @@ COMMAND_HANDLER(handle_tpiu_deprecated_config_command)
struct arm_tpiu_swo_object *obj = NULL;
int retval;
- if (strcmp(target->type->name, "cortex_m") &&
- strcmp(target->type->name, "hla_target")) {
+ if (strcmp(target_type_name(target), "cortex_m") &&
+ strcmp(target_type_name(target), "hla_target")) {
LOG_ERROR(MSG "Current target is not a Cortex-M nor a HLA");
return ERROR_FAIL;
}
diff --git a/src/target/target.c b/src/target/target.c
index 5168305..efc1689 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1498,7 +1498,7 @@ static int target_init_one(struct command_context *cmd_ctx,
*/
if (type->mmu) {
if (!type->virt2phys) {
- LOG_ERROR("type '%s' is missing virt2phys", type->name);
+ LOG_ERROR("type '%s' is missing virt2phys", target_name(target));
type->virt2phys = identity_virt2phys;
}
} else {
@@ -1507,7 +1507,7 @@ static int target_init_one(struct command_context *cmd_ctx,
* ensure that virt2phys() is always an identity mapping.
*/
if (type->write_phys_memory || type->read_phys_memory || type->virt2phys)
- LOG_WARNING("type '%s' has bad MMU hooks", type->name);
+ LOG_WARNING("type '%s' has bad MMU hooks", target_name(target));
type->mmu = no_mmu;
type->write_phys_memory = type->write_memory;