Commit 80df024c authored by Spencer Oliver's avatar Spencer Oliver
Browse files

flash: support stm32f4x flash



This uses the same controller as the stm32f2x family.

Change-Id: I931a9ceb0cd1219514d14b8b59475179e543dd0f
Signed-off-by: default avatarSpencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/338


Tested-by: jenkins
Reviewed-by: default avatarMathias Küster <kesmtp@freenet.de>
parent e024bcc3
...@@ -602,6 +602,13 @@ static int stm32x_probe(struct flash_bank *bank) ...@@ -602,6 +602,13 @@ static int stm32x_probe(struct flash_bank *bank)
LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash"); LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash");
flash_size_in_kb = 512; flash_size_in_kb = 512;
} }
} else if ((device_id & 0x7ff) == 0x413) {
/* check for early silicon */
if (flash_size_in_kb == 0xffff) {
/* number of sectors may be incorrrect on early silicon */
LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash");
flash_size_in_kb = 512;
}
} else { } else {
LOG_WARNING("Cannot identify target as a STM32 family."); LOG_WARNING("Cannot identify target as a STM32 family.");
return ERROR_FAIL; return ERROR_FAIL;
...@@ -664,14 +671,12 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size) ...@@ -664,14 +671,12 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
if ((device_id & 0x7ff) == 0x411) if ((device_id & 0x7ff) == 0x411) {
{ printed = snprintf(buf, buf_size, "stm32f2x - Rev: ");
printed = snprintf(buf, buf_size, "stm32x (1mByte part) - Rev: ");
buf += printed; buf += printed;
buf_size -= printed; buf_size -= printed;
switch (device_id >> 16) switch (device_id >> 16) {
{
case 0x1000: case 0x1000:
snprintf(buf, buf_size, "A"); snprintf(buf, buf_size, "A");
break; break;
...@@ -692,9 +697,21 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size) ...@@ -692,9 +697,21 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
snprintf(buf, buf_size, "unknown"); snprintf(buf, buf_size, "unknown");
break; break;
} }
} } else if ((device_id & 0x7ff) == 0x413) {
else printed = snprintf(buf, buf_size, "stm32f4x - 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"); snprintf(buf, buf_size, "Cannot identify target as a stm32x\n");
return ERROR_FAIL; return ERROR_FAIL;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment