-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later
/***************************************************************************
* Xtensa Chip-level Target Support for OpenOCD *
#include <target/arm_adi_v5.h>
#include <rtos/rtos.h>
#include "xtensa_chip.h"
+#include "xtensa_fileio.h"
int xtensa_chip_init_arch_info(struct target *target, void *arch_info,
struct xtensa_debug_module_config *dm_cfg)
int xtensa_chip_target_init(struct command_context *cmd_ctx, struct target *target)
{
- return xtensa_target_init(cmd_ctx, target);
+ int ret = xtensa_target_init(cmd_ctx, target);
+ if (ret != ERROR_OK)
+ return ret;
+ return xtensa_fileio_init(target);
}
int xtensa_chip_arch_state(struct target *target)
if (old_state != TARGET_HALTED && target->state == TARGET_HALTED) {
/*Call any event callbacks that are applicable */
- if (old_state == TARGET_DEBUG_RUNNING)
+ if (old_state == TARGET_DEBUG_RUNNING) {
target_call_event_callbacks(target, TARGET_EVENT_DEBUG_HALTED);
- else
+ } else {
+ xtensa_fileio_detect_proc(target);
target_call_event_callbacks(target, TARGET_EVENT_HALTED);
+ }
}
return ret;
return ERROR_OK;
}
-void xtensa_chip_target_deinit(struct target *target)
+static void xtensa_chip_target_deinit(struct target *target)
{
struct xtensa *xtensa = target_to_xtensa(target);
xtensa_target_deinit(target);
return retval;
}
-int xtensa_chip_jim_configure(struct target *target, struct jim_getopt_info *goi)
+static int xtensa_chip_jim_configure(struct target *target, struct jim_getopt_info *goi)
{
- static bool dap_configured;
- int ret = adiv5_jim_configure(target, goi);
- if (ret == JIM_OK) {
- LOG_DEBUG("xtensa '-dap' target option found");
- dap_configured = true;
- }
- if (!dap_configured) {
- LOG_DEBUG("xtensa '-dap' target option not yet found, assuming JTAG...");
- target->has_dap = false;
- }
- return ret;
+ return adiv5_jim_configure_ext(target, goi, NULL, ADI_CONFIGURE_DAP_OPTIONAL);
}
/** Methods for generic example of Xtensa-based chip-level targets. */
.get_gdb_reg_list = xtensa_get_gdb_reg_list,
+ .run_algorithm = xtensa_run_algorithm,
+ .start_algorithm = xtensa_start_algorithm,
+ .wait_algorithm = xtensa_wait_algorithm,
+
.add_breakpoint = xtensa_breakpoint_add,
.remove_breakpoint = xtensa_breakpoint_remove,
.gdb_query_custom = xtensa_gdb_query_custom,
.commands = xtensa_command_handlers,
+
+ .get_gdb_fileio_info = xtensa_get_gdb_fileio_info,
+ .gdb_fileio_end = xtensa_gdb_fileio_end,
};