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>
This commit is contained in:
parent
ccc5c1642b
commit
fbea7d5d38
|
@ -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"
|
||||
|
||||
/**************************************************************************************************
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue