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

Use settings.yaml with svd2rust for RISC-V devices #303

Closed
wants to merge 3 commits into from

Conversation

jessebraham
Copy link
Member

@jessebraham jessebraham commented Nov 28, 2024

Opening as draft as this is still incomplete, but will eventually close #297.

For the ESP32-C2 and ESP32-C3, I believe this should be relatively (or fully) complete, however it will require some review. Priority levels were stated in the TRM (though I'm not entirely sure if these should be 0- or 1-indexed). Core interrupts were taken from esp-riscv-rt, and I believe these should be correct.

The above also applies for the ESP32-C6 and ESP32-H2, though they are notably missing both the CLINT and PLIC sections in their respective settings.yaml files.

Copying blindly from greenlsi/e310x#1, I believe CLINT should be as simple as:

clint:
  name: "CLINT"
  freq: 32768
  async_delay: false

However, I'm unsure where this frequency comes from exactly; will required some investigation.

I tried adding the following for PLIC, but encountered some issues; it's been awhile, forget what exactly, but IIRC it was due to there being no PLIC peripheral in the PAC. Again, needs investigation.

plic:
  name: "PLIC"
  core_interrupt: "MachineExternal" 
  hart_id: "H0"

This changes the src/interrupts.rs file quite a bit, so I suppose additional changes will be required in esp-hal and/or esp-riscv-rt to reflect these.

@mchodzikiewicz
Copy link

mchodzikiewicz commented Nov 28, 2024

doing a quick search, in case of e310, freq comes from the RTC that is clocking CLINT
image

unfortunately I can't find a similar diagram for C6, but very likely this value is the freq of the clock source for MTIME register

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.

Use new svd2rust functionality targeted at RISC-V devices
2 participants