From 09544bc7101981f2688e0a678138dc4580ea3f76 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Sat, 20 Jun 2015 22:24:47 +0200 Subject: [PATCH] src/stm32f1.c: More verbose FO detection message. --- src/stm32f1.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/stm32f1.c b/src/stm32f1.c index e405aca..4d291d1 100644 --- a/src/stm32f1.c +++ b/src/stm32f1.c @@ -87,6 +87,9 @@ static int stm32f1_flash_write(struct target_flash *f, #define DBGMCU_IDCODE 0xE0042000 #define DBGMCU_IDCODE_F0 0x40015800 +#define FLASHSIZE 0x1FFFF7E0 +#define FLASHSIZE_F0 0x1FFFF7CC + static const uint16_t stm32f1_flash_write_stub[] = { #include "../flashstub/stm32f1.stub" }; @@ -110,6 +113,7 @@ static void stm32f1_add_flash(target *t, bool stm32f1_probe(target *t) { + size_t flash_size; t->idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xfff; switch(t->idcode) { case 0x410: /* Medium density */ @@ -140,13 +144,25 @@ bool stm32f1_probe(target *t) t->idcode = target_mem_read32(t, DBGMCU_IDCODE_F0) & 0xfff; switch(t->idcode) { case 0x444: /* STM32F03 RM0091 Rev.7 */ + t->driver = "STM32F03"; + break; case 0x445: /* STM32F04 RM0091 Rev.7 */ + t->driver = "STM32F04"; + break; case 0x440: /* STM32F05 RM0091 Rev.7 */ + t->driver = "STM32F05"; + break; case 0x448: /* STM32F07 RM0091 Rev.7 */ + t->driver = "STM32F07"; + break; case 0x442: /* STM32F09 RM0091 Rev.7 */ - t->driver = "STM32F0"; + t->driver = "STM32F09"; + break; + } + if (t->driver) { + flash_size = target_mem_read32(t, FLASHSIZE_F0) *0x400; target_add_ram(t, 0x20000000, 0x5000); - stm32f1_add_flash(t, 0x8000000, 0x20000, 0x400); + stm32f1_add_flash(t, 0x8000000, flash_size, 0x400); target_add_commands(t, stm32f1_cmd_list, "STM32F0"); return true; }