aboutsummaryrefslogtreecommitdiff
path: root/src/cortexm.c
diff options
context:
space:
mode:
authorGareth McMullin2012-06-21 20:54:56 +1200
committerGareth McMullin2012-06-21 20:54:56 +1200
commit33905d720337b6a66a11217e8c46558d019c1e8a (patch)
tree08180142c1b8d8dd2b3f32827f94628f8f7b4fc2 /src/cortexm.c
parent6089a66dcec19ef650a4c3f71dab414e0fd6a1cc (diff)
Check target error after target specific probes.
Diffstat (limited to 'src/cortexm.c')
-rw-r--r--src/cortexm.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cortexm.c b/src/cortexm.c
index bd67e10..2adf8d9 100644
--- a/src/cortexm.c
+++ b/src/cortexm.c
@@ -325,11 +325,15 @@ cortexm_probe(struct target_s *target)
}
- if(stm32f1_probe(target) == 0) return 0;
- if(stm32f4_probe(target) == 0) return 0;
- if(lpc11xx_probe(target) == 0) return 0;
- /* if not STM32 try LMI which I don't know how to detect reliably */
- lmi_probe(target);
+#define PROBE(x) \
+ do { if (!(x)(target) && !target_check_error(target)) return 0; } while (0)
+
+ PROBE(stm32f1_probe);
+ PROBE(stm32f4_probe);
+ PROBE(lpc11xx_probe);
+ /* Try LMI last, as it doesn't fail. */
+ PROBE(lmi_probe);
+#undef PROBE
return 0;
}