Skip to content

Commit

Permalink
Merge pull request #63 from SergioGasquez/feat/esp-hal-0.22
Browse files Browse the repository at this point in the history
Update to latest esp-hal releases
  • Loading branch information
bjoernQ authored Nov 22, 2024
2 parents db32095 + fb79223 commit 24a1789
Show file tree
Hide file tree
Showing 31 changed files with 1,328 additions and 611 deletions.
203 changes: 136 additions & 67 deletions advanced/stack-overflow-detection/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions advanced/stack-overflow-detection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
esp-hal = { version = "0.21.0", features = ["esp32c3"] }
esp-hal = { version = "0.22.0", features = ["esp32c3"] }
esp-backtrace = { version = "0.14.2", features = ["esp32c3", "panic-handler", "exception-handler", "println"] }
esp-println = { version = "0.12.0", features = ["esp32c3"] }
critical-section = "1.1.3"
critical-section = "1.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![no_main]

use core::cell::RefCell;
use core::ptr::addr_of_mut;

use critical_section::Mutex;
use esp_backtrace as _;
Expand Down Expand Up @@ -55,8 +56,9 @@ fn install_stack_guard(mut da: DebugAssist<'static>, safe_area_size: u32) {
static mut _stack_end: u32;
static mut _stack_start: u32;
}
let stack_low = unsafe { (&mut _stack_end as *mut _ as *mut u32) as u32 };
let stack_high = unsafe { (&mut _stack_start as *mut _ as *mut u32) as u32 };

let stack_low = unsafe { (addr_of_mut!(_stack_end) as *mut _ as *mut u32) as u32 };
let stack_high = unsafe { (addr_of_mut!(_stack_start) as *mut _ as *mut u32) as u32 };
println!(
"Safe stack {} bytes",
stack_high - stack_low - safe_area_size
Expand All @@ -79,7 +81,7 @@ fn interrupt_handler() {
let da = da.as_mut().unwrap();

if da.is_region0_monitor_interrupt_set() {
let pc = da.get_region_monitor_pc();
let pc = da.region_monitor_pc();
println!("PC = 0x{:x}", pc);
da.clear_region0_monitor_interrupt();
da.disable_region0_monitor();
Expand Down
1 change: 1 addition & 0 deletions advanced/stack-overflow-detection/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![no_main]

use core::cell::RefCell;
use core::ptr::addr_of_mut;

use critical_section::Mutex;
use esp_backtrace as _;
Expand Down
Loading

0 comments on commit 24a1789

Please sign in to comment.