[Bugfix] stm32f1_probe would always return true, breaking support for all other targets

The intention of `if (t->driver)` conditional was to test if any of the cases in the preceeding switch/case were met. However t->driver was previously set to point to a default value in cortexm.c:200 and therefore this would always evaluate to true. I've replaced the broken if statement with a duplicate of the switch/case run above.

It looks like this was introduced in 09544bc710 (PR #92) but 492d6c9cf8 maybe contributes to the confusion in this instance.
This commit is contained in:
Richard Meadows 2015-07-12 17:30:18 +01:00
parent 762e54060f
commit 101821ae31
1 changed files with 6 additions and 2 deletions

View File

@ -162,7 +162,12 @@ bool stm32f1_probe(target *t)
block_size = 0x800; block_size = 0x800;
break; break;
} }
if (t->driver) { switch(t->idcode) {
case 0x444: /* STM32F03 RM0091 Rev.7 */
case 0x445: /* STM32F04 RM0091 Rev.7 */
case 0x440: /* STM32F05 RM0091 Rev.7 */
case 0x448: /* STM32F07 RM0091 Rev.7 */
case 0x442: /* STM32F09 RM0091 Rev.7 */
flash_size = (target_mem_read32(t, FLASHSIZE_F0) & 0xffff) *0x400; flash_size = (target_mem_read32(t, FLASHSIZE_F0) & 0xffff) *0x400;
gdb_outf("flash size %d block_size %d\n", flash_size, block_size); gdb_outf("flash size %d block_size %d\n", flash_size, block_size);
target_add_ram(t, 0x20000000, 0x5000); target_add_ram(t, 0x20000000, 0x5000);
@ -353,4 +358,3 @@ static bool stm32f1_cmd_option(target *t, int argc, char *argv[])
} }
return true; return true;
} }