stm32: add stm32 xl family flash support
authorSpencer Oliver <ntfreak@users.sourceforge.net>
Wed, 22 Dec 2010 17:20:11 +0000 (17:20 +0000)
committerSpencer Oliver <ntfreak@users.sourceforge.net>
Thu, 23 Dec 2010 12:11:14 +0000 (12:11 +0000)
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
src/flash/nor/stm32x.c
tcl/target/stm32.cfg
tcl/target/stm32xl.cfg [new file with mode: 0644]

index 8aae203625679cdad43e795ed8c704528b6b0598..6393aa40f426c4ec55276f8eb2190a9ccb30d8b5 100644 (file)
@@ -905,6 +905,34 @@ static int stm32x_probe(struct flash_bank *bank)
                        num_pages = 128;
                }
        }
+       else if ((device_id & 0x7ff) == 0x430)
+       {
+               /* xl line density - we have 2k pages
+                * 2 pages for a protection area */
+               page_size = 2048;
+               stm32x_info->ppage_size = 2;
+
+               /* check for early silicon */
+               if (num_pages == 0xffff)
+               {
+                       /* number of sectors may be incorrrect on early silicon */
+                       LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 1024k flash");
+                       num_pages = 1024;
+               }
+
+               /* split reported size into matching bank */
+               if (bank->base != 0x08080000)
+               {
+                       /* bank 0 will be fixed 512k */
+                       num_pages = 512;
+               }
+               else
+               {
+                       num_pages -= 512;
+                       /* bank1 also uses a register offset */
+                       stm32x_info->register_offset = 0x40;
+               }
+       }
        else
        {
                LOG_WARNING("Cannot identify target as a STM32 family.");
@@ -922,7 +950,6 @@ static int stm32x_probe(struct flash_bank *bank)
                bank->sectors = NULL;
        }
 
-       bank->base = 0x08000000;
        bank->size = (num_pages * page_size);
        bank->num_sectors = num_pages;
        bank->sectors = malloc(sizeof(struct flash_sector) * num_pages);
@@ -1075,6 +1102,23 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
                                break;
                }
        }
+       else if ((device_id & 0x7ff) == 0x430)
+       {
+               printed = snprintf(buf, buf_size, "stm32x (XL) - 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");
index 86e6ebb89437559bea0edf8551046822a262492d..eef12699218962045fd2b71c1ad24a647fce9a37 100644 (file)
@@ -52,18 +52,22 @@ if { [info exists BSTAPID ] } {
   set _BSTAPID4 0x06414041
   # Connectivity line devices, Rev A and Rev Z
   set _BSTAPID5 0x06418041
+  # XL line devices, Rev A
+  set _BSTAPID6 0x06430041
 }
 jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
        -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
-       -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
+       -expected-id $_BSTAPID4 -expected-id $_BSTAPID5 \
+       -expected-id $_BSTAPID6
 
 set _TARGETNAME $_CHIPNAME.cpu
 target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
 
 $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
 
+# flash size will be probed
 set _FLASHNAME $_CHIPNAME.flash
-flash bank $_FLASHNAME stm32x 0 0 0 0 $_TARGETNAME
+flash bank $_FLASHNAME stm32x 0x08000000 0 0 0 $_TARGETNAME
 
 # if srst is not fitted use SYSRESETREQ to
 # perform a soft reset
diff --git a/tcl/target/stm32xl.cfg b/tcl/target/stm32xl.cfg
new file mode 100644 (file)
index 0000000..cde07df
--- /dev/null
@@ -0,0 +1,6 @@
+# script for stm32xl family (dual flash bank)
+source [find target/stm32.cfg]
+
+# flash size will be probed
+set _FLASHNAME $_CHIPNAME.flash1
+flash bank $_FLASHNAME stm32x 0x08080000 0 0 0 $_TARGETNAME

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)