On Monday 05 October 2009, Øyvind Harboe wrote:
>         if (jtag_init_inner(cmd_ctx) == ERROR_OK)

What would you think about changing init_inner() so it
actually *fails* when significant errors are detected?

I still think that fix would have been sufficient to resolve
the problem Michal reported.  His issue was that init_inner()
didn't report failure ... so the fallback "hard reset" logic
never got a chance to trigger.  And it would have worked if
it had triggered... his proposed patch added the ability to
force that reset before calling init_inner().

Alternatively, using jtag_add_reset(0,0) to establish a
uniformly sane initial state should address the issue too.
(Since the root cause was the JTAG adapter *starting* in a
state with some resets asserted...)  I think I'll try that
one out; I though I had observed the same error Michal was
reporting, when switching configs.


Right now in init_inner() we have:

        /* examine chain first, as this could discover the real chain layout */
        if (jtag_examine_chain() != ERROR_OK)
        {
                LOG_ERROR("Trying to use configured scan chain anyway...");
                issue_setup = false;
        }

... continuing after known brokenness.  We might want to let
the "wrong version" cases succeed, and maybe some others, but
I don't see any valid reason to continue when the number of
TAPs observed doesn't even match the number configured, or
when TDO is stuck high (no device?).

When I run into this error it's because for example there's
only one TAP present but three are configured.  Or the IDCODE
is wrong since I used the wrong config file.  Or the board is
still in reset (Michal's original problem)...


        if (jtag_validate_ircapture() != ERROR_OK)
        {
                LOG_WARNING("Errors during IR capture, continuing anyway...");
                issue_setup = false;
        }

... continuing after other known brokenness.  Here, continuable
errors would be a lot harder to find; any error likely means we
don't even know the IR register sizes.

        if (issue_setup)
                jtag_notify_event(JTAG_TAP_EVENT_SETUP);
        else
                LOG_WARNING("Bypassing JTAG setup events due to errors");


        return ERROR_OK;

... returning success regardless of any brokenness observed.  So
the logic in the jtag_init() code that tried to recover from such
errors is a NOP, and never triggers.

And note, even after your patch these significant errors are STILL
completely ignored...


_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to