Skip to content

target/riscv: active dm before get nextdm #1252

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

Open
wants to merge 2 commits into
base: riscv
Choose a base branch
from

Conversation

lz-bro
Copy link
Contributor

@lz-bro lz-bro commented May 6, 2025

when Debug Module is inactive, accesses to the nextdm may fail. Specifically, nextdm might not return correct data.

When I want to debug a target form a specific DM, the config is as flows:

set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10000E21

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME -dbgbase 0x400

openocd can not get correct nextdm Due to DM with DMI base address = 0x0 is inactive.

@lz-bro lz-bro force-pushed the active-dm-before-get-nextdm branch from 959583d to 8391810 Compare May 6, 2025 06:31
@en-sc
Copy link
Collaborator

en-sc commented May 6, 2025

@lz-bro, please cherry-pick the commit from #1248 to fix the CI.

Ubuntu 20.04 is no longer available.
See actions/runner-images#11101

Checkpatch-ignore: BAD_SIGN_OFF
Change-Id: I0ec3e3342f9212a2a79d8dca6274e7db62ecedab
Signed-off-by: Evgeniy Naydanov <[email protected]>
@lz-bro lz-bro force-pushed the active-dm-before-get-nextdm branch from 8391810 to 508ac6f Compare May 7, 2025 01:38
@lz-bro
Copy link
Contributor Author

lz-bro commented May 7, 2025

@lz-bro, please cherry-pick the commit from #1248 to fix the CI.

I have cherry-pick the commit to fix the CI, and could you please take a look?

en-sc
en-sc previously approved these changes May 7, 2025
Copy link
Collaborator

@en-sc en-sc left a comment

Choose a reason for hiding this comment

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

LGTM. Only minor suggestions

break;

const time_t start = time(NULL);
LOG_TARGET_DEBUG(target, "Waiting for the DM to active.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure this is grammatically correct. I'd suggest:

Suggested change
LOG_TARGET_DEBUG(target, "Waiting for the DM to active.");
LOG_TARGET_DEBUG(target, "Waiting for the DM to activate.");

or

Suggested change
LOG_TARGET_DEBUG(target, "Waiting for the DM to active.");
LOG_TARGET_DEBUG(target, "Waiting for the DM to become active.");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed



} while (!get_field32(dmcontrol, DM_DMCONTROL_DMACTIVE));
LOG_TARGET_DEBUG(target, "DM successfully active.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above. I'd suggest a simpler

Suggested change
LOG_TARGET_DEBUG(target, "DM successfully active.");
LOG_TARGET_DEBUG(target, "DM is active.");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

when Debug Module is inactive, accesses to the nextdm may fail.
Specifically, nextdm might not return correct data.
@lz-bro lz-bro force-pushed the active-dm-before-get-nextdm branch from 508ac6f to 3f14acc Compare May 7, 2025 11:14
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.

2 participants