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/438

-- gerrit

commit 5462af1515fba9a109f0ca43108727f54dfebfd3
Author: Jonathan Dumaresq <[email protected]>
Date:   Tue Feb 7 09:55:34 2012 -0500

    Add stm32f0x probe and info working
    
    This patch add the stm32f0x device to be reconized by the stm32f1x flash 
driver
    
    Change-Id: Ieb5a46fc002b5390a0c81bc8b49f6c687036ae1d
    Signed-off-by: Jonathan Dumaresq <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index b3f78ca..ff13c0c 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -921,6 +921,14 @@ 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");
+               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 +1035,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;
@@ -1091,6 +1111,13 @@ static int get_stm32x_info(struct flash_bank *bank, char 
*buf, int buf_size)
        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");
+               retval = target_read_u32(target, 0x40015800, &device_id);
+               if (retval != ERROR_OK)
+                       return retval;
+       }
+
        if ((device_id & 0xfff) == 0x410) {
                printed = snprintf(buf, buf_size, "stm32x (Medium Density) - 
Rev: ");
                buf += printed;
@@ -1217,6 +1244,20 @@ static int get_stm32x_info(struct flash_bank *bank, char 
*buf, int buf_size)
                                snprintf(buf, buf_size, "unknown");
                                break;
                }
+       } 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;

-- 

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to