extern struct target_type dsp5680xx_target;
extern struct target_type testee_target;
extern struct target_type avr32_ap7k_target;
-extern struct target_type stm32_stlink_target;
+extern struct target_type hla_target;
static struct target_type *target_types[] = {
&arm7tdmi_target,
&dsp5680xx_target,
&testee_target,
&avr32_ap7k_target,
- &stm32_stlink_target,
+ &hla_target,
NULL,
};
uint32_t entry_point, uint32_t exit_point, void *arch_info)
{
int retval;
+ int timeout = 0;
/* Set up working area. First word is write pointer, second word is read pointer,
* rest is fifo data area. */
* less than buffer size / flash speed. This is very unlikely to
* run when using high latency connections such as USB. */
alive_sleep(10);
+
+ /* to stop an infinite loop on some targets check and increment a timeout
+ * this issue was observed on a stellaris using the new ICDI interface */
+ if (timeout++ >= 500) {
+ LOG_ERROR("timeout waiting for algorithm, a target reset is recommended");
+ return ERROR_FLASH_OPERATION_FAILED;
+ }
continue;
}
+ /* reset our timeout */
+ timeout = 0;
+
/* Limit to the amount of data we actually want to write */
if (thisrun_bytes > count * block_size)
thisrun_bytes = count * block_size;
new_wa->size = area->size - size;
new_wa->address = area->address + size;
new_wa->backup = NULL;
+ new_wa->user = NULL;
new_wa->free = true;
area->next = new_wa;
new_wa->size = target->working_area_size & ~3UL; /* 4-byte align */
new_wa->address = target->working_area;
new_wa->backup = NULL;
+ new_wa->user = NULL;
new_wa->free = true;
}
c->free = false;
*area = c;
+ /* user pointer */
+ c->user = area;
+
print_wa_layout(target);
return ERROR_OK;
LOG_DEBUG("freed %"PRIu32" bytes of working area at address 0x%08"PRIx32,
area->size, area->address);
+ /* mark user pointer invalid */
+ /* TODO: Is this really safe? It points to some previous caller's memory.
+ * How could we know that the area pointer is still in that place and not
+ * some other vital data? What's the purpose of this, anyway? */
+ *area->user = NULL;
+ area->user = NULL;
+
target_merge_working_areas(target);
print_wa_layout(target);
if (restore)
target_restore_working_area(target, c);
c->free = true;
+ *c->user = NULL; /* Same as above */
+ c->user = NULL;
}
c = c->next;
}
backoff_times *= 2;
backoff_times++;
}
- LOG_USER("Polling target failed, GDB will be halted. Polling again in %dms",
+ LOG_USER("Polling target %s failed, GDB will be halted. Polling again in %dms",
+ target_name(target),
backoff_times * polling_interval);
/* Tell GDB to halt the debugger. This allows the user to
}
/* Since we succeeded, we reset backoff count */
if (backoff_times > 0)
- LOG_USER("Polling succeeded again");
+ LOG_USER("Polling target %s succeeded again", target_name(target));
backoff_times = 0;
}
}
/* found */
break;
}
+
+ /* check for deprecated name */
+ if (target_types[x]->deprecated_name) {
+ if (0 == strcmp(cp, target_types[x]->deprecated_name)) {
+ /* found */
+ LOG_WARNING("target name is deprecated use: \'%s\'", target_types[x]->name);
+ break;
+ }
+ }
}
if (target_types[x] == NULL) {
Jim_SetResultFormatted(goi->interp, "Unknown target type %s, try one of ", cp);