stm32: enable flash bank size override 32/1132/3
authorSpencer Oliver <spen@spen-soft.co.uk>
Tue, 5 Feb 2013 16:41:30 +0000 (16:41 +0000)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 25 Feb 2013 11:56:18 +0000 (11:56 +0000)
It has been seen on some stm32 targets that the flash size register that
is probed by the driver may contain an invalid size.

This change enables the user to override the probed value.

Change-Id: I09359e59a96f9133d3d939670957d32a830a944e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1132
Tested-by: jenkins
Reviewed-by: Johan Almquist <johan.almquist@assaabloy.com>
doc/openocd.texi
src/flash/nor/stm32f1x.c
src/flash/nor/stm32f2x.c
src/flash/nor/stm32lx.c

index 9aa7522f05b47c23166039aa015f1fcc986df4c5..a5b0a12a4c7303bd9fea1689ac5c0a3730832881 100644 (file)
@@ -5243,6 +5243,14 @@ the chip identification register, and autoconfigures itself.
 flash bank $_FLASHNAME stm32f1x 0 0 0 0 $_TARGETNAME
 @end example
 
+Note that some devices have been found that have a flash size register that contains
+an invalid value, to workaround this issue you can override the probed value used by
+the flash driver.
+
+@example
+flash bank $_FLASHNAME stm32f1x 0 0x20000 0 0 $_TARGETNAME
+@end example
+
 If you have a target with dual flash banks then define the second bank
 as per the following example.
 @example
@@ -5283,6 +5291,14 @@ include internal flash and use ARM Cortex-M3/M4 cores.
 The driver automatically recognizes a number of these chips using
 the chip identification register, and autoconfigures itself.
 
+Note that some devices have been found that have a flash size register that contains
+an invalid value, to workaround this issue you can override the probed value used by
+the flash driver.
+
+@example
+flash bank $_FLASHNAME stm32f2x 0 0x20000 0 0 $_TARGETNAME
+@end example
+
 Some stm32f2x-specific commands are defined:
 
 @deffn Command {stm32f2x lock} num
@@ -5296,6 +5312,21 @@ The @var{num} parameter is a value shown by @command{flash banks}.
 @end deffn
 @end deffn
 
+@deffn {Flash Driver} stm32lx
+All members of the STM32L microcontroller families from ST Microelectronics
+include internal flash and use ARM Cortex-M3 cores.
+The driver automatically recognizes a number of these chips using
+the chip identification register, and autoconfigures itself.
+
+Note that some devices have been found that have a flash size register that contains
+an invalid value, to workaround this issue you can override the probed value used by
+the flash driver.
+
+@example
+flash bank $_FLASHNAME stm32lx 0 0x20000 0 0 $_TARGETNAME
+@end example
+@end deffn
+
 @deffn {Flash Driver} str7x
 All members of the STR7 microcontroller family from ST Microelectronics
 include internal flash and use ARM7TDMI cores.
index 17df121b7c56802192cdde0695cd01686dfa5617..13affcda71589ba43dbb0b68ab2aba05c14b56ea 100644 (file)
@@ -956,6 +956,13 @@ static int stm32x_probe(struct flash_bank *bank)
                }
        }
 
+       /* if the user sets the size manually then ignore the probed value
+        * this allows us to work around devices that have a invalid flash size register value */
+       if (bank->size) {
+               LOG_INFO("ignoring flash probed value, using configured bank size");
+               flash_size_in_kb = bank->size / 1024;
+       }
+
        LOG_INFO("flash size = %dkbytes", flash_size_in_kb);
 
        /* did we assign flash size? */
index 7a4352fdd8a8aa98abda841adf0a8886c3718843..1d59e3c02c979fac920f0d58b08b5480fcb32313 100644 (file)
@@ -791,6 +791,13 @@ static int stm32x_probe(struct flash_bank *bank)
                flash_size_in_kb = max_flash_size_in_kb;
        }
 
+       /* if the user sets the size manually then ignore the probed value
+        * this allows us to work around devices that have a invalid flash size register value */
+       if (bank->size) {
+               LOG_INFO("ignoring flash probed value, using configured bank size");
+               flash_size_in_kb = bank->size / 1024;
+       }
+
        LOG_INFO("flash size = %dkbytes", flash_size_in_kb);
 
        /* did we assign flash size? */
index ebc7534e8645ca92ee813ae6fa428f568dd08a37..f871a361cf64b8e5653d5489f2e336cb8f8075c0 100644 (file)
@@ -552,6 +552,13 @@ static int stm32lx_probe(struct flash_bank *bank)
                flash_size_in_kb = max_flash_size_in_kb;
        }
 
+       /* if the user sets the size manually then ignore the probed value
+        * this allows us to work around devices that have a invalid flash size register value */
+       if (bank->size) {
+               LOG_INFO("ignoring flash probed value, using configured bank size");
+               flash_size_in_kb = bank->size / 1024;
+       }
+
        /* STM32L - we have 32 sectors, 16 pages per sector -> 512 pages
         * 16 pages for a protection area */
 

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)