target/espressif: add semihosting support
[fw/openocd] / src / target / espressif / esp_xtensa.c
index fcd42eac30b91b50808f6c0e5a13314e7cc1257d..6a1b72ec48f70ba305063508d892b0611726c701 100644 (file)
 #include <stdbool.h>
 #include <stdint.h>
 #include <target/smp.h>
-#include "esp_xtensa.h"
 #include <target/register.h>
+#include "esp_xtensa.h"
+#include "esp_semihosting.h"
 
 int esp_xtensa_init_arch_info(struct target *target,
        struct esp_xtensa_common *esp_xtensa,
-       struct xtensa_debug_module_config *dm_cfg)
+       struct xtensa_debug_module_config *dm_cfg,
+       const struct esp_semihost_ops *semihost_ops)
 {
-       return xtensa_init_arch_info(target, &esp_xtensa->xtensa, dm_cfg);
+       int ret = xtensa_init_arch_info(target, &esp_xtensa->xtensa, dm_cfg);
+       if (ret != ERROR_OK)
+               return ret;
+       esp_xtensa->semihost.ops = (struct esp_semihost_ops *)semihost_ops;
+       return ERROR_OK;
 }
 
 int esp_xtensa_target_init(struct command_context *cmd_ctx, struct target *target)