#define _DEBUG_INSTRUCTION_EXECUTION_
#endif
-#if 0
-#define FNC_INFO LOG_DEBUG("-")
-#else
-#define FNC_INFO
-#endif
-
-#if 1
-#define FNC_INFO_NOTIMPLEMENTED do { LOG_DEBUG("NOT IMPLEMENTED"); /*exit(-1);*/ } while (0)
-#else
-#define FNC_INFO_NOTIMPLEMENTED
-#endif
-
static bool arm11_config_memwrite_burst = true;
static bool arm11_config_memwrite_error_fatal = true;
static uint32_t arm11_vcr = 0;
*/
static int arm11_check_init(struct arm11_common *arm11, uint32_t *dscr)
{
- FNC_INFO;
-
uint32_t dscr_local_tmp_copy;
if (!dscr)
static int arm11_on_enter_debug_state(struct arm11_common *arm11)
{
int retval;
- FNC_INFO;
for (size_t i = 0; i < ARRAY_SIZE(arm11->reg_values); i++)
{
*/
static int arm11_leave_debug_state(struct arm11_common *arm11)
{
- FNC_INFO;
int retval;
retval = arm11_run_instr_data_prepare(arm11);
/* poll current target status */
static int arm11_poll(struct target *target)
{
- FNC_INFO;
int retval;
struct arm11_common *arm11 = target_to_arm11(target);
uint32_t dscr;
static int arm11_target_request_data(struct target *target,
uint32_t size, uint8_t *buffer)
{
- FNC_INFO_NOTIMPLEMENTED;
+ LOG_WARNING("Not implemented: %s", __func__);
- return ERROR_OK;
+ return ERROR_FAIL;
}
/* target execution control */
static int arm11_halt(struct target *target)
{
- FNC_INFO;
struct arm11_common *arm11 = target_to_arm11(target);
LOG_DEBUG("target->state: %s",
static int arm11_resume(struct target *target, int current,
uint32_t address, int handle_breakpoints, int debug_execution)
{
- FNC_INFO;
-
// LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d",
// current, address, handle_breakpoints, debug_execution);
// struct arm11_common * arm11 = (struct arm11_common *)sim->user_data;
/* FIX!!!! we should implement thumb for arm11 */
- LOG_ERROR("Not implemetned!");
+ LOG_ERROR("Not implemented: %s", __func__);
}
static int arm11_step(struct target *target, int current,
uint32_t address, int handle_breakpoints)
{
- FNC_INFO;
-
LOG_DEBUG("target->state: %s",
target_state_name(target));
static int arm11_assert_reset(struct target *target)
{
- FNC_INFO;
int retval;
struct arm11_common *arm11 = target_to_arm11(target);
static int arm11_soft_reset_halt(struct target *target)
{
- FNC_INFO_NOTIMPLEMENTED;
+ LOG_WARNING("Not implemented: %s", __func__);
- return ERROR_OK;
+ return ERROR_FAIL;
}
/* target register access for gdb */
static int arm11_get_gdb_reg_list(struct target *target,
struct reg **reg_list[], int *reg_list_size)
{
- FNC_INFO;
struct arm11_common *arm11 = target_to_arm11(target);
*reg_list_size = ARM11_GDB_REGISTER_COUNT;
/** \todo TODO: check if buffer cast to uint32_t* and uint16_t* might cause alignment problems */
int retval;
- FNC_INFO;
-
if (target->state != TARGET_HALTED)
{
LOG_WARNING("target was not halted");
bool arm11_config_memrw_no_increment)
{
int retval;
- FNC_INFO;
if (target->state != TARGET_HALTED)
{
static int arm11_bulk_write_memory(struct target *target,
uint32_t address, uint32_t count, uint8_t *buffer)
{
- FNC_INFO;
-
if (target->state != TARGET_HALTED)
{
LOG_WARNING("target was not halted");
static int arm11_add_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
- FNC_INFO;
struct arm11_common *arm11 = target_to_arm11(target);
#if 0
static int arm11_remove_breakpoint(struct target *target,
struct breakpoint *breakpoint)
{
- FNC_INFO;
struct arm11_common *arm11 = target_to_arm11(target);
arm11->free_brps++;
static int arm11_add_watchpoint(struct target *target,
struct watchpoint *watchpoint)
{
- FNC_INFO_NOTIMPLEMENTED;
+ LOG_WARNING("Not implemented: %s", __func__);
- return ERROR_OK;
+ return ERROR_FAIL;
}
static int arm11_remove_watchpoint(struct target *target,
struct watchpoint *watchpoint)
{
- FNC_INFO_NOTIMPLEMENTED;
+ LOG_WARNING("Not implemented: %s", __func__);
- return ERROR_OK;
+ return ERROR_FAIL;
}
// HACKHACKHACK - FIXME mode/state
static int arm11_target_create(struct target *target, Jim_Interp *interp)
{
- FNC_INFO;
-
- NEW(struct arm11_common, arm11, 1);
-
- arm11->target = target;
+ struct arm11_common *arm11;
if (target->tap == NULL)
return ERROR_FAIL;
return ERROR_COMMAND_SYNTAX_ERROR;
}
+ arm11 = calloc(1, sizeof *arm11);
+ if (!arm11)
+ return ERROR_FAIL;
+
armv4_5_init_arch_info(target, &arm11->arm);
+ arm11->target = target;
+
arm11->jtag_info.tap = target->tap;
arm11->jtag_info.scann_size = 5;
arm11->jtag_info.scann_instr = ARM11_SCAN_N;
{
int retval;
char *type;
- FNC_INFO;
struct arm11_common *arm11 = target_to_arm11(target);
/* check IDCODE */
/** Load a register that is marked !valid in the register cache */
static int arm11_get_reg(struct reg *reg)
{
- FNC_INFO;
-
struct target * target = ((struct arm11_reg_state *)reg->arch_info)->target;
if (target->state != TARGET_HALTED)
/** Change a value in the register cache */
static int arm11_set_reg(struct reg *reg, uint8_t *buf)
{
- FNC_INFO;
-
struct target *target = ((struct arm11_reg_state *)reg->arch_info)->target;
struct arm11_common *arm11 = target_to_arm11(target);
// const struct arm11_reg_defs *arm11_reg_info = arm11_reg_defs + ((struct arm11_reg_state *)reg->arch_info)->def_index;
static int arm11_build_reg_cache(struct target *target)
{
struct arm11_common *arm11 = target_to_arm11(target);
-
- NEW(struct reg_cache, cache, 1);
- NEW(struct reg, reg_list, ARM11_REGCACHE_COUNT);
- NEW(struct arm11_reg_state, arm11_reg_states, ARM11_REGCACHE_COUNT);
+ struct reg_cache *cache;
+ struct reg *reg_list;
+ struct arm11_reg_state *arm11_reg_states;
+
+ cache = calloc(1, sizeof *cache);
+ reg_list = calloc(ARM11_REGCACHE_COUNT, sizeof *reg_list);
+ arm11_reg_states = calloc(ARM11_REGCACHE_COUNT,
+ sizeof *arm11_reg_states);
+ if (!cache || !reg_list || !arm11_reg_states) {
+ free(cache);
+ free(reg_list);
+ free(arm11_reg_states);
+ return ERROR_FAIL;
+ }
arm11->reg_list = reg_list;
static int arm11_register_commands(struct command_context *cmd_ctx)
{
- FNC_INFO;
-
struct command *top_cmd, *mw_cmd;
armv4_5_register_commands(cmd_ctx);