]> git.sur5r.net Git - openocd/blobdiff - src/flash/nor/stm32lx.c
stm32: enable flash bank size override
[openocd] / src / flash / nor / stm32lx.c
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 */