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

Add u-mode feature #7

Merged
merged 1 commit into from
Oct 31, 2024
Merged

Add u-mode feature #7

merged 1 commit into from
Oct 31, 2024

Conversation

ExplodingWaffle
Copy link
Contributor

Adds a new cargo feature u-mode to qingke-rt. This chooses if main is ran at privilege mode M or U.

This does change the default behaviour to M (cooould change this), but the only thing U-mode would stop is, in main/thread mode only (wouldn't do anything to stop ISRs which always run in M-mode) an M-mode CSR access or M-mode instruction like MRET, but these are unsafe already. Also, Qingke V2 never had U-mode to begin with.

My usecase is for a bootloader where mstatus and MRET are used in order to jump to the application while disabling interrupts sort of like the reset handler does, so it has to run in M-mode.

Copy link
Contributor

@andelf andelf left a comment

Choose a reason for hiding this comment

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

Looks good

@andelf andelf requested a review from Codetector1374 October 31, 2024 16:00
// Qingke V2A, V2C
// (does not have user mode)
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking: build.rs can be used to check illegal feature combinations. I don't know if static_assert is avaliable.

@Codetector1374 Codetector1374 merged commit 83fc3b7 into ch32-rs:main Oct 31, 2024
1 check 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