cortexm: Only force halt before probe() if probe was forced.

This commit is contained in:
Uwe Bonnes 2018-09-10 21:40:37 +02:00 committed by Gareth McMullin
parent da75acf015
commit 525b90d4e5
3 changed files with 8 additions and 6 deletions

View File

@ -337,7 +337,7 @@ static bool adiv5_component_probe(ADIv5_AP_t *ap, uint32_t addr)
switch (pidr_pn_bits[i].arch) {
case aa_cortexm:
DEBUG("-> cortexm_probe\n");
cortexm_probe(ap);
cortexm_probe(ap, false);
break;
case aa_cortexa:
DEBUG("-> cortexa_probe\n");
@ -473,7 +473,7 @@ void adiv5_dp_init(ADIv5_DP_t *dp)
probed |= adiv5_component_probe(ap, ap->base);
if (!probed && (dp->idcode & 0xfff) == 0x477) {
DEBUG("-> cortexm_probe forced\n");
cortexm_probe(ap);
cortexm_probe(ap, true);
probed = true;
}
}

View File

@ -264,7 +264,7 @@ static bool cortexm_forced_halt(target *t)
return true;
}
bool cortexm_probe(ADIv5_AP_t *ap)
bool cortexm_probe(ADIv5_AP_t *ap, bool forced)
{
target *t;
@ -323,8 +323,10 @@ bool cortexm_probe(ADIv5_AP_t *ap)
target_check_error(t);
}
if (forced)
if (!cortexm_forced_halt(t))
return false;
#define PROBE(x) \
do { if ((x)(t)) {target_halt_resume(t, 0); return true;} else target_check_error(t); } while (0)

View File

@ -168,7 +168,7 @@ extern long cortexm_wait_timeout;
#define CORTEXM_TOPT_INHIBIT_SRST (1 << 2)
bool cortexm_probe(ADIv5_AP_t *ap);
bool cortexm_probe(ADIv5_AP_t *ap, bool forced);
ADIv5_AP_t *cortexm_ap(target *t);
bool cortexm_attach(target *t);