From 7034d0bb94a4c75af07c889fbd9b596f7d793b88 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sun, 15 Apr 2018 18:59:41 +0200 Subject: [PATCH] stm32l4: Option byte loader must be started with flash unlocked! Warn user that device will loose connection. --- src/target/stm32l4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/target/stm32l4.c b/src/target/stm32l4.c index de5dbed..5354b91 100644 --- a/src/target/stm32l4.c +++ b/src/target/stm32l4.c @@ -320,6 +320,7 @@ static const uint8_t i2offset[9] = { static bool stm32l4_option_write(target *t, const uint32_t *values, int len) { + tc_printf(t, "Device will loose connection. Rescan!\n"); stm32l4_flash_unlock(t); target_mem_write32(t, FLASH_OPTKEYR, OPTKEY1); target_mem_write32(t, FLASH_OPTKEYR, OPTKEY2); @@ -332,11 +333,11 @@ static bool stm32l4_option_write(target *t, const uint32_t *values, int len) while (target_mem_read32(t, FLASH_SR) & FLASH_SR_BSY) if(target_check_error(t)) return true; - target_mem_write32(t, FLASH_CR, FLASH_CR_LOCK); target_mem_write32(t, FLASH_CR, FLASH_CR_OBL_LAUNCH); while (target_mem_read32(t, FLASH_CR) & FLASH_CR_OBL_LAUNCH) if(target_check_error(t)) return true; + target_mem_write32(t, FLASH_CR, FLASH_CR_LOCK); return false; }