From d7e292399066e908ae73bf402db703bbb4215ec6 Mon Sep 17 00:00:00 2001 From: Josh Robson Chase Date: Thu, 15 Nov 2018 17:18:05 -0500 Subject: [PATCH] Debug on stm32f1_flash_erase errors --- src/target/stm32f1.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/target/stm32f1.c b/src/target/stm32f1.c index 6f895f9..e080249 100644 --- a/src/target/stm32f1.c +++ b/src/target/stm32f1.c @@ -202,8 +202,10 @@ static int stm32f1_flash_erase(struct target_flash *f, /* Read FLASH_SR to poll for BSY bit */ 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; + } len -= f->blocksize; addr += f->blocksize; @@ -211,8 +213,10 @@ static int stm32f1_flash_erase(struct target_flash *f, /* Check for error */ 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 0; }