-
Notifications
You must be signed in to change notification settings - Fork 226
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
RISCV: remove the direct-vectoring
& interrupt-preemption
features and enable them by default
#1310
RISCV: remove the direct-vectoring
& interrupt-preemption
features and enable them by default
#1310
Conversation
@bjoernQ I know we're not really looking P4 support right now, but do you know if this is going to be viable for the P4? |
71c8033
to
016cba3
Compare
Vectored interrupts are definitely supported. t.b.h. I don't recall why I omitted dirtect-vectoring support for P4 initially but shouldn't be a huge problem to implement it |
I like removing features, so I've made an executive to cut out interrupt-preemption for riscv and enable it by default. This matches the same behaviour as Xtensa by default, so I think it's a good change all around. You can test the behaviour of both arches with the interrupt preemption example. |
1f7bba7
to
52d84c7
Compare
I ended up doing a couple of changes to Xtensa too, just to being the APIs in line with each other (they're still different and can't be shared, but they have the same capabilities). Overall I'm quite happy with how this ended up. I just need to test the latency effects and @bjoernQ if you could show me or test yourself the This is now read for review. |
I tested this with esp-wifi and after the necessary adjustments it seems to still work on C3, C6 and S3. To test the |
direct-vectoring
feature and enable it by defaultdirect-vectoring
& interrupt-preemption
features and enable them by default
Ok seems There is also a problem enabling "flip-link" in build.rs - but that was already broken before this PR. We need a ".to_string()" there. To reproduce I changed //! This shows how to write text to UART0.
//!
//! You can see the output with `espflash` if you provide the `--monitor`
//! option.
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
//% FEATURES: embedded-hal-02
#![no_std]
#![no_main]
use core::fmt::Write;
use embedded_hal_02::timer::CountDown;
use esp_backtrace as _;
use esp_hal::{
clock::ClockControl,
peripherals::Peripherals,
prelude::*,
timer::TimerGroup,
uart::Uart,
};
use nb::block;
use esp_println::println;
#[entry]
fn main() -> ! {
let peripherals = Peripherals::take();
let system = peripherals.SYSTEM.split();
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
let timg0 = TimerGroup::new(peripherals.TIMG0, &clocks);
let mut timer0 = timg0.timer0;
timer0.start(1u64.secs());
let mut uart0 = Uart::new(peripherals.UART0, &clocks);
boom();
loop {
writeln!(uart0, "Hello world!").unwrap();
block!(timer0.wait()).unwrap();
}
}
#[inline(never)]
fn boom() {
deadly_recursion([0u8; 2048]);
}
#[ram]
#[allow(unconditional_recursion)]
fn deadly_recursion(data: [u8; 2048]) {
static mut COUNTER: u32 = 0;
println!(
"Iteration {}, data {:02x?}...",
unsafe { COUNTER },
&data[0..10]
);
unsafe {
COUNTER = COUNTER.wrapping_add(1);
};
deadly_recursion([0u8; 2048]);
} And enabled |
Thanks to @bjoernQ's test configuration, I measured the interrupt latency on main and this PR:
I'm pleased about that! |
Thanks for testing fix-sp, I'll look into fixing that tomorrow. |
direct-vectoring
& interrupt-preemption
features and enable them by defaultdirect-vectoring
& interrupt-preemption
features and enable them by default
Fix-sp/flip-link feature should be working now! I had the code in the wrong place, it should be before we modify the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - nice improvement!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for doing this!
* Enables the feature by default * renames the old direct_vectoring enable function `enable_direct`
c1315c7
to
7917640
Compare
Looks like there are some missing imports still |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you once again for tackling this! 😁
GHA why are you like this ;_; |
…s and enable them by default (esp-rs#1310) * Remove the `direct-vectoring` feature * Enables the feature by default * renames the old direct_vectoring enable function `enable_direct` * Make enable_direct safe, move it out of vectored module * enable interrupt preemption by default for riscv * remove pub from cpu intr handlers * add enable_direct for Xtensa too * Fix flip-link feature * Fix up interrupt docs * changelog * fix clippy suggestions * Disable P4 workflow
…s and enable them by default (esp-rs#1310) * Remove the `direct-vectoring` feature * Enables the feature by default * renames the old direct_vectoring enable function `enable_direct` * Make enable_direct safe, move it out of vectored module * enable interrupt preemption by default for riscv * remove pub from cpu intr handlers * add enable_direct for Xtensa too * Fix flip-link feature * Fix up interrupt docs * changelog * fix clippy suggestions * Disable P4 workflow
This is an attempt to try and solve #1246
enable_direct
TODO
enable_direct
a good name? Maybe we just remove this method completely, it's possible to "build" this function using the other methods availablevectored
feature, we still have some CPU interrupts free which users can use directly if they wish.