Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target: Update messages connected with examine #931

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

kr-sc
Copy link
Contributor

@kr-sc kr-sc commented Oct 3, 2023

Move examine_attempted flag to target struct to make it target specific.

Info messages for retry and Error messages for failure added.

P.S. I have to request this patch here because of https://review.openocd.org/c/openocd/+/6964. There is no such patch in upstream openocd repo.

Move `examine_attempted` flag to target struct to make it target specific.
`Info` messages for retry and `Error` messages for failure added.

Change-Id: Id2fbe7dc68d746c936c8412289d0d149fbd80d71
Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com>
Copy link
Collaborator

@timsifive timsifive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK.

src/target/target.c Show resolved Hide resolved
src/target/target.c Show resolved Hide resolved
@timsifive timsifive merged commit 41d1ee3 into riscv-collab:riscv Oct 11, 2023
5 checks passed
@en-sc
Copy link
Collaborator

en-sc commented Oct 13, 2023

@kr-sc , @timsifive, unfortunately, this needs to be reverted. The implementation is buggy.

We have target_examine() function:

    for (target = all_targets; target; target = target->next) {
        /* defer examination, but don't skip it */
        if (!target->tap->enabled) {
            jtag_register_event_callback(jtag_enable_callback,
                    target);
            continue;
        }
        if (target->defer_examine)
            continue;

        target->examine_attempted = true;

This function is called only once. From src/openocd.c. So, the original intention for the variable is just to mark that this function was called. I guess that this may result in subtle errors, since the condition for:

    if (retval != ERROR_OK && target->examine_attempted) {                                        
        target_reset_examined(target);                                                              
        retval = target_examine_one(target);                                                        
        if (retval != ERROR_OK) {                                                                   
           LOG_TARGET_DEBUG(target, "Polling again in %dms",                                         
              target->backoff.interval);                                                              
           return retval;                                                                            
         }                                                                                           
    }

Will never be true for the targets that had a deferred examine.

@kr-sc
Copy link
Contributor Author

kr-sc commented Oct 16, 2023

@en-sc is right, unfortunately
mr with revert here #934

kr-sc added a commit to kr-sc/riscv-openocd that referenced this pull request Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants