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

fix(threads): xtensa: fix enabling scheduling interrupt #480

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/riot-rs-embassy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ wifi = []
wifi-cyw43 = ["riot-rs-rp/wifi-cyw43", "net", "wifi"]
wifi-esp = ["riot-rs-esp/wifi-esp", "net", "wifi"]

threading = ["dep:riot-rs-threads"]
threading = ["dep:riot-rs-threads", "riot-rs-esp/threading"]
override-network-config = []
override-usb-config = []

Expand Down
3 changes: 3 additions & 0 deletions src/riot-rs-esp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ i2c = [
## Enables defmt support.
defmt = ["dep:defmt", "esp-wifi?/defmt", "fugit?/defmt"]

## Enables threading support.
threading = []

## Enables Wi-Fi support.
wifi = []

Expand Down
14 changes: 14 additions & 0 deletions src/riot-rs-esp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ pub use esp_hal_embassy::Executor;
pub fn init() -> OptionalPeripherals {
let mut peripherals = OptionalPeripherals::from(esp_hal::init(esp_hal::Config::default()));

#[cfg(feature = "threading")]
{
use esp_hal::{interrupt, peripherals::Interrupt};
// Since https://github.com/esp-rs/esp-hal/pull/2091,
// `esp_hal::init()` resets all interrupts.
// That also disables our scheduler interrupt, which was previously enabled
// in `riot_rs_threads::arch::xtensa`.
// So, re-enable it here.

// Panics if `FROM_CPU_INTR1` is among `esp_hal::interrupt::RESERVED_INTERRUPTS`,
// which isn't the case.
interrupt::enable(Interrupt::FROM_CPU_INTR1, interrupt::Priority::min()).unwrap();
}

#[cfg(feature = "wifi-esp")]
{
use esp_hal::timer::timg::TimerGroup;
Expand Down
Loading