]> git.sur5r.net Git - openocd/commitdiff
cortex_m3: allow scripts to override reset
authorAaron Carroll <aaronc@cse.unsw.edu.au>
Wed, 2 Feb 2011 07:16:25 +0000 (18:16 +1100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 2 Feb 2011 07:32:10 +0000 (08:32 +0100)
If a handler for the reset-assert event it present, skip the usual reset
handling.  This is needed, for example, for board-level resets.

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
src/target/cortex_m3.c

index f6918afaa29420630dedb33207bad818ec0155c3..5fd56e4007cccee6b211a72168897cc79cec1492 100644 (file)
@@ -927,6 +927,16 @@ static int cortex_m3_assert_reset(struct target *target)
 
        enum reset_types jtag_reset_config = jtag_get_reset_config();
 
+       if (target_has_event_action(target, TARGET_EVENT_RESET_ASSERT)) {
+               /* allow scripts to override the reset event */
+
+               target_handle_event(target, TARGET_EVENT_RESET_ASSERT);
+               register_cache_invalidate(cortex_m3->armv7m.core_cache);
+               target->state = TARGET_RESET;
+
+               return ERROR_OK;
+       }
+
        /* Enable debug requests */
        int retval;
        retval = mem_ap_read_atomic_u32(swjdp, DCB_DHCSR, &cortex_m3->dcb_dhcsr);