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

OpenOCD target for ESP32-C6 is missing RISC-V CSRs (IDFGH-12420) (OCD-930) #320

Closed
3 tasks done
robotman2412 opened this issue Mar 21, 2024 · 6 comments
Closed
3 tasks done

Comments

@robotman2412
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

For low-level debugging purposes, I would like to be able to read RISC-V CSRs like mie and mip. Unfortunately, the esp32c6-builtin.cfg target does not expose these CSRs.

I need to be able to access the following CSRs:

  • medeleg
  • mideleg
  • mie
  • mip
  • mtinst
  • mvendorid
  • marchid
  • mimpid
  • mhartid

These CSRs exist in any RISC-V core and I need to see them but they're not available either through GDB or directly with monitor commands.

@github-actions github-actions bot changed the title OpenOCD target for ESP32-C6 is missing RISC-V CSRs OpenOCD target for ESP32-C6 is missing RISC-V CSRs (IDFGH-12420) Mar 21, 2024
@igrr igrr transferred this issue from espressif/esp-idf Mar 21, 2024
@github-actions github-actions bot changed the title OpenOCD target for ESP32-C6 is missing RISC-V CSRs (IDFGH-12420) OpenOCD target for ESP32-C6 is missing RISC-V CSRs (IDFGH-12420) (OCD-930) Mar 21, 2024
@igrr
Copy link
Member

igrr commented Mar 21, 2024

Some of these CSRs don't seem to exist in ESP32-C6 (referring to the TRM), but we'll add those which do!

@erhankur
Copy link
Collaborator

@robotman2412 Thanks for reporting this. I will be looking at the missing registers. Some of them are read only. We will need to add a flag to disable store/restore option during the algorithm run.

@erhankur
Copy link
Collaborator

erhankur commented Apr 3, 2024

@robotman2412 I am adding the missing regs which are mentioned in the TRM.

mvendorid
marchid
mimpid
mhartid
mideleg
mie
mip

The others (medeleg, mtinst) are not documented so I am leaving them out.

@erhankur
Copy link
Collaborator

erhankur commented Apr 4, 2024

Completed via 15867d6

@erhankur erhankur closed this as completed Apr 4, 2024
@robotman2412
Copy link
Author

@robotman2412 I am adding the missing regs which are mentioned in the TRM.

mvendorid
marchid
mimpid
mhartid
mideleg
mie
mip

The others (medeleg, mtinst) are not documented so I am leaving them out.

Actually, according to the RISC-V privileged specification, medeleg is necessarily present if a lower privilege mode can handle traps, and the ESP32-C6 has a CPU that can delegate interrupts and exceptions to U-mode.

If mideleg exists, then medeleg does too and I have verified this by writing assembly that accesses the medeleg CSR.

@erhankur
Copy link
Collaborator

@robotman2412 you are right. I have added the medeleg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants