Skip to content

Commit

Permalink
Cleanump initial introdution
Browse files Browse the repository at this point in the history
Currently there are only 32-bit ARC processors, lets
get rid of "arc32" prefixes.

Changes:
	* Rename arc32* -> arc*;
	* Remove redundant arc32_address_t typedeff
	* Update dates in copyright
	* Remove bunch of commented code

Signed-off-by: Evgeniy Didin <didin@synopsys.com>
  • Loading branch information
EvgeniiDidin committed Jun 5, 2019
1 parent d062051 commit 5e3834e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 75 deletions.
6 changes: 3 additions & 3 deletions src/target/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ noinst_LTLIBRARIES += %D%/libtarget.la
$(STM8_SRC) \
$(INTEL_IA32_SRC) \
$(ESIRISC_SRC) \
$(ARC32_SRC) \
$(ARC_SRC) \
%D%/avrt.c \
%D%/dsp563xx.c \
%D%/dsp563xx_once.c \
Expand Down Expand Up @@ -147,8 +147,8 @@ ESIRISC_SRC = \
%D%/esirisc_jtag.c \
%D%/esirisc_trace.c

ARC32_SRC = \
%D%/arc32.c \
ARC_SRC = \
%D%/arc.c \
%D%/arc_v2.c

%C%_libtarget_la_SOURCES += \
Expand Down
73 changes: 26 additions & 47 deletions src/target/arc32.c → src/target/arc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2013-2015 Synopsys, Inc. *
* Copyright (C) 2013-2015,2019 Synopsys, Inc. *
* Frank Dols <frank.dols@synopsys.com> *
* Mischa Jonker <mischa.jonker@synopsys.com> *
* Anton Kolesov <anton.kolesov@synopsys.com> *
Expand All @@ -26,69 +26,48 @@
#include "config.h"
#endif

#include "arc32.h"
#include "arc.h"

/* Initialize arc32_common structure, which passes to openocd target instance */
int arc32_init_arch_info(struct target *target, struct arc32_common *arc32,
/* Initialize arc_common structure, which passes to openocd target instance */
int arc_init_arch_info(struct target *target, struct arc_common *arc,
struct jtag_tap *tap)
{
arc32->common_magic = ARC32_COMMON_MAGIC;
target->arch_info = arc32;
arc->common_magic = ARC_COMMON_MAGIC;
target->arch_info = arc;

arc32->fast_data_area = NULL;
arc->fast_data_area = NULL;

/* TODO: jtag functionality */

/* TODO: uncomment this as jtag functionality as introduced */
/*
arc32->jtag_info.tap = tap;
arc32->jtag_info.scann_size = 4;
arc32->jtag_info.always_check_status_rd = false;
arc32->jtag_info.check_status_fl = false;
arc32->jtag_info.wait_until_write_finished = false;
*/
/* has breakpoint/watchpoint unit been scanned */
arc32->bp_scanned = 0;
arc->bp_scanned = 0;

/* We don't know how many actionpoints are in the core yet. */
arc32->actionpoints_num_avail = 0;
arc32->actionpoints_num = 0;
arc32->actionpoints_list = NULL;
arc->actionpoints_num_avail = 0;
arc->actionpoints_num = 0;
arc->actionpoints_list = NULL;

/* Flush D$ by default. It is safe to assume that D$ is present,
* because if it isn't, there will be no error, just a slight
* performance penalty from unnecessary JTAG operations. */
arc32->has_dcache = true;
arc->has_dcache = true;

/* TODO: uncomment this as this function be introduced */
//arc32_reset_caches_states(target);
//arc_reset_caches_states(target);

/* TODO: uncomment this as register functionality as introduced */
/* Add standard GDB data types */
/*
INIT_LIST_HEAD(&arc32->reg_data_types);
struct arc_reg_data_type *std_types = calloc(ARRAY_SIZE(standard_gdb_types),
sizeof(struct arc_reg_data_type));
if (!std_types) {
LOG_ERROR("Cannot allocate memory");
return ERROR_FAIL;
}
for (unsigned int i = 0; i < ARRAY_SIZE(standard_gdb_types); i++) {
std_types[i].data_type.type = standard_gdb_types[i].type;
std_types[i].data_type.id = standard_gdb_types[i].id;
arc32_add_reg_data_type(target, &(std_types[i]));
}
*/
/* TODO: Add standard GDB data types */

/* Fields related to target descriptions */
INIT_LIST_HEAD(&arc32->core_reg_descriptions);
INIT_LIST_HEAD(&arc32->aux_reg_descriptions);
INIT_LIST_HEAD(&arc32->bcr_reg_descriptions);
arc32->num_regs = 0;
arc32->num_core_regs = 0;
arc32->num_aux_regs = 0;
arc32->num_bcr_regs = 0;
arc32->last_general_reg = ULONG_MAX;
arc32->pc_index_in_cache = ULONG_MAX;
arc32->debug_index_in_cache = ULONG_MAX;
INIT_LIST_HEAD(&arc->core_reg_descriptions);
INIT_LIST_HEAD(&arc->aux_reg_descriptions);
INIT_LIST_HEAD(&arc->bcr_reg_descriptions);
arc->num_regs = 0;
arc->num_core_regs = 0;
arc->num_aux_regs = 0;
arc->num_bcr_regs = 0;
arc->last_general_reg = ULONG_MAX;
arc->pc_index_in_cache = ULONG_MAX;
arc->debug_index_in_cache = ULONG_MAX;

return ERROR_OK;
}
31 changes: 14 additions & 17 deletions src/target/arc32.h → src/target/arc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2013-2015 Synopsys, Inc. *
* Copyright (C) 2013-2015,2019 Synopsys, Inc. *
* Frank Dols <frank.dols@synopsys.com> *
* Mischa Jonker <mischa.jonker@synopsys.com> *
* Anton Kolesov <anton.kolesov@synopsys.com> *
Expand All @@ -21,8 +21,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/

#ifndef ARC32_H
#define ARC32_H
#ifndef ARC_H
#define ARC_H

#include <helper/time_support.h>
#include <jtag/jtag.h>
Expand All @@ -35,12 +35,9 @@
#include "target_request.h"
#include "target_type.h"

#define ARC32_COMMON_MAGIC 0xB32EB324 /* just a unique number */
#define ARC_COMMON_MAGIC 0xB32EB324 /* just a unique number */

typedef uint32_t arc32_address_t;


struct arc32_common {
struct arc_common {
uint32_t common_magic;
void *arch_info;

Expand All @@ -57,7 +54,7 @@ struct arc32_common {
/* Actionpoints */
unsigned int actionpoints_num;
unsigned int actionpoints_num_avail;
struct arc32_comparator *actionpoints_list;
struct arc_comparator *actionpoints_list;

/* Cache control */
bool has_dcache;
Expand All @@ -79,12 +76,12 @@ struct arc32_common {
bool on_step_reset_debug_ra;

/* CCM memory regions (optional). */
arc32_address_t iccm0_start;
arc32_address_t iccm0_end;
arc32_address_t iccm1_start;
arc32_address_t iccm1_end;
arc32_address_t dccm_start;
arc32_address_t dccm_end;
uint32_t iccm0_start;
uint32_t iccm0_end;
uint32_t iccm1_start;
uint32_t iccm1_end;
uint32_t dccm_start;
uint32_t dccm_end;

/* Register descriptions */
struct list_head reg_data_types;
Expand Down Expand Up @@ -125,7 +122,7 @@ struct arc32_common {
} while (0)

/* ----- Exported functions ------------------------------------------------ */
int arc32_init_arch_info(struct target *target, struct arc32_common *arc32,
int arc_init_arch_info(struct target *target, struct arc_common *arc,
struct jtag_tap *tap);

#endif /* ARC32_H */
#endif /* ARC_H */
15 changes: 7 additions & 8 deletions src/target/arc_v2.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2013-2015 Synopsys, Inc. *
* Copyright (C) 2013-2015,2019 Synopsys, Inc. *
* Frank Dols <frank.dols@synopsys.com> *
* Mischa Jonker <mischa.jonker@synopsys.com> *
* Anton Kolesov <anton.kolesov@synopsys.com> *
Expand All @@ -25,22 +25,22 @@
#include "config.h"
#endif

#include "arc32.h"
#include "arc.h"

static int arc_v2_init_target(struct command_context *cmd_ctx, struct target *target)
{
/* Will be uncommented in register introdution patch. */
//CHECK_RETVAL(arc32_build_reg_cache(target));
//CHECK_RETVAL(arc32_build_bcr_reg_cache(target));
//CHECK_RETVAL(arc_build_reg_cache(target));
//CHECK_RETVAL(arc_build_bcr_reg_cache(target));
return ERROR_OK;
}

static int arc_v2_target_create(struct target *target, Jim_Interp *interp)
{
struct arc32_common *arc32 = calloc(1, sizeof(struct arc32_common));
struct arc_common *arc = calloc(1, sizeof(struct arc_common));

LOG_DEBUG("Entering");
CHECK_RETVAL(arc32_init_arch_info(target, arc32, target->tap));
CHECK_RETVAL(arc_init_arch_info(target, arc, target->tap));

return ERROR_OK;
}
Expand Down Expand Up @@ -87,8 +87,7 @@ struct target_type arcv2_target = {
.start_algorithm = NULL,
.wait_algorithm = NULL,

//.commands = arc_monitor_command_handlers, /* see: arc_mntr.c|.h */
.commands = NULL,
.commands = NULL,
.target_create = arc_v2_target_create,
.init_target = arc_v2_init_target,
.examine = NULL,
Expand Down

0 comments on commit 5e3834e

Please sign in to comment.