Skip to content

Commit f81db37

Browse files
Merge pull request #332 from bjoernQ/support-chips-wo-mie-mip
Support chips which don't support MIE/MIP CSRs
2 parents c8c0bba + c609929 commit f81db37

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

riscv-rt/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313
- New `#[riscv_rt::post_init]` attribute to aid in the definition of the `__post_init` function.
1414
- Added `.uninit` section to the linker file. Due to its similarities with `.bss`, the
1515
linker will place this new section in `REGION_BSS`.
16+
- Additional feature `no-xie-xip` to work on chips without the XIE and XIP CSRs (e.g. ESP32-C2, ESP32-C3)
1617

1718
### Changed
1819

riscv-rt/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ v-trap = ["riscv-rt-macros/v-trap"]
4040
u-boot = ["riscv-rt-macros/u-boot", "single-hart"]
4141
no-interrupts = []
4242
no-exceptions = []
43+
no-xie-xip = []
4344
device = []
4445
memory = []

riscv-rt/src/asm.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ _abs_start:
6565
.cfi_startproc
6666
.cfi_undefined ra",
6767
// Disable interrupts
68-
#[cfg(feature = "s-mode")]
68+
#[cfg(all(feature = "s-mode", not(feature = "no-xie-xip")))]
6969
"csrw sie, 0
7070
csrw sip, 0",
71-
#[cfg(not(feature = "s-mode"))]
71+
#[cfg(all(not(feature = "s-mode"), not(feature = "no-xie-xip")))]
7272
"csrw mie, 0
73-
csrw mip, 0
74-
csrr a0, mhartid", // Make sure that the hart ID is in a0 in M-mode
73+
csrw mip, 0",
74+
#[cfg(not(feature = "s-mode"))]
75+
"csrr a0, mhartid", // Make sure that the hart ID is in a0 in M-mode
7576
// Set pre-init trap vector
7677
"la t0, _pre_init_trap",
7778
#[cfg(feature = "s-mode")]

0 commit comments

Comments
 (0)