Use enum for target_register_timer_callback()
[openocd.git] / src / target / hla_target.c
index 9ebf241..60ed7d6 100644 (file)
@@ -346,7 +346,8 @@ static int adapter_init_arch_info(struct target *target,
        armv7m->examine_debug_reason = adapter_examine_debug_reason;
        armv7m->stlink = true;
 
-       target_register_timer_callback(hl_handle_target_request, 1, 1, target);
+       target_register_timer_callback(hl_handle_target_request, 1,
+               TARGET_TIMER_TYPE_PERIODIC, target);
 
        return ERROR_OK;
 }
@@ -366,12 +367,14 @@ static int adapter_target_create(struct target *target,
 {
        LOG_DEBUG("%s", __func__);
        struct adiv5_private_config *pc = target->private_config;
-       struct cortex_m_common *cortex_m = calloc(1, sizeof(struct cortex_m_common));
-       if (!cortex_m)
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
        if (pc != NULL && pc->ap_num > 0) {
                LOG_ERROR("hla_target: invalid parameter -ap-num (> 0)");
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       }
+
+       struct cortex_m_common *cortex_m = calloc(1, sizeof(struct cortex_m_common));
+       if (cortex_m == NULL) {
+               LOG_ERROR("No memory creating target");
                return ERROR_FAIL;
        }
 
@@ -470,6 +473,9 @@ static int adapter_poll(struct target *target)
        if (prev_target_state == state)
                return ERROR_OK;
 
+       if (prev_target_state == TARGET_DEBUG_RUNNING && state == TARGET_RUNNING)
+               return ERROR_OK;
+
        target->state = state;
 
        if (state == TARGET_HALTED) {
@@ -820,6 +826,7 @@ struct target_type hla_target = {
        .resume = adapter_resume,
        .step = adapter_step,
 
+       .get_gdb_arch = arm_get_gdb_arch,
        .get_gdb_reg_list = armv7m_get_gdb_reg_list,
 
        .read_memory = adapter_read_memory,