aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Meadows2015-07-12 17:30:18 +0100
committerRichard Meadows2015-07-12 17:32:48 +0100
commit101821ae318597d934fe5f9b8723d032f05a5a5b (patch)
tree29b8dedf6d27ffea41b9c8ac823a73509965bc2b
parent762e54060ff6004f60eab175378c6f0f6e138418 (diff)
[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 09544bc7101981f2688e0a678138dc4580ea3f76 (PR #92) but 492d6c9cf8f735eea5478c99aee43608549218d7 maybe contributes to the confusion in this instance.
-rw-r--r--src/stm32f1.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/stm32f1.c b/src/stm32f1.c
index fecebdf..f8a2d94 100644
--- a/src/stm32f1.c
+++ b/src/stm32f1.c
@@ -162,7 +162,12 @@ bool stm32f1_probe(target *t)
block_size = 0x800;
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;
gdb_outf("flash size %d block_size %d\n", flash_size, block_size);
target_add_ram(t, 0x20000000, 0x5000);
@@ -353,4 +358,3 @@ static bool stm32f1_cmd_option(target *t, int argc, char *argv[])
}
return true;
}
-