OpenOCD
arc.c File Reference
Include dependency graph for arc.c:

Go to the source code of this file.

Functions

int arc_add_auxreg_actionpoint (struct target *target, uint32_t auxreg_addr, uint32_t transaction)
 
static int arc_add_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
static int arc_add_watchpoint (struct target *target, struct watchpoint *watchpoint)
 
static int arc_arch_state (struct target *target)
 
static int arc_assert_reset (struct target *target)
 
static int arc_build_bcr_reg_cache (struct target *target)
 
static int arc_build_reg_cache (struct target *target)
 
int arc_cache_flush (struct target *target)
 
int arc_cache_invalidate (struct target *target)
 
static int arc_config_step (struct target *target, int enable_step)
 
static int arc_configure (struct target *target)
 
static int arc_configure_actionpoint (struct target *target, uint32_t ap_num, uint32_t match_value, uint32_t control_tt, uint32_t control_at)
 
static int arc_configure_dccm (struct target *target)
 
static int arc_configure_iccm (struct target *target)
 
static int arc_dcache_flush (struct target *target)
 
static int arc_dcache_invalidate (struct target *target)
 
static int arc_deassert_reset (struct target *target)
 
static int arc_debug_entry (struct target *target)
 
static void arc_deinit_target (struct target *target)
 
static int arc_enable_breakpoints (struct target *target)
 
static int arc_enable_interrupts (struct target *target, int enable)
 
static int arc_enable_watchpoints (struct target *target)
 
static int arc_examine (struct target *target)
 
static int arc_examine_debug_reason (struct target *target)
 
static int arc_exit_debug (struct target *target)
 
static void arc_free_reg_cache (struct reg_cache *cache)
 
static int arc_get_gdb_reg_list (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 
static int arc_get_register (struct reg *reg)
 
static int arc_get_register_value (struct target *target, const char *reg_name, uint32_t *value_ptr)
 
static int arc_halt (struct target *target)
 
static int arc_hit_watchpoint (struct target *target, struct watchpoint **hit_watchpoint)
 
static int arc_icache_invalidate (struct target *target)
 
static int arc_init_arch_info (struct target *target, struct arc_common *arc, struct jtag_tap *tap)
 
static int arc_init_reg (struct target *target, struct reg *reg, struct arc_reg_desc *reg_desc, unsigned long number)
 
static int arc_init_target (struct command_context *cmd_ctx, struct target *target)
 
static int arc_l2cache_flush (struct target *target)
 
static int arc_l2cache_invalidate (struct target *target)
 
static int arc_poll (struct target *target)
 
static int arc_read_instruction_u32 (struct target *target, uint32_t address, uint32_t *value)
 Read 32-bit instruction from memory. More...
 
int arc_reg_add (struct target *target, struct arc_reg_desc *arc_reg, const char *const type_name, const size_t type_name_len)
 
void arc_reg_data_type_add (struct target *target, struct arc_reg_data_type *data_type)
 
struct regarc_reg_get_by_name (struct reg_cache *first, const char *name, bool search_all)
 Private implementation of register_get_by_name() for ARC that doesn't skip not [yet] existing registers. More...
 
int arc_reg_get_field (struct target *target, const char *reg_name, const char *field_name, uint32_t *value_ptr)
 
int arc_remove_auxreg_actionpoint (struct target *target, uint32_t auxreg_addr)
 
static int arc_remove_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
static int arc_remove_watchpoint (struct target *target, struct watchpoint *watchpoint)
 
static void arc_reset_actionpoints (struct target *target)
 
static int arc_reset_caches_states (struct target *target)
 Reset internal states of caches. More...
 
static int arc_restore_context (struct target *target)
 See arc_save_context() for reason why we want to dump all regs at once. More...
 
static int arc_resume (struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
 
static int arc_save_context (struct target *target)
 Read registers that are used in GDB g-packet. More...
 
int arc_set_actionpoints_num (struct target *target, uint32_t ap_num)
 
static int arc_set_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
static int arc_set_register (struct reg *reg, uint8_t *buf)
 
static int arc_set_register_value (struct target *target, const char *reg_name, uint32_t value)
 
static int arc_set_watchpoint (struct target *target, struct watchpoint *watchpoint)
 
static int arc_single_step_core (struct target *target)
 
static int arc_step (struct target *target, int current, target_addr_t address, int handle_breakpoints)
 
static int arc_target_create (struct target *target, Jim_Interp *interp)
 
static int arc_unset_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
static int arc_unset_watchpoint (struct target *target, struct watchpoint *watchpoint)
 
static int arc_write_instruction_u32 (struct target *target, uint32_t address, uint32_t instr)
 Write 4-byte instruction to memory. More...
 
static int get_current_actionpoint (struct target *target, struct arc_actionpoint **actionpoint)
 Finds an actionpoint that triggered last actionpoint event, as specified by DEBUG.ASR. More...
 

Variables

static const struct reg_arch_type arc_reg_type
 
struct target_type arcv2_target
 
static const char *const reg_group_general = "general"
 
static const char *const reg_group_other = ""
 

Function Documentation

◆ arc_add_auxreg_actionpoint()

◆ arc_add_breakpoint()

static int arc_add_breakpoint ( struct target target,
struct breakpoint breakpoint 
)
static

◆ arc_add_watchpoint()

static int arc_add_watchpoint ( struct target target,
struct watchpoint watchpoint 
)
static

◆ arc_arch_state()

static int arc_arch_state ( struct target target)
static

◆ arc_assert_reset()

◆ arc_build_bcr_reg_cache()

◆ arc_build_reg_cache()

◆ arc_cache_flush()

int arc_cache_flush ( struct target target)

◆ arc_cache_invalidate()

int arc_cache_invalidate ( struct target target)

◆ arc_config_step()

static int arc_config_step ( struct target target,
int  enable_step 
)
static

◆ arc_configure()

static int arc_configure ( struct target target)
static

◆ arc_configure_actionpoint()

static int arc_configure_actionpoint ( struct target target,
uint32_t  ap_num,
uint32_t  match_value,
uint32_t  control_tt,
uint32_t  control_at 
)
static

◆ arc_configure_dccm()

static int arc_configure_dccm ( struct target target)
static

◆ arc_configure_iccm()

static int arc_configure_iccm ( struct target target)
static

◆ arc_dcache_flush()

◆ arc_dcache_invalidate()

◆ arc_deassert_reset()

static int arc_deassert_reset ( struct target target)
static

Definition at line 1139 of file arc.c.

References ERROR_OK, jtag_add_reset(), LOG_DEBUG, and target_state_name().

◆ arc_debug_entry()

static int arc_debug_entry ( struct target target)
static

◆ arc_deinit_target()

◆ arc_enable_breakpoints()

static int arc_enable_breakpoints ( struct target target)
static

◆ arc_enable_interrupts()

static int arc_enable_interrupts ( struct target target,
int  enable 
)
static

◆ arc_enable_watchpoints()

static int arc_enable_watchpoints ( struct target target)
static

◆ arc_examine()

◆ arc_examine_debug_reason()

◆ arc_exit_debug()

◆ arc_free_reg_cache()

static void arc_free_reg_cache ( struct reg_cache cache)
static

Definition at line 1379 of file arc.c.

References reg_cache::reg_list.

Referenced by arc_deinit_target().

◆ arc_get_gdb_reg_list()

static int arc_get_gdb_reg_list ( struct target target,
struct reg **  reg_list[],
int *  reg_list_size,
enum target_register_class  reg_class 
)
static

◆ arc_get_register()

◆ arc_get_register_value()

static int arc_get_register_value ( struct target target,
const char *  reg_name,
uint32_t *  value_ptr 
)
static

◆ arc_halt()

◆ arc_hit_watchpoint()

◆ arc_icache_invalidate()

◆ arc_init_arch_info()

◆ arc_init_reg()

◆ arc_init_target()

static int arc_init_target ( struct command_context cmd_ctx,
struct target target 
)
static

◆ arc_l2cache_flush()

◆ arc_l2cache_invalidate()

◆ arc_poll()

◆ arc_read_instruction_u32()

static int arc_read_instruction_u32 ( struct target target,
uint32_t  address,
uint32_t *  value 
)
static

Read 32-bit instruction from memory.

It is like target_read_u32, however in case of little endian ARC instructions are in middle endian format, so different type of conversion should be done.

Definition at line 1477 of file arc.c.

References arc_me_to_h_u32(), be_to_h_u32(), CHECK_RETVAL, target::endianness, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, TARGET_LITTLE_ENDIAN, target_read_buffer(), and target_was_examined().

Referenced by arc_set_breakpoint(), and arc_unset_breakpoint().

◆ arc_reg_add()

◆ arc_reg_data_type_add()

void arc_reg_data_type_add ( struct target target,
struct arc_reg_data_type data_type 
)

◆ arc_reg_get_by_name()

struct reg* arc_reg_get_by_name ( struct reg_cache first,
const char *  name,
bool  search_all 
)

Private implementation of register_get_by_name() for ARC that doesn't skip not [yet] existing registers.

Used in many places for iteration through registers and even for marking required registers as existing.

Definition at line 77 of file arc.c.

References name, reg::name, reg_cache::next, NULL, reg_cache::num_regs, and reg_cache::reg_list.

Referenced by arc_configure(), arc_get_register_value(), arc_reg_get_field(), arc_set_register_value(), and COMMAND_HANDLER().

◆ arc_reg_get_field()

◆ arc_remove_auxreg_actionpoint()

◆ arc_remove_breakpoint()

static int arc_remove_breakpoint ( struct target target,
struct breakpoint breakpoint 
)
static

◆ arc_remove_watchpoint()

static int arc_remove_watchpoint ( struct target target,
struct watchpoint watchpoint 
)
static

◆ arc_reset_actionpoints()

◆ arc_reset_caches_states()

static int arc_reset_caches_states ( struct target target)
static

Reset internal states of caches.

Must be called when entering debugging.

Parameters
targetTarget for which to reset caches states.

Definition at line 103 of file arc.c.

References arc_common::dcache_flushed, arc_common::dcache_invalidated, ERROR_OK, arc_common::icache_invalidated, arc_common::l2cache_flushed, arc_common::l2cache_invalidated, LOG_DEBUG, and target_to_arc().

Referenced by arc_debug_entry(), arc_init_arch_info(), and arc_resume().

◆ arc_restore_context()

static int arc_restore_context ( struct target target)
static

See arc_save_context() for reason why we want to dump all regs at once.

This however means that if there are dependencies between registers they will not be observable until target will be resumed.

Definition at line 1170 of file arc.c.

References arc_jtag_write_aux_reg(), arc_jtag_write_core_reg(), reg::arch_info, arc_reg_desc::arch_num, arc_common::core_and_aux_cache, reg::dirty, ERROR_FAIL, ERROR_OK, reg::exist, arc_common::jtag_info, LOG_DEBUG, LOG_ERROR, arc_common::num_aux_regs, arc_common::num_core_regs, reg_cache::reg_list, target_buffer_get_u32(), target_to_arc(), reg::valid, and reg::value.

Referenced by arc_resume(), and arc_step().

◆ arc_resume()

◆ arc_save_context()

static int arc_save_context ( struct target target)
static

Read registers that are used in GDB g-packet.

We don't read them one-by-one, but do that in one batch operation to improve speed. Calls to JTAG layer are expensive so it is better to make one big call that reads all necessary registers, instead of many calls, one for one register.

Definition at line 842 of file arc.c.

References arc_jtag_read_aux_reg(), arc_jtag_read_core_reg(), reg::arch_info, arc_reg_desc::arch_num, arc_common::core_and_aux_cache, reg::dirty, ERROR_FAIL, ERROR_OK, reg::exist, arc_common::jtag_info, arc_common::last_general_reg, LOG_DEBUG, LOG_ERROR, MIN, arc_reg_desc::name, arc_common::num_aux_regs, arc_common::num_core_regs, arc_common::num_regs, reg_cache::reg_list, target_buffer_set_u32(), target_to_arc(), reg::valid, and reg::value.

Referenced by arc_debug_entry().

◆ arc_set_actionpoints_num()

int arc_set_actionpoints_num ( struct target target,
uint32_t  ap_num 
)

◆ arc_set_breakpoint()

◆ arc_set_register()

static int arc_set_register ( struct reg reg,
uint8_t *  buf 
)
static

Definition at line 266 of file arc.c.

◆ arc_set_register_value()

static int arc_set_register_value ( struct target target,
const char *  reg_name,
uint32_t  value 
)
static

◆ arc_set_watchpoint()

◆ arc_single_step_core()

static int arc_single_step_core ( struct target target)
static

◆ arc_step()

◆ arc_target_create()

static int arc_target_create ( struct target target,
Jim_Interp *  interp 
)
static

Definition at line 1429 of file arc.c.

References arc_init_arch_info(), CHECK_RETVAL, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, and target::tap.

◆ arc_unset_breakpoint()

◆ arc_unset_watchpoint()

◆ arc_write_instruction_u32()

static int arc_write_instruction_u32 ( struct target target,
uint32_t  address,
uint32_t  instr 
)
static

Write 4-byte instruction to memory.

This is like target_write_u32, however in case of little endian ARC instructions are in middle endian format, not little endian, so different type of conversion should be done. Middle endian: instruction "aabbccdd", stored as "bbaaddcc"

Definition at line 1450 of file arc.c.

References arc_h_u32_to_me(), CHECK_RETVAL, target::endianness, ERROR_FAIL, ERROR_OK, h_u32_to_be(), LOG_DEBUG, LOG_ERROR, TARGET_LITTLE_ENDIAN, target_was_examined(), and target_write_buffer().

Referenced by arc_set_breakpoint().

◆ get_current_actionpoint()

static int get_current_actionpoint ( struct target target,
struct arc_actionpoint **  actionpoint 
)
static

Finds an actionpoint that triggered last actionpoint event, as specified by DEBUG.ASR.

Parameters
target
actionpointPointer to be set to last active actionpoint. Pointer will be set to NULL if DEBUG.AH is 0.

Definition at line 957 of file arc.c.

References arc_common::actionpoints_list, arc_common::actionpoints_num, arc_reg_get_field(), CHECK_RETVAL, ERROR_OK, NULL, and target_to_arc().

Referenced by arc_examine_debug_reason(), and arc_hit_watchpoint().

Variable Documentation

◆ arc_reg_type

const struct reg_arch_type arc_reg_type
static
Initial value:
= {
}
static int arc_set_register(struct reg *reg, uint8_t *buf)
Definition: arc.c:266
static int arc_get_register(struct reg *reg)
Definition: arc.c:219

Definition at line 266 of file arc.c.

Referenced by arc_init_reg().

◆ arcv2_target

struct target_type arcv2_target

Definition at line 2314 of file arc.c.

◆ reg_group_general

const char* const reg_group_general = "general"
static

Definition at line 299 of file arc.c.

Referenced by arc_init_reg().

◆ reg_group_other

const char* const reg_group_other = ""
static

Definition at line 300 of file arc.c.

Referenced by arc_init_reg().