This is an automated email from Gerrit.

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

-- gerrit

commit 489b0b78322e61f1749bc5cabf7bb090f31c37a6
Author: Andrey Yurovsky <[email protected]>
Date:   Tue Jul 23 13:25:50 2013 -0700

    stm32lx flash: fix size reading on 0x436 devices
    
    The updated RM0038 explains that chips with IDCODE 0x436 can have their
    F_SIZE register contain one of two sizes:
    - the size in Kb as expected or
    - 0 indicating 384Kb or 1 indicating 256Kb
    
    Detect this special case and handle it per RM0038 rev8 rather than
    treating 0 as an error and overriding.
    
    Change-Id: I9165d6cda134cf90dbd9b3a5d7cb9911ade133ba
    Signed-off-by: Andrey Yurovsky <[email protected]>

diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c
index 226ea95..d5436cd 100644
--- a/src/flash/nor/stm32lx.c
+++ b/src/flash/nor/stm32lx.c
@@ -561,6 +561,15 @@ static int stm32lx_probe(struct flash_bank *bank)
        else
                        retval = target_read_u16(target, F_SIZE, 
&flash_size_in_kb);
 
+       /* The 0x436 Medium+/High Density devices can have their flash size set 
to
+        * either the size in Kb or a 0 or 1 flag indicating the size. */
+       if ((device_id & 0xfff) == 0x436) {
+               if (flash_size_in_kb == 0)
+                       flash_size_in_kb = 384;
+               else if (flash_size_in_kb == 1)
+                       flash_size_in_kb = 256;
+       }
+
        /* Failed reading flash size or flash size invalid (early silicon),
         * default to max target family */
        if (retval != ERROR_OK || flash_size_in_kb == 0xffff || 
flash_size_in_kb == 0) {

-- 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to