This is an automated email from Gerrit.

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

-- gerrit

commit 2807570855835af60b0da250b5a4405d039fbaeb
Author: Jonathan Dumaresq <[email protected]>
Date:   Mon Feb 6 10:48:13 2012 -0500

    Add stm32f0x flash driver discovered by the stm32f1x driver
    flash probe now works
    
    Change-Id: Ib663519a2f0415ea18b5928865e7fd967e7f8960
    Signed-off-by: Jonathan Dumaresq <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index b3f78ca..118255b 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -921,6 +921,13 @@ static int stm32x_probe(struct flash_bank *bank)
        int retval = target_read_u32(target, 0xE0042000, &device_id);
        if (retval != ERROR_OK)
                return retval;
+       if(device_id == 0x00000000) {   // device_id is 0, then we can try the 
stm32f0x address
+               LOG_INFO("device id is 0x00000000 try stm32f0x address");
+               int retval = target_read_u32(target, 0x40015800, &device_id);
+               if (retval != ERROR_OK)
+                       return retval;
+       }
+
        LOG_INFO("device id = 0x%08" PRIx32 "", device_id);
 
        /* get flash size from target. */
@@ -1027,6 +1034,18 @@ static int stm32x_probe(struct flash_bank *bank)
                        stm32x_info->register_base = FLASH_REG_BASE_B1;
                        base_address = 0x08080000;
                }
+       } else if ((device_id & 0xfff) == 0x440) {
+               /* stm32f0x - we have 1k pages
+                * 4 pages for a protection area */
+               page_size = 1024;
+               stm32x_info->ppage_size = 4;
+
+               /* check for early silicon */
+               if (flash_size_in_kb == 0xffff) {
+                       /* number of sectors incorrect on revZ */
+                       LOG_WARNING("STM32 flash size failed, probe inaccurate 
- assuming 64k flash");
+                       flash_size_in_kb = 64;
+               }
        } else {
                LOG_WARNING("Cannot identify target as a STM32 family.");
                return ERROR_FAIL;
@@ -1217,7 +1236,21 @@ static int get_stm32x_info(struct flash_bank *bank, char 
*buf, int buf_size)
                                snprintf(buf, buf_size, "unknown");
                                break;
                }
-       } else {
+       } else if ((device_id & 0xfff) == 0x440) {
+               printed = snprintf(buf, buf_size, "stm32f0x - Rev: ");
+               buf += printed;
+               buf_size -= printed;
+
+               switch (device_id >> 16) {
+                       case 0x1000:
+                               snprintf(buf, buf_size, "A");
+                               break;
+
+                       default:
+                               snprintf(buf, buf_size, "unknown");
+                               break;
+               }
+       }else {
                snprintf(buf, buf_size, "Cannot identify target as a stm32x\n");
                return ERROR_FAIL;
        }

-- 

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to