This is an automated email from Gerrit.

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

-- gerrit

commit 2e80f2e9f98e9e47199ffa0bca2551d9e09815f9
Author: Spencer Oliver <[email protected]>
Date:   Thu Jul 12 12:29:38 2012 +0100

    flash: handle zero when reading stm32 flash size reg
    
    Some variants read 0 for the flash size register, rather than
    failing lets assume we have max flash fitted.
    
    Change-Id: Ie1fb4e73606f49268a6fd5921c3aef75bc4790d3
    Signed-off-by: Spencer Oliver <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index e7e795d..6734a1f 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -903,6 +903,11 @@ static int stm32x_probe(struct flash_bank *bank)
                flash_size_in_kb = 0xffff;
        }
 
+       /* some variants read 0 for flash size register
+        * use a max flash size as a default */
+       if (flash_size_in_kb == 0)
+               flash_size_in_kb = 0xffff;
+
        if ((device_id & 0xfff) == 0x410) {
                /* medium density - we have 1k pages
                 * 4 pages for a protection area */
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c
index c7e050d..5f5bfb8 100644
--- a/src/flash/nor/stm32f2x.c
+++ b/src/flash/nor/stm32f2x.c
@@ -605,6 +605,11 @@ static int stm32x_probe(struct flash_bank *bank)
                flash_size_in_kb = 0xffff;
        }
 
+       /* some variants read 0 for flash size register
+        * use a max flash size as a default */
+       if (flash_size_in_kb == 0)
+               flash_size_in_kb = 0xffff;
+
        if ((device_id & 0xfff) == 0x411) {
                /* check for early silicon */
                if (flash_size_in_kb == 0xffff) {
diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c
index 3863144..27a446d 100644
--- a/src/flash/nor/stm32lx.c
+++ b/src/flash/nor/stm32lx.c
@@ -482,6 +482,11 @@ static int stm32lx_probe(struct flash_bank *bank)
                flash_size_in_kb = 0xffff;
        }
 
+       /* some variants read 0 for flash size register
+        * use a max flash size as a default */
+       if (flash_size_in_kb == 0)
+               flash_size_in_kb = 0xffff;
+
        if ((device_id & 0xfff) == 0x416) {
                /* check for early silicon */
                if (flash_size_in_kb == 0xffff) {

-- 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to