Hi guys,

The function adapter_deassert_reset() is called without any condition check
in function cortex_m_deassert_reset(). Looks like it is not right. We can
see that in function cortex_m_assert_reset(), RESET_HAS_SRST will be
checked firstly then call function adapter_assert_reset().
So I think as the same reason (jtag_reset_config & RESET_HAS_SRST) should
be checked before adapter_deassert_reset() is called
in cortex_m_deassert_reset().
The main reason is sometimes we should not touch reset lines
when RESET_HAS_SRST is not set.

I suggest change cortex_m_deassert_reset() as below:

static int cortex_m_deassert_reset(struct target *target)
{
LOG_DEBUG("target->state: %s",
target_state_name(target));

enum reset_types jtag_reset_config = jtag_get_reset_config();

/* deassert reset lines */
        if (jtag_reset_config & RESET_HAS_SRST)
adapter_deassert_reset();

if ((jtag_reset_config & RESET_HAS_SRST) &&
    !(jtag_reset_config & RESET_SRST_NO_GATING)) {
int retval = ahbap_debugport_init(target_to_cm(target)->armv7m.arm.dap);
if (retval != ERROR_OK) {
LOG_ERROR("DP initialisation failed");
return retval;
}
}

return ERROR_OK;
}

Is my understanding right? How do you think about this?

Best Regards,
Bin Lei
------------------------------------------------------------------------------
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to