summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-11-27 12:14:46 +0000
committerntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-11-27 12:14:46 +0000
commitab28153685f44a5fab9a0d346239f116fd996a7a (patch)
treed962edfd501b022f47235b84752b78f6d76e0ee0
parentd03e5d0ada1fed216bf313cb4a2d08482ca5e74c (diff)
downloadopenocd+libswd-ab28153685f44a5fab9a0d346239f116fd996a7a.tar.gz
openocd+libswd-ab28153685f44a5fab9a0d346239f116fd996a7a.tar.bz2
openocd+libswd-ab28153685f44a5fab9a0d346239f116fd996a7a.tar.xz
openocd+libswd-ab28153685f44a5fab9a0d346239f116fd996a7a.zip
- stm32x flash driver: add support for low density devices
git-svn-id: svn://svn.berlios.de/openocd/trunk@1189 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/flash/stm32x.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c
index 0f62da91..1b821059 100644
--- a/src/flash/stm32x.c
+++ b/src/flash/stm32x.c
@@ -727,6 +727,21 @@ int stm32x_probe(struct flash_bank_s *bank)
num_pages = 128;
}
}
+ else if ((device_id & 0x7ff) == 0x412)
+ {
+ /* low density - we have 1k pages
+ * 4 pages for a protection area */
+ page_size = 1024;
+ stm32x_info->ppage_size = 4;
+
+ /* check for early silicon */
+ if (num_pages == 0xffff)
+ {
+ /* number of sectors incorrect on revA */
+ LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 32k flash" );
+ num_pages = 32;
+ }
+ }
else if ((device_id & 0x7ff) == 0x414)
{
/* high density - we have 2k pages
@@ -822,6 +837,23 @@ int stm32x_info(struct flash_bank_s *bank, char *buf, int buf_size)
break;
}
}
+ else if ((device_id & 0x7ff) == 0x412)
+ {
+ printed = snprintf(buf, buf_size, "stm32x (Low Density) - 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 if ((device_id & 0x7ff) == 0x414)
{
printed = snprintf(buf, buf_size, "stm32x (High Density) - Rev: ");
@@ -1016,7 +1048,7 @@ int stm32x_handle_options_write_command(struct command_context_s *cmd_ctx, char
if (argc < 4)
{
command_print(cmd_ctx, "stm32x options_write <bank> <SWWDG|HWWDG> <RSTSTNDBY|NORSTSTNDBY> <RSTSTOP|NORSTSTOP>");
- return ERROR_OK;
+ return ERROR_OK;
}
bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0));