The current stm32lx driver will fail if no working area is
provided - fallback to using slow writes if this is the case.
Change-Id: I92b1535fec4aebc855c63ce2c54b10f168f3c07e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1007
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
}
if (halfpages_number) {
- retval = stm32lx_write_half_pages(bank, buffer, offset, 128
- * halfpages_number);
- if (retval != ERROR_OK)
- return ERROR_FAIL;
+ retval = stm32lx_write_half_pages(bank, buffer, offset, 128 * halfpages_number);
+ if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE) {
+ /* attempt slow memory writes */
+ LOG_WARNING("couldn't use block writes, falling back to single memory accesses");
+ halfpages_number = 0;
+ words_remaining = (count / 4);
+ } else {
+ if (retval != ERROR_OK)
+ return ERROR_FAIL;
+ }
}
bytes_written = 128 * halfpages_number;