Remove unnecessary riscv::interrupt::enable() from examples (#936)

This commit is contained in:
Björn Quentin 2023-11-14 18:28:39 +01:00 committed by GitHub
parent 7084a380a6
commit 52da17075e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 51 additions and 137 deletions

View File

@ -13,7 +13,6 @@ use esp32c2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Rtc,
};
use esp_backtrace as _;
@ -46,10 +45,6 @@ fn main() -> ! {
RTC.borrow_ref_mut(cs).replace(rtc);
});
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -12,7 +12,6 @@ use esp32c2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
};
use esp_backtrace as _;
use esp_println::println;
@ -27,7 +26,17 @@ fn main() -> ! {
let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG);
da.enable_sp_monitor(0x3fccee00, 0x3fcd0000);
extern "C" {
// top of stack
static mut _stack_start: u32;
// bottom of stack
static mut _stack_end: u32;
}
let stack_top = unsafe { &mut _stack_start } as *mut _ as u32;
let stack_bottom = unsafe { &mut _stack_end } as *mut _ as u32;
da.enable_sp_monitor(stack_bottom + 4096, stack_top);
critical_section::with(|cs| DA.borrow_ref_mut(cs).replace(da));
@ -37,10 +46,6 @@ fn main() -> ! {
)
.unwrap();
unsafe {
riscv::interrupt::enable();
}
eat_up_stack(0);
loop {}

View File

@ -15,7 +15,6 @@ use esp32c2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Delay,
};
use esp_backtrace as _;
@ -40,10 +39,6 @@ fn main() -> ! {
interrupt::enable(peripherals::Interrupt::GPIO, interrupt::Priority::Priority3).unwrap();
unsafe {
riscv::interrupt::enable();
}
let mut delay = Delay::new(&clocks);
loop {
led.toggle().unwrap();

View File

@ -14,7 +14,6 @@ use esp32c2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Rtc,
Rwdt,
};
@ -40,10 +39,6 @@ fn main() -> ! {
critical_section::with(|cs| RWDT.borrow_ref_mut(cs).replace(rtc.rwdt));
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -13,7 +13,6 @@ use esp32c2_hal::{
interrupt,
peripherals::{self, Peripherals, UART0},
prelude::*,
riscv,
timer::TimerGroup,
uart::config::AtCmdConfig,
Cpu,
@ -54,10 +53,6 @@ fn main() -> ! {
interrupt::InterruptKind::Edge,
);
unsafe {
riscv::interrupt::enable();
}
loop {
critical_section::with(|cs| {
writeln!(SERIAL.borrow_ref_mut(cs).as_mut().unwrap(), "Hello World! Send a single `#` character or send at least 30 characters and see the interrupts trigger.").ok();

View File

@ -12,7 +12,6 @@ use esp32c2_hal::{
interrupt,
peripherals::{self, Peripherals, TIMG0},
prelude::*,
riscv,
timer::{Timer, Timer0, TimerGroup},
};
use esp_backtrace as _;
@ -40,10 +39,6 @@ fn main() -> ! {
TIMER0.borrow_ref_mut(cs).replace(timer0);
});
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -13,7 +13,6 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Rtc,
};
use esp_backtrace as _;
@ -46,10 +45,6 @@ fn main() -> ! {
RTC.borrow_ref_mut(cs).replace(rtc);
});
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -14,7 +14,6 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
};
use esp_backtrace as _;
use esp_println::println;
@ -29,11 +28,21 @@ fn main() -> ! {
let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG);
extern "C" {
// top of stack
static mut _stack_start: u32;
// bottom of stack
static mut _stack_end: u32;
}
let stack_top = unsafe { &mut _stack_start } as *mut _ as u32;
let stack_bottom = unsafe { &mut _stack_end } as *mut _ as u32;
// uncomment the functionality you want to test
// da.enable_sp_monitor(0x3fcce000, 0x3fccffff);
// da.enable_region0_monitor(0x3fcce000, 0x3fcce100, true, true);
da.enable_region1_monitor(0x3fcce000, 0x3fcce100, true, true);
da.enable_sp_monitor(stack_bottom + 4096, stack_top);
// da.enable_region0_monitor(stack_bottom, stack_bottom + 4096, true, true);
// da.enable_region1_monitor(stack_bottom, stack_bottom + 4096, true, true);
critical_section::with(|cs| DA.borrow_ref_mut(cs).replace(da));
@ -43,10 +52,6 @@ fn main() -> ! {
)
.unwrap();
unsafe {
riscv::interrupt::enable();
}
eat_up_stack(0);
loop {}

View File

@ -15,7 +15,6 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Delay,
};
use esp_backtrace as _;
@ -40,10 +39,6 @@ fn main() -> ! {
interrupt::enable(peripherals::Interrupt::GPIO, interrupt::Priority::Priority3).unwrap();
unsafe {
riscv::interrupt::enable();
}
let mut delay = Delay::new(&clocks);
loop {
led.toggle().unwrap();

View File

@ -14,7 +14,6 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Rtc,
Rwdt,
};
@ -40,10 +39,6 @@ fn main() -> ! {
critical_section::with(|cs| RWDT.borrow_ref_mut(cs).replace(rtc.rwdt));
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -13,7 +13,6 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals, UART0},
prelude::*,
riscv,
timer::TimerGroup,
uart::config::AtCmdConfig,
Cpu,
@ -54,10 +53,6 @@ fn main() -> ! {
interrupt::InterruptKind::Edge,
);
unsafe {
riscv::interrupt::enable();
}
loop {
critical_section::with(|cs| {
writeln!(SERIAL.borrow_ref_mut(cs).as_mut().unwrap(), "Hello World! Send a single `#` character or send at least 30 characters and see the interrupts trigger.").ok();

View File

@ -13,7 +13,6 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals, TIMG0, TIMG1},
prelude::*,
riscv,
timer::{Timer, Timer0, TimerGroup},
};
use esp_backtrace as _;
@ -53,10 +52,6 @@ fn main() -> ! {
TIMER1.borrow_ref_mut(cs).replace(timer1);
});
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -14,7 +14,6 @@ use esp32c3_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
timer::TimerGroup,
Cpu,
UsbSerialJtag,
@ -53,10 +52,6 @@ fn main() -> ! {
interrupt::InterruptKind::Edge,
);
unsafe {
riscv::interrupt::enable();
}
loop {
critical_section::with(|cs| {
writeln!(

View File

@ -14,7 +14,6 @@ use esp32c6_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
};
use esp_backtrace as _;
use esp_println::println;
@ -29,11 +28,21 @@ fn main() -> ! {
let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG);
extern "C" {
// top of stack
static mut _stack_start: u32;
// bottom of stack
static mut _stack_end: u32;
}
let stack_top = unsafe { &mut _stack_start } as *mut _ as u32;
let stack_bottom = unsafe { &mut _stack_end } as *mut _ as u32;
// uncomment the functionality you want to test
// da.enable_sp_monitor(0x4087ee00, 0x40880000);
// da.enable_region0_monitor(0x4087ee00, 0x4087ef00, true, true);
da.enable_region1_monitor(0x4087ee00, 0x4087ef00, true, true);
da.enable_sp_monitor(stack_bottom + 4096, stack_top);
// da.enable_region0_monitor(stack_bottom, stack_bottom + 4096, true, true);
// da.enable_region1_monitor(stack_bottom, stack_bottom + 4096, true, true);
critical_section::with(|cs| DA.borrow_ref_mut(cs).replace(da));
@ -43,10 +52,6 @@ fn main() -> ! {
)
.unwrap();
unsafe {
riscv::interrupt::enable();
}
eat_up_stack(0);
loop {}

View File

@ -15,7 +15,6 @@ use esp32c6_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Delay,
};
use esp_backtrace as _;
@ -40,10 +39,6 @@ fn main() -> ! {
interrupt::enable(peripherals::Interrupt::GPIO, interrupt::Priority::Priority3).unwrap();
unsafe {
riscv::interrupt::enable();
}
let mut delay = Delay::new(&clocks);
loop {
led.toggle().unwrap();

View File

@ -14,7 +14,6 @@ use esp32c6_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Rtc,
Rwdt,
};
@ -40,10 +39,6 @@ fn main() -> ! {
critical_section::with(|cs| RWDT.borrow_ref_mut(cs).replace(rtc.rwdt));
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -13,7 +13,6 @@ use esp32c6_hal::{
interrupt,
peripherals::{self, Peripherals, UART0},
prelude::*,
riscv,
timer::TimerGroup,
uart::config::AtCmdConfig,
Cpu,
@ -54,10 +53,6 @@ fn main() -> ! {
interrupt::InterruptKind::Edge,
);
unsafe {
riscv::interrupt::enable();
}
loop {
critical_section::with(|cs| {
writeln!(SERIAL.borrow_ref_mut(cs).as_mut().unwrap(), "Hello World! Send a single `#` character or send at least 30 characters and see the interrupts trigger.").ok();

View File

@ -13,7 +13,6 @@ use esp32c6_hal::{
interrupt,
peripherals::{self, Peripherals, TIMG0, TIMG1},
prelude::*,
riscv,
timer::{Timer, Timer0, TimerGroup},
};
use esp_backtrace as _;
@ -57,10 +56,6 @@ fn main() -> ! {
TIMER1.borrow_ref_mut(cs).replace(timer1);
});
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -13,7 +13,6 @@ use esp32c6_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
timer::TimerGroup,
Cpu,
UsbSerialJtag,
@ -52,10 +51,6 @@ fn main() -> ! {
interrupt::InterruptKind::Edge,
);
unsafe {
riscv::interrupt::enable();
}
loop {
critical_section::with(|cs| {
writeln!(

View File

@ -14,7 +14,6 @@ use esp32h2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
};
use esp_backtrace as _;
use esp_println::println;
@ -29,19 +28,28 @@ fn main() -> ! {
let mut da = DebugAssist::new(peripherals.ASSIST_DEBUG);
// Uncomment the functionality you want to test
// We use a 0x1200 wide SP and 0x100 regions, and RAM ends at 0x40850000
extern "C" {
// top of stack
static mut _stack_start: u32;
// bottom of stack
static mut _stack_end: u32;
}
let stack_top = unsafe { &mut _stack_start } as *mut _ as u32;
let stack_bottom = unsafe { &mut _stack_end } as *mut _ as u32;
// uncomment the functionality you want to test
// Monitor the SP so as to prevent stack overflow or erroneous push/pop. When
// the SP exceeds the minimum or maximum threshold, the module will record the
// PC pointer and generate an interrupt
// da.enable_sp_monitor(0x4084ee00, 0x40850000);
da.enable_sp_monitor(stack_bottom + 4096, stack_top);
// Monitor reads/writes performed by the CPU over data bus and peripheral bus
// in a certain address space, i.e., memory region. Whenever the bus reads or
// writes in the specified address space, an interrupt will be triggered
// da.enable_region0_monitor(0x4084ee00, 0x4084ef00, true, true);
da.enable_region1_monitor(0x4084ee00, 0x4084ef00, true, true);
// da.enable_region0_monitor(stack_bottom, stack_bottom + 4096, true, true);
// da.enable_region1_monitor(stack_bottom, stack_bottom + 4096, true, true);
critical_section::with(|cs| DA.borrow_ref_mut(cs).replace(da));
@ -51,10 +59,6 @@ fn main() -> ! {
)
.unwrap();
unsafe {
riscv::interrupt::enable();
}
eat_up_stack(0);
loop {}

View File

@ -15,7 +15,6 @@ use esp32h2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Delay,
};
use esp_backtrace as _;
@ -40,10 +39,6 @@ fn main() -> ! {
interrupt::enable(peripherals::Interrupt::GPIO, interrupt::Priority::Priority3).unwrap();
unsafe {
riscv::interrupt::enable();
}
let mut delay = Delay::new(&clocks);
loop {
led.toggle().unwrap();

View File

@ -14,7 +14,6 @@ use esp32h2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
Rtc,
Rwdt,
};
@ -40,10 +39,6 @@ fn main() -> ! {
critical_section::with(|cs| RWDT.borrow_ref_mut(cs).replace(rtc.rwdt));
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -13,7 +13,6 @@ use esp32h2_hal::{
interrupt,
peripherals::{self, Peripherals, UART0},
prelude::*,
riscv,
timer::TimerGroup,
uart::config::AtCmdConfig,
Cpu,
@ -54,10 +53,6 @@ fn main() -> ! {
interrupt::InterruptKind::Edge,
);
unsafe {
riscv::interrupt::enable();
}
loop {
critical_section::with(|cs| {
writeln!(SERIAL.borrow_ref_mut(cs).as_mut().unwrap(), "Hello World! Send a single `#` character or send at least 30 characters and see the interrupts trigger.").ok();

View File

@ -13,7 +13,6 @@ use esp32h2_hal::{
interrupt,
peripherals::{self, Peripherals, TIMG0, TIMG1},
prelude::*,
riscv,
timer::{Timer, Timer0, TimerGroup},
};
use esp_backtrace as _;
@ -57,10 +56,6 @@ fn main() -> ! {
TIMER1.borrow_ref_mut(cs).replace(timer1);
});
unsafe {
riscv::interrupt::enable();
}
loop {}
}

View File

@ -13,7 +13,6 @@ use esp32h2_hal::{
interrupt,
peripherals::{self, Peripherals},
prelude::*,
riscv,
timer::TimerGroup,
Cpu,
UsbSerialJtag,
@ -52,10 +51,6 @@ fn main() -> ! {
interrupt::InterruptKind::Edge,
);
unsafe {
riscv::interrupt::enable();
}
loop {
critical_section::with(|cs| {
writeln!(