-
-
Notifications
You must be signed in to change notification settings - Fork 785
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
Add ESP32-P4 support #2064
base: main
Are you sure you want to change the base?
Add ESP32-P4 support #2064
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -304,6 +304,30 @@ void riscv_dmi_init(riscv_dmi_s *const dmi) | |
do { | ||
/* Read out the DM's status register */ | ||
uint32_t dm_status = 0; | ||
|
||
/* Turn on DM before trying to read version */ | ||
if (!riscv_dmi_write(dmi, base_addr + RV_DM_CONTROL, RV_DM_CTRL_ACTIVE)) { | ||
DEBUG_ERROR("error turning on DM!\n"); | ||
return; | ||
} | ||
|
||
/* After changing the value of dm_active, the debugger must poll dmcontrol | ||
* until dm_active has taken the requested value */ | ||
bool dm_active = false; | ||
uint32_t dm_control = 0; | ||
while (!dm_active) { | ||
if (!riscv_dmi_read(dmi, base_addr + RV_DM_CONTROL, &dm_control)) { | ||
DEBUG_ERROR("error turning on DM!\n"); | ||
return; | ||
} | ||
dm_active = dm_control & 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please suffix this constant with |
||
uint8_t counter = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would expect to see this defined just outside the Please suffix the initialiser and the comparison value with |
||
if (++counter >= 100) { | ||
DEBUG_ERROR("Timeout while trying to turn on DM\n"); | ||
return; | ||
} | ||
} | ||
|
||
if (!riscv_dmi_read(dmi, base_addr + RV_DM_STATUS, &dm_status)) { | ||
/* If we fail to read the status register, abort */ | ||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one still needs moving down to line 330 please 🙂