From dc8924a2bc0110287c1b289002efb52926daccb0 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 5 Oct 2020 01:45:18 -0700 Subject: [PATCH] stm32h7: Don't tc_printf from flash functions (#747) * stm32h7: Don't tc_printf from flash functions Receving an 'O' packet while flashing confuses GDB and then weird stuff happens. * Replace tc_printf with DEBUG_WARN --- src/target/stm32h7.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/target/stm32h7.c b/src/target/stm32h7.c index 07ec635..d71393c 100644 --- a/src/target/stm32h7.c +++ b/src/target/stm32h7.c @@ -250,10 +250,10 @@ static bool stm32h7_flash_unlock(target *t, uint32_t addr) if(target_check_error(t)) return false; } - uint32_t sr = target_mem_read32(t, regbase + FLASH_SR); - if (sr & FLASH_SR_ERROR_MASK) { - tc_printf(t, "Error 0x%08lx", sr & FLASH_SR_ERROR_MASK); - target_mem_write32(t, regbase + FLASH_CCR, sr & FLASH_SR_ERROR_MASK); + uint32_t sr = target_mem_read32(t, regbase + FLASH_SR) & FLASH_SR_ERROR_MASK; + if (sr) { + DEBUG_WARN("%s error 0x%08" PRIx32, __func__, sr); + target_mem_write32(t, regbase + FLASH_CCR, sr); return false; } if (target_mem_read32(t, regbase + FLASH_CR) & FLASH_CR_LOCK) {