Skip to content

Conversation

@bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Jul 22, 2025

We'd love to use riscv-rt for ESP32-Cx / Hx - unfortunately C2 and C3 don't support the MIE/MIP CSRs.

This adds a feature "no-mie-mip" (which should fit the naming - e.g. "no-interrupts","no-exceptions")

@bjoernQ bjoernQ requested a review from a team as a code owner July 22, 2025 15:19
Copy link
Contributor

@rmsyn rmsyn left a comment

Choose a reason for hiding this comment

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

Is this only needed for the riscv-rt crate on the platforms you mention? For example, would we also want to remove the mie/mip modules in riscv::register?

Otherwise, LGTM.

@romancardenas
Copy link
Contributor

I don't think we need to remove registers from riscv. As long as you don't use it, it should be OK. Otherwise, we would also need to add numerous features for supervisor mode or other anomalies

Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

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

Thank you so much! For completeness, could you rename the feature to no-xie-xip and apply the same scheme for supervisor mode too?

u-boot = ["riscv-rt-macros/u-boot", "single-hart"]
no-interrupts = []
no-exceptions = []
no-mie-mip = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
no-mie-mip = []
no-xie-xip = []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure - that makes sense 👍

Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

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

LGTM! I sugggested a small update in the changelog to align with the new feature name

- New `#[riscv_rt::post_init]` attribute to aid in the definition of the `__post_init` function.
- Added `.uninit` section to the linker file. Due to its similarities with `.bss`, the
linker will place this new section in `REGION_BSS`.
- Additional feature `no-mie-mip` to work on chips without the MIE and MIP CSRs (e.g. ESP32-C2, ESP32-C3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Additional feature `no-mie-mip` to work on chips without the MIE and MIP CSRs (e.g. ESP32-C2, ESP32-C3)
- Additional feature `no-xie-xip` to work on chips without the XIE and XIP CSRs (e.g. ESP32-C2, ESP32-C3)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️ ofc ... sorry I missed that

Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you so much

@romancardenas romancardenas added this pull request to the merge queue Jul 23, 2025
Merged via the queue into rust-embedded:master with commit f81db37 Jul 23, 2025
139 checks passed
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.

3 participants