-
-
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
Conversation
Tested on BMA, after jtag_scan: ID code 0x00012c25: ESP32-P4 ID code 0x00012c25: ESP32-P4 RISC-V debug v0.13/v1.0 DMI RISC-V debug v0.13 DM Skipping hart 0 -> Unavailable RISC-V debug v0.13/v1.0 DMI
According to the RISC-V debug specification, DM must be turned on before accessing DM registers (like reading version of DM). This fixes attaching to the target.
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 is looking much better 🙂. We've left a review reply on #2063 for one of the notes but have otherwise done a fresh review here. We are satisfied with the items you've addressed and mostly the items here are for subtle bugs we spotted.
We look forward to this being sorted so we can schedule its merge into v2.1 when the merge window opens for that.
@@ -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; |
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 🙂
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Please suffix this constant with U
- this does a signed-unsigned conversion that can trigger UB otherwise during application of the mask operation (changing the sign bit on a signed number is not permitted for bitwise operations).
return; | ||
} | ||
dm_active = dm_control & 1; | ||
uint8_t counter = 0; |
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.
We would expect to see this defined just outside the while
loop on line 317 - otherwise it won't have the intended effect.
Please suffix the initialiser and the comparison value with U
to make them both unsigned.
Continuation of mistakenly closed #2063
Here is commit with start of support for ESP32-P4.
I have started working on flashing support but I need to shelve that plan for the time being.
I am pushing the things which seems to work - patch is rough, but more will hopefully come later.
Tested with BMA and ESP-prog (FT2232H) on FreeBSD with Waveshare ESP32-P4 board with flashed IDF example.
Works:
What doesn't work: