This is an automated email from Gerrit.

Christopher Head ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/5132

-- gerrit

commit 60676047879deb52babbf15c6361a4f5ca33bc68
Author: Christopher Head <[email protected]>
Date:   Wed Apr 24 16:48:49 2019 -0700

    stm32h7x: preserve reserved option bits
    
    Change-Id: I02ef118364f370f654b7d4c54b6c89020fe64e82
    Signed-off-by: Christopher Head <[email protected]>

diff --git a/src/flash/nor/stm32h7x.c b/src/flash/nor/stm32h7x.c
index 8bcc29c..ca9df29 100644
--- a/src/flash/nor/stm32h7x.c
+++ b/src/flash/nor/stm32h7x.c
@@ -353,8 +353,16 @@ static int stm32x_write_options(struct flash_bank *bank)
        if (retval != ERROR_OK)
                return retval;
 
+       /* read option register */
+       retval = target_read_u32(target, FLASH_REG_BASE_B0 + FLASH_OPTCUR, 
&optiondata);
+       if (retval != ERROR_OK)
+               return retval;
+
+       /* keep reserved bits 1 and 26-28 which are masked out from user values 
*/
+       optiondata &= 0x1c000002;
+
        /* rebuild option data */
-       optiondata = stm32x_info->option_bytes.user_options;
+       optiondata |= stm32x_info->option_bytes.user_options;
        optiondata |= (stm32x_info->option_bytes.RDP << 8);
        optiondata |= (stm32x_info->option_bytes.user2_options & 0xff) << 16;
        optiondata |= (stm32x_info->option_bytes.user3_options & 0xa3) << 24;

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to