aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2012-01-04 22:55:49 +0000
committerSpencer Oliver <spen@spen-soft.co.uk>2012-01-09 09:50:10 +0000
commit80df024c806014885ce1a6524ba05352651c0ac3 (patch)
tree7103d6110e51fa9e18a2dfaf87f8096c5b65f688 /src
parente024bcc3d93b9b0a665a2d32b747733f90cbcfac (diff)
downloadriscv-openocd-80df024c806014885ce1a6524ba05352651c0ac3.zip
riscv-openocd-80df024c806014885ce1a6524ba05352651c0ac3.tar.gz
riscv-openocd-80df024c806014885ce1a6524ba05352651c0ac3.tar.bz2
flash: support stm32f4x flash
This uses the same controller as the stm32f2x family. Change-Id: I931a9ceb0cd1219514d14b8b59475179e543dd0f Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/338 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/stm32f2x.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c
index 1fca3eb..479df8a 100644
--- a/src/flash/nor/stm32f2x.c
+++ b/src/flash/nor/stm32f2x.c
@@ -602,6 +602,13 @@ static int stm32x_probe(struct flash_bank *bank)
LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash");
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 {
LOG_WARNING("Cannot identify target as a STM32 family.");
return ERROR_FAIL;
@@ -664,14 +671,12 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
if (retval != ERROR_OK)
return retval;
- if ((device_id & 0x7ff) == 0x411)
- {
- printed = snprintf(buf, buf_size, "stm32x (1mByte part) - Rev: ");
+ if ((device_id & 0x7ff) == 0x411) {
+ printed = snprintf(buf, buf_size, "stm32f2x - Rev: ");
buf += printed;
buf_size -= printed;
- switch (device_id >> 16)
- {
+ switch (device_id >> 16) {
case 0x1000:
snprintf(buf, buf_size, "A");
break;
@@ -692,9 +697,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 & 0x7ff) == 0x413) {
+ 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");
return ERROR_FAIL;
}