Ensure Cortex-M reset wakes device from sleep (wfi/wfe)
Change-Id: Idb52ca3123bb3e2f7863ba1b82ac9b176d7cb094 Signed-off-by: Evan Hunter <ehunter@broadcom.com> Reviewed-on: http://openocd.zylin.com/833 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
parent
452248af1d
commit
6663a788a5
|
@ -973,6 +973,14 @@ static int cortex_m3_assert_reset(struct target *target)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the processor is sleeping in a WFI or WFE instruction, the
|
||||||
|
* C_HALT bit must be asserted to regain control */
|
||||||
|
if (cortex_m3->dcb_dhcsr & S_SLEEP) {
|
||||||
|
retval = mem_ap_write_u32(swjdp, DCB_DHCSR, DBGKEY | C_HALT | C_DEBUGEN);
|
||||||
|
if (retval != ERROR_OK)
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
retval = mem_ap_write_u32(swjdp, DCB_DCRDR, 0);
|
retval = mem_ap_write_u32(swjdp, DCB_DCRDR, 0);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
Loading…
Reference in New Issue