On 2010-11-09 10:16, Øyvind Harboe wrote:
Error: 793 186992 stm32x.c:582 stm32x_write_block(): error executing
stm32x flash write algorithm
Error: 794 186993 core.c:98 flash_driver_write(): error writing to
flash at address 0x08000000 at offset 0x00000000 (-302)
On 2010-11-14 16:13, Øyvind Harboe wrote:
> Perhaps sharper error messages?
I've checked the code in stm32x.c, and there are error messages for both
cases that are possible with this code:
if (buf_get_u32(reg_params[3].value, 0, 32) & FLASH_PGERR)
{
LOG_ERROR("flash memory not erased before writing");
/* Clear but report errors */
target_write_u32(target, STM32_FLASH_SR, FLASH_PGERR);
retval = ERROR_FAIL;
break;
}
if (buf_get_u32(reg_params[3].value, 0, 32) & FLASH_WRPRTERR)
{
LOG_ERROR("flash memory write protected");
/* Clear but report errors */
target_write_u32(target, STM32_FLASH_SR,
FLASH_WRPRTERR);
retval = ERROR_FAIL;
break;
}
Your code (I'm judging by the error message) failed somewhere in here:
if ((retval = target_run_algorithm(target, 0, NULL, 4,
reg_params,
stm32x_info->write_algorithm->address,
0,
10000, &armv7m_info)) != ERROR_OK)
{
LOG_ERROR("error executing stm32x flash write
algorithm");
break;
}
So I'd suspect target_run_algorithm() internals - in this case that would be
/** Runs a Thumb algorithm in the target. */
int armv7m_run_algorithm(struct target *target,
int num_mem_params, struct mem_param *mem_params,
int num_reg_params, struct reg_param *reg_params,
uint32_t entry_point, uint32_t exit_point,
int timeout_ms, void *arch_info)
Judging by error number (-302) we need to go deeper, as run_algorithm()
does not produce this one directly
#define ERROR_TARGET_TIMEOUT (-302)
Such error can be produced by
/* run to exit point. return error if exit point was not reached. */
static int armv7m_run_and_wait(struct target *target, uint32_t entry_point, int
timeout_ms, uint32_t exit_point, struct armv7m_common *armv7m)
And I suspect here:
retval = target_wait_state(target, TARGET_HALTED, timeout_ms);
/* If the target fails to halt due to the breakpoint, force a halt */
if (retval != ERROR_OK || target->state != TARGET_HALTED)
{
if ((retval = target_halt(target)) != ERROR_OK)
return retval;
if ((retval = target_wait_state(target, TARGET_HALTED, 500)) !=
ERROR_OK)
{
return retval;
}
return ERROR_TARGET_TIMEOUT;
}
As I cannot reproduce, if this one is repeating at your side, maybe try
injecting some messages around there to see whether that's the exact
point of problems?
4\/3!!
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development