flash/stm32h7x: remove IWDG1_SW separate variable 44/4744/3
authorChristopher Head <chead@zaber.com>
Tue, 30 Oct 2018 21:37:22 +0000 (14:37 -0700)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 14 Mar 2019 14:18:30 +0000 (14:18 +0000)
Bit 4 in OPTSR is IWDG1_SW (the code originally called it IWDG1_HW, but
the reference manual refers to it as IWDG1_SW). This is broken out into
a separate variable, independent_watchdog_selection, in stm32x_options.
However, this is not necessary: bit 4 is included in the user_options
field, which includes all of bits 2 through 7, and
independent_watchdog_selection is not referenced anywhere else. Delete
the field and just rely on user_options to transport that bit, along
with all the other bits it contains, between stm32x_read_options and
stm32x_write_options.

Change-Id: I4da63df9272cf091267b956c412b95671ea1d3c9
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4744
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/flash/nor/stm32h7x.c

index ad76af4adff1ae0e08b959675bbcbbecf57e9227..d21e9fa5e558888f43259b3577e09c91e539c25e 100644 (file)
@@ -78,9 +78,6 @@
 #define OPT_LOCK       (1 << 0)
 #define OPT_START      (1 << 1)
 
-/* FLASH_OPTCUR bit definitions (reading) */
-#define IWDG1_HW       (1 << 4)
-
 /* register unlock keys */
 #define KEY1           0x45670123
 #define KEY2           0xCDEF89AB
@@ -109,7 +106,6 @@ struct stm32x_options {
        uint8_t user_options;
        uint8_t user2_options;
        uint8_t user3_options;
-       uint8_t independent_watchdog_selection;
 };
 
 struct stm32h7x_part_info {
@@ -327,11 +323,6 @@ static int stm32x_read_options(struct flash_bank *bank)
        stm32x_info->option_bytes.user2_options = (optiondata >> 16) & 0xff;
        stm32x_info->option_bytes.user3_options = (optiondata >> 24) & 0x83;
 
-       if (optiondata & IWDG1_HW)
-               stm32x_info->option_bytes.independent_watchdog_selection = 1;
-       else
-               stm32x_info->option_bytes.independent_watchdog_selection = 0;
-
        if (stm32x_info->option_bytes.RDP != 0xAA)
                LOG_INFO("Device Security Bit Set");
 
@@ -368,11 +359,6 @@ static int stm32x_write_options(struct flash_bank *bank)
        optiondata |= (stm32x_info->option_bytes.user2_options & 0xff) << 16;
        optiondata |= (stm32x_info->option_bytes.user3_options & 0x83) << 24;
 
-       if (stm32x_info->option_bytes.independent_watchdog_selection)
-               optiondata |= IWDG1_HW;
-       else
-               optiondata &= ~IWDG1_HW;
-
        /* program options */
        retval = target_write_u32(target, FLASH_REG_BASE_B0 + FLASH_OPTPRG, optiondata);
                if (retval != ERROR_OK)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)