X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftarget%2Fcortex_m.c;h=81d6ccf4f5a4ed3d69212ed3f5072a13151f7f40;hb=6663a788a53ee38f2d6950fe7802eae7855e01f3;hp=5fa78ca8c3ce6bc450e8781928527d08bb61d258;hpb=2aab7d3ce2b53200ed01eeedb8348fa4b977bed3;p=fw%2Fopenocd diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 5fa78ca8c..81d6ccf4f 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -973,6 +973,14 @@ static int cortex_m3_assert_reset(struct target *target) 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); if (retval != ERROR_OK) return retval; @@ -1025,7 +1033,7 @@ static int cortex_m3_assert_reset(struct target *target) if (reset_config == CORTEX_M3_RESET_VECTRESET) { LOG_WARNING("Only resetting the Cortex-M3 core, use a reset-init event " - "handler to reset any peripherals"); + "handler to reset any peripherals or configure hardware srst support."); } {