Debug on stm32f1_flash_erase errors

This commit is contained in:
Josh Robson Chase 2018-11-15 17:18:05 -05:00 committed by Gareth McMullin
parent 6df793dbf0
commit d7e2923990
1 changed files with 6 additions and 2 deletions

View File

@ -202,8 +202,10 @@ static int stm32f1_flash_erase(struct target_flash *f,
/* Read FLASH_SR to poll for BSY bit */ /* Read FLASH_SR to poll for BSY bit */
while (target_mem_read32(t, FLASH_SR) & FLASH_SR_BSY) while (target_mem_read32(t, FLASH_SR) & FLASH_SR_BSY)
if(target_check_error(t)) if(target_check_error(t)) {
DEBUG("stm32f1 flash erase: comm error\n");
return -1; return -1;
}
len -= f->blocksize; len -= f->blocksize;
addr += f->blocksize; addr += f->blocksize;
@ -211,8 +213,10 @@ static int stm32f1_flash_erase(struct target_flash *f,
/* Check for error */ /* Check for error */
sr = target_mem_read32(t, FLASH_SR); sr = target_mem_read32(t, FLASH_SR);
if ((sr & SR_ERROR_MASK) || !(sr & SR_EOP)) if ((sr & SR_ERROR_MASK) || !(sr & SR_EOP)) {
DEBUG("stm32f1 flash erase error 0x%" PRIx32 "\n", sr);
return -1; return -1;
}
return 0; return 0;
} }