This is an automated email from Gerrit.

Kalle Raiskila (krais...@iki.fi) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/4630

-- gerrit

commit 6bec8311b988eeeac8c821b4f8128eb0abd0fbac
Author: Kalle Raiskila <krais...@iki.fi>
Date:   Fri Aug 3 19:21:33 2018 +0300

    flash/nor/stm32f1: take option bytes into use.
    
    When option bytes are updated, they need to be explicitly
    taken into use by either a power cycle or writing a
    flash control register. This patch does the latter.
    Should fix issue 189 in the bug tracker.
    
    Change-Id: I9d76df88dd22bb0cea884cd90dbe2c4f871a793b
    Signed-off-by: Kalle Raiskila <krais...@iki.fi>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index faada9a..821b8c8 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -78,6 +78,7 @@
 #define FLASH_STRT             (1 << 6)
 #define FLASH_LOCK             (1 << 7)
 #define FLASH_OPTWRE   (1 << 9)
+#define FLASH_OBL_LAUNCH (1 << 13)
 
 /* FLASH_SR register bits */
 
@@ -345,6 +346,11 @@ static int stm32x_write_options(struct flash_bank *bank)
                return retval;
        }
 
+       /* Take the new option byte settings into use. Causes a system reset */
+       retval = target_write_u32(target, STM32_FLASH_CR_B0, FLASH_OBL_LAUNCH);
+       if (retval != ERROR_OK)
+               return retval;
+
        retval = target_write_u32(target, STM32_FLASH_CR_B0, FLASH_LOCK);
        if (retval != ERROR_OK)
                return retval;
@@ -1320,10 +1326,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
                return ERROR_OK;
        }
 
-       command_print(CMD_CTX, "stm32x unlocked.\n"
-                       "INFO: a reset or power cycle is required "
-                       "for the new settings to take effect.");
-
+       command_print(CMD_CTX, "stm32x unlocked");
        return ERROR_OK;
 }
 
@@ -1478,9 +1481,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
                return ERROR_OK;
        }
 
-       command_print(CMD_CTX, "stm32x write options complete.\n"
-                               "INFO: a reset or power cycle is required "
-                               "for the new settings to take effect.");
+       command_print(CMD_CTX, "stm32x write options complete.");
 
        return ERROR_OK;
 }

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to