Add error handling and remove double readout.
Remove double readout of DCB_DHCSR in target poll. The return value of the endreset event is handled and not ignored in target poll. Change-Id: I8fe026418dadcf0b0dcbb09acee871ad950937a2 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/1181 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
This commit is contained in:
parent
52b80fbd82
commit
7c101b9e31
|
@ -521,15 +521,8 @@ static int cortex_m_poll(struct target *target)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cortex_m->dcb_dhcsr & S_RESET_ST) {
|
if (cortex_m->dcb_dhcsr & S_RESET_ST) {
|
||||||
/* check if still in reset */
|
target->state = TARGET_RESET;
|
||||||
retval = mem_ap_read_atomic_u32(swjdp, DCB_DHCSR, &cortex_m->dcb_dhcsr);
|
return ERROR_OK;
|
||||||
if (retval != ERROR_OK)
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
if (cortex_m->dcb_dhcsr & S_RESET_ST) {
|
|
||||||
target->state = TARGET_RESET;
|
|
||||||
return ERROR_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target->state == TARGET_RESET) {
|
if (target->state == TARGET_RESET) {
|
||||||
|
@ -538,7 +531,11 @@ static int cortex_m_poll(struct target *target)
|
||||||
*/
|
*/
|
||||||
LOG_DEBUG("Exit from reset with dcb_dhcsr 0x%" PRIx32,
|
LOG_DEBUG("Exit from reset with dcb_dhcsr 0x%" PRIx32,
|
||||||
cortex_m->dcb_dhcsr);
|
cortex_m->dcb_dhcsr);
|
||||||
cortex_m_endreset_event(target);
|
retval = cortex_m_endreset_event(target);
|
||||||
|
if (retval != ERROR_OK) {
|
||||||
|
target->state = TARGET_UNKNOWN;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
target->state = TARGET_RUNNING;
|
target->state = TARGET_RUNNING;
|
||||||
prev_target_state = TARGET_RUNNING;
|
prev_target_state = TARGET_RUNNING;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue