diff --git a/esp-hal-common/Cargo.toml b/esp-hal-common/Cargo.toml index c59e662b0..f9ded3cf5 100644 --- a/esp-hal-common/Cargo.toml +++ b/esp-hal-common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp-hal-common" -version = "0.5.0" +version = "0.6.0" authors = [ "Jesse Braham ", "Björn Quentin ", @@ -24,7 +24,7 @@ fugit = "0.3.6" lock_api = { version = "0.4.9", optional = true } nb = "1.0.0" paste = "1.0.11" -procmacros = { version = "0.2.0", package = "esp-hal-procmacros", path = "../esp-hal-procmacros" } +procmacros = { version = "0.3.0", package = "esp-hal-procmacros", path = "../esp-hal-procmacros" } strum = { version = "0.24.1", default-features = false, features = ["derive"] } void = { version = "1.0.2", default-features = false } usb-device = { version = "0.2.9", optional = true } @@ -40,8 +40,8 @@ esp-riscv-rt = { version = "0.1.0", optional = true } riscv-atomic-emulation-trap = { version = "0.4.0", optional = true } # Xtensa -xtensa-lx = { version = "0.7.0", optional = true } -xtensa-lx-rt = { version = "0.14.0", optional = true } +xtensa-lx = { version = "0.8.0", optional = true } +xtensa-lx-rt = { version = "0.15.0", optional = true } # Smart-LED (e.g., WS2812/SK68XX) support smart-leds-trait = { version = "0.2.1", optional = true } @@ -53,18 +53,18 @@ ufmt-write = { version = "0.1.0", optional = true } # Each supported device MUST have its PAC included below along with a # corresponding feature. We rename the PAC packages because we cannot # have dependencies and features with the same names. -esp32 = { version = "0.19.0", features = ["critical-section"], optional = true } -esp32c2 = { version = "0.7.0", features = ["critical-section"], optional = true } -esp32c3 = { version = "0.10.0", features = ["critical-section"], optional = true } -esp32s2 = { version = "0.10.0", features = ["critical-section"], optional = true } -esp32s3 = { version = "0.13.0", features = ["critical-section"], optional = true } +esp32 = { version = "0.21.0", features = ["critical-section"], optional = true } +esp32c2 = { version = "0.8.0", features = ["critical-section"], optional = true } +esp32c3 = { version = "0.11.0", features = ["critical-section"], optional = true } +esp32s2 = { version = "0.12.0", features = ["critical-section"], optional = true } +esp32s3 = { version = "0.15.0", features = ["critical-section"], optional = true } [features] -esp32 = ["esp32/rt" , "xtensa", "xtensa-lx/esp32", "xtensa-lx-rt/esp32", "lock_api"] -esp32c2 = ["esp32c2/rt", "riscv"] -esp32c3 = ["esp32c3/rt", "riscv"] -esp32s2 = ["esp32s2/rt", "xtensa", "xtensa-lx/esp32s2", "xtensa-lx-rt/esp32s2", "esp-synopsys-usb-otg", "usb-device"] -esp32s3 = ["esp32s3/rt", "xtensa", "xtensa-lx/esp32s3", "xtensa-lx-rt/esp32s3", "lock_api", "esp-synopsys-usb-otg", "usb-device"] +esp32 = ["esp32/rt" , "xtensa", "xtensa-lx/esp32", "xtensa-lx-rt/esp32", "lock_api", "procmacros/esp32"] +esp32c2 = ["esp32c2/rt", "riscv", "procmacros/esp32c2"] +esp32c3 = ["esp32c3/rt", "riscv", "procmacros/esp32c3"] +esp32s2 = ["esp32s2/rt", "xtensa", "xtensa-lx/esp32s2", "xtensa-lx-rt/esp32s2", "esp-synopsys-usb-otg", "usb-device", "procmacros/esp32s2"] +esp32s3 = ["esp32s3/rt", "xtensa", "xtensa-lx/esp32s3", "xtensa-lx-rt/esp32s3", "lock_api", "esp-synopsys-usb-otg", "usb-device", "procmacros/esp32s3"] esp32c2_40mhz = [] esp32c2_26mhz = [] diff --git a/esp-hal-common/src/lib.rs b/esp-hal-common/src/lib.rs index 1fec8139f..1618c6938 100644 --- a/esp-hal-common/src/lib.rs +++ b/esp-hal-common/src/lib.rs @@ -31,7 +31,27 @@ #[cfg_attr(esp32s3, path = "peripherals/esp32s3.rs")] pub mod peripherals; +#[cfg(riscv)] +pub use esp_riscv_rt; +#[cfg(riscv)] +pub use esp_riscv_rt::entry; +#[cfg(riscv)] +pub use esp_riscv_rt::riscv; pub use procmacros as macros; +#[cfg(xtensa)] +pub use xtensa_lx; +#[cfg(xtensa)] +pub use xtensa_lx_rt; +#[cfg(xtensa)] +pub use xtensa_lx_rt::entry; + +/// State of the CPU saved when entering exception or interrupt +pub mod trapframe { + #[cfg(riscv)] + pub use esp_riscv_rt::TrapFrame; + #[cfg(xtensa)] + pub use xtensa_lx_rt::exception::Context as TrapFrame; +} #[cfg(rmt)] pub use self::pulse_control::PulseControl; diff --git a/esp-hal-common/src/prelude.rs b/esp-hal-common/src/prelude.rs index 93b82971a..0f2770db3 100644 --- a/esp-hal-common/src/prelude.rs +++ b/esp-hal-common/src/prelude.rs @@ -37,6 +37,7 @@ pub use crate::{ DmaTransfer as _esp_hal_dma_DmaTransfer, DmaTransferRxTx as _esp_hal_dma_DmaTransferRxTx, }, + entry, gpio::{ InputPin as _esp_hal_gpio_InputPin, OutputPin as _esp_hal_gpio_OutputPin, diff --git a/esp-hal-procmacros/Cargo.toml b/esp-hal-procmacros/Cargo.toml index f10f68343..d345e4f1c 100644 --- a/esp-hal-procmacros/Cargo.toml +++ b/esp-hal-procmacros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp-hal-procmacros" -version = "0.2.0" +version = "0.3.0" authors = [ "Jesse Braham ", "Björn Quentin ", @@ -20,9 +20,15 @@ proc-macro-error = "1.0.4" proc-macro2 = "1.0.50" quote = "1.0.23" syn = {version = "1.0.107", features = ["extra-traits", "full"]} +proc-macro-crate = "1.3.0" [features] interrupt = [] riscv = [] rtc_slow = [] xtensa = [] +esp32 = [] +esp32c2 = [] +esp32c3 = [] +esp32s2 = [] +esp32s3 = [] diff --git a/esp-hal-procmacros/src/lib.rs b/esp-hal-procmacros/src/lib.rs index 25c3f5d10..73c385c09 100644 --- a/esp-hal-procmacros/src/lib.rs +++ b/esp-hal-procmacros/src/lib.rs @@ -134,6 +134,8 @@ pub fn ram(args: TokenStream, input: TokenStream) -> TokenStream { #[cfg(feature = "interrupt")] #[proc_macro_attribute] pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream { + use proc_macro_crate::{crate_name, FoundCrate}; + let mut f: ItemFn = syn::parse(input).expect("`#[interrupt]` must be applied to a function"); let attr_args = parse_macro_input!(args as AttributeArgs); @@ -200,10 +202,46 @@ pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream { &format!("__esp_hal_internal_{}", f.sig.ident), proc_macro2::Span::call_site(), ); + + #[cfg(feature = "esp32")] + let hal_crate = crate_name("esp32-hal"); + #[cfg(feature = "esp32s2")] + let hal_crate = crate_name("esp32s2-hal"); + #[cfg(feature = "esp32s3")] + let hal_crate = crate_name("esp32s3-hal"); + #[cfg(feature = "esp32c2")] + let hal_crate = crate_name("esp32c2-hal"); + #[cfg(feature = "esp32c3")] + let hal_crate = crate_name("esp32c3-hal"); + + #[cfg(feature = "esp32")] + let hal_crate_name = Ident::new("esp32_hal", Span::call_site().into()); + #[cfg(feature = "esp32s2")] + let hal_crate_name = Ident::new("esp32s2_hal", Span::call_site().into()); + #[cfg(feature = "esp32s3")] + let hal_crate_name = Ident::new("esp32s3_hal", Span::call_site().into()); + #[cfg(feature = "esp32c2")] + let hal_crate_name = Ident::new("esp32c2_hal", Span::call_site().into()); + #[cfg(feature = "esp32c3")] + let hal_crate_name = Ident::new("esp32c3_hal", Span::call_site().into()); + + let interrupt_in_hal_crate = match hal_crate { + Ok(FoundCrate::Itself) => { + quote!( #hal_crate_name::peripherals::Interrupt::#ident_s ) + } + Ok(FoundCrate::Name(ref name)) => { + let ident = Ident::new(&name, Span::call_site().into()); + quote!( #ident::peripherals::Interrupt::#ident_s ) + } + Err(_) => { + quote!( crate::peripherals::Interrupt::#ident_s ) + } + }; + f.block.stmts.extend(std::iter::once( syn::parse2(quote! {{ // Check that this interrupt actually exists - crate::peripherals::Interrupt::#ident_s; + #interrupt_in_hal_crate; }}) .unwrap(), )); @@ -218,25 +256,34 @@ pub fn interrupt(args: TokenStream, input: TokenStream) -> TokenStream { let export_name = ident_s.to_string(); - #[cfg(feature = "xtensa")] - let context = quote! { - xtensa_lx_rt::exception::Context - }; - - #[cfg(feature = "riscv")] - let context = quote! { - crate::interrupt::TrapFrame + let trap_frame_in_hal_crate = match hal_crate { + Ok(FoundCrate::Itself) => { + quote!(#hal_crate_name::trapframe::TrapFrame) + } + Ok(FoundCrate::Name(ref name)) => { + let ident = Ident::new(&name, Span::call_site().into()); + quote!( #ident::trapframe::TrapFrame ) + } + Err(_) => { + quote!(crate::trapframe::TrapFrame) + } }; let context_call = (f.sig.inputs.len() == 1).then(|| Ident::new("context", proc_macro2::Span::call_site())); quote!( + macro_rules! foo { + () => { + }; + } + foo!(); + #(#cfgs)* #(#attrs)* #[doc(hidden)] #[export_name = #export_name] - pub unsafe extern "C" fn #tramp_ident(context: &mut #context) { + pub unsafe extern "C" fn #tramp_ident(context: &mut #trap_frame_in_hal_crate) { #ident( #context_call ) diff --git a/esp32-hal/Cargo.toml b/esp32-hal/Cargo.toml index 538d4fe6a..8dd8cd091 100644 --- a/esp32-hal/Cargo.toml +++ b/esp32-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp32-hal" -version = "0.8.0" +version = "0.9.0" authors = [ "Jesse Braham ", "Björn Quentin ", @@ -30,15 +30,13 @@ embedded-hal = { version = "0.2.7", features = ["unproven"] } embedded-hal-1 = { version = "=1.0.0-alpha.9", optional = true, package = "embedded-hal" } embedded-hal-async = { version = "0.2.0-alpha.0", optional = true } embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true } -esp-hal-common = { version = "0.5.0", features = ["esp32"], path = "../esp-hal-common" } -xtensa-lx = { version = "0.7.0", features = ["esp32"] } -xtensa-lx-rt = { version = "0.14.0", features = ["esp32"], optional = true } +esp-hal-common = { version = "0.6.0", features = ["esp32"], path = "../esp-hal-common" } [dev-dependencies] critical-section = "1.1.1" embassy-executor = { package = "embassy-executor", git = "https://github.com/embassy-rs/embassy/", rev = "cd9a65b", features = ["nightly", "integrated-timers"] } embedded-graphics = "0.7.1" -esp-backtrace = { version = "0.4.0", features = ["esp32", "panic-handler", "exception-handler", "print-uart"] } +esp-backtrace = { version = "0.5.0", features = ["esp32", "panic-handler", "exception-handler", "print-uart"] } esp-println = { version = "0.3.1", features = ["esp32"] } sha2 = { version = "0.10.6", default-features = false} smart-leds = "0.3.0" @@ -50,7 +48,7 @@ aes = "0.8.2" default = ["rt", "vectored"] bluetooth = [] eh1 = ["esp-hal-common/eh1", "dep:embedded-hal-1", "dep:embedded-hal-nb"] -rt = ["xtensa-lx-rt/esp32"] +rt = [] smartled = ["esp-hal-common/smartled"] ufmt = ["esp-hal-common/ufmt"] vectored = ["esp-hal-common/vectored"] diff --git a/esp32-hal/examples/adc.rs b/esp32-hal/examples/adc.rs index 3d30252bf..e0d4cfc2e 100644 --- a/esp32-hal/examples/adc.rs +++ b/esp32-hal/examples/adc.rs @@ -17,7 +17,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/advanced_serial.rs b/esp32-hal/examples/advanced_serial.rs index c162fcf83..df97e4212 100644 --- a/esp32-hal/examples/advanced_serial.rs +++ b/esp32-hal/examples/advanced_serial.rs @@ -23,7 +23,6 @@ use esp32_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/aes.rs b/esp32-hal/examples/aes.rs index 877b84394..73f9069ff 100644 --- a/esp32-hal/examples/aes.rs +++ b/esp32-hal/examples/aes.rs @@ -10,12 +10,13 @@ use esp32_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + xtensa_lx, Rtc, }; use esp_backtrace as _; use esp_println::println; -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.DPORT.split(); diff --git a/esp32-hal/examples/blinky.rs b/esp32-hal/examples/blinky.rs index 6f772da01..d3ae25e5f 100644 --- a/esp32-hal/examples/blinky.rs +++ b/esp32-hal/examples/blinky.rs @@ -15,7 +15,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/blinky_erased_pins.rs b/esp32-hal/examples/blinky_erased_pins.rs index b77434999..adb795eda 100644 --- a/esp32-hal/examples/blinky_erased_pins.rs +++ b/esp32-hal/examples/blinky_erased_pins.rs @@ -15,7 +15,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/clock_monitor.rs b/esp32-hal/examples/clock_monitor.rs index ce0038ef3..280d35c34 100644 --- a/esp32-hal/examples/clock_monitor.rs +++ b/esp32-hal/examples/clock_monitor.rs @@ -16,7 +16,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; static RTC: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32-hal/examples/dac.rs b/esp32-hal/examples/dac.rs index e2a6465e0..7e3c42d16 100644 --- a/esp32-hal/examples/dac.rs +++ b/esp32-hal/examples/dac.rs @@ -16,7 +16,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/embassy_hello_world.rs b/esp32-hal/examples/embassy_hello_world.rs index 4f267293b..65eff0f15 100644 --- a/esp32-hal/examples/embassy_hello_world.rs +++ b/esp32-hal/examples/embassy_hello_world.rs @@ -38,7 +38,7 @@ async fn run2() { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32-hal/examples/embassy_spi.rs b/esp32-hal/examples/embassy_spi.rs index 213a11702..429025c9c 100644 --- a/esp32-hal/examples/embassy_spi.rs +++ b/esp32-hal/examples/embassy_spi.rs @@ -57,7 +57,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32-hal/examples/embassy_wait.rs b/esp32-hal/examples/embassy_wait.rs index 2abbb42d3..54f29649d 100644 --- a/esp32-hal/examples/embassy_wait.rs +++ b/esp32-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio0>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32-hal/examples/gpio_interrupt.rs b/esp32-hal/examples/gpio_interrupt.rs index a76405f33..1f4f371bd 100644 --- a/esp32-hal/examples/gpio_interrupt.rs +++ b/esp32-hal/examples/gpio_interrupt.rs @@ -17,11 +17,11 @@ use esp32_hal::{ peripherals::{self, Peripherals}, prelude::*, timer::TimerGroup, + xtensa_lx, Delay, Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; static BUTTON: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32-hal/examples/hello_rgb.rs b/esp32-hal/examples/hello_rgb.rs index 2bb5c3360..3650dfc7f 100644 --- a/esp32-hal/examples/hello_rgb.rs +++ b/esp32-hal/examples/hello_rgb.rs @@ -32,7 +32,6 @@ use smart_leds::{ hsv::{hsv2rgb, Hsv}, SmartLedsWrite, }; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/hello_world.rs b/esp32-hal/examples/hello_world.rs index 74a162eb3..b177ccf57 100644 --- a/esp32-hal/examples/hello_world.rs +++ b/esp32-hal/examples/hello_world.rs @@ -16,7 +16,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/i2c_bmp180_calibration_data.rs b/esp32-hal/examples/i2c_bmp180_calibration_data.rs index e25a47b3d..88d8667aa 100644 --- a/esp32-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32-hal/examples/i2c_bmp180_calibration_data.rs @@ -20,7 +20,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/i2c_display.rs b/esp32-hal/examples/i2c_display.rs index 34c7bfb09..dccf4ba7f 100644 --- a/esp32-hal/examples/i2c_display.rs +++ b/esp32-hal/examples/i2c_display.rs @@ -31,7 +31,6 @@ use esp32_hal::{ use esp_backtrace as _; use nb::block; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/i2s_read.rs b/esp32-hal/examples/i2s_read.rs index 5ff4e243c..bde777f35 100644 --- a/esp32-hal/examples/i2s_read.rs +++ b/esp32-hal/examples/i2s_read.rs @@ -26,7 +26,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/i2s_sound.rs b/esp32-hal/examples/i2s_sound.rs index 0a5afbfae..7e22767cb 100644 --- a/esp32-hal/examples/i2s_sound.rs +++ b/esp32-hal/examples/i2s_sound.rs @@ -41,7 +41,6 @@ use esp32_hal::{ IO, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; const SINE: [i16; 64] = [ 0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244, 28897, 30272, 31356, diff --git a/esp32-hal/examples/ledc.rs b/esp32-hal/examples/ledc.rs index 6c5b2c82a..1e9b8a703 100644 --- a/esp32-hal/examples/ledc.rs +++ b/esp32-hal/examples/ledc.rs @@ -21,7 +21,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/mcpwm.rs b/esp32-hal/examples/mcpwm.rs index 0c355e08c..2225b3b77 100644 --- a/esp32-hal/examples/mcpwm.rs +++ b/esp32-hal/examples/mcpwm.rs @@ -16,7 +16,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/multicore.rs b/esp32-hal/examples/multicore.rs index 358c71cb4..752caef4a 100644 --- a/esp32-hal/examples/multicore.rs +++ b/esp32-hal/examples/multicore.rs @@ -19,7 +19,6 @@ use esp32_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/pcnt_encoder.rs b/esp32-hal/examples/pcnt_encoder.rs index 819e03128..22b93aa52 100644 --- a/esp32-hal/examples/pcnt_encoder.rs +++ b/esp32-hal/examples/pcnt_encoder.rs @@ -28,7 +28,6 @@ use esp_hal::{ IO, }; use esp_println::println; -use xtensa_lx_rt::entry; static UNIT0: Mutex>> = Mutex::new(RefCell::new(None)); static VALUE: AtomicI32 = AtomicI32::new(0); diff --git a/esp32-hal/examples/pulse_control.rs b/esp32-hal/examples/pulse_control.rs index 7fc6ac6e7..322723f4b 100644 --- a/esp32-hal/examples/pulse_control.rs +++ b/esp32-hal/examples/pulse_control.rs @@ -16,7 +16,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/ram.rs b/esp32-hal/examples/ram.rs index b52e3a629..35e09bd95 100644 --- a/esp32-hal/examples/ram.rs +++ b/esp32-hal/examples/ram.rs @@ -18,7 +18,6 @@ use esp32_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[ram(rtc_fast)] static mut SOME_INITED_DATA: [u8; 2] = [0xaa, 0xbb]; diff --git a/esp32-hal/examples/read_efuse.rs b/esp32-hal/examples/read_efuse.rs index c0eedee86..7a5476093 100644 --- a/esp32-hal/examples/read_efuse.rs +++ b/esp32-hal/examples/read_efuse.rs @@ -14,7 +14,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/rtc_watchdog.rs b/esp32-hal/examples/rtc_watchdog.rs index 9054cee0c..d797bc074 100644 --- a/esp32-hal/examples/rtc_watchdog.rs +++ b/esp32-hal/examples/rtc_watchdog.rs @@ -18,7 +18,6 @@ use esp32_hal::{ Rwdt, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; static RWDT: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32-hal/examples/serial_interrupts.rs b/esp32-hal/examples/serial_interrupts.rs index c7ed2353e..44a889229 100644 --- a/esp32-hal/examples/serial_interrupts.rs +++ b/esp32-hal/examples/serial_interrupts.rs @@ -20,7 +20,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use nb::block; -use xtensa_lx_rt::entry; static SERIAL: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32-hal/examples/sha.rs b/esp32-hal/examples/sha.rs index 92bdbac12..0bc32e111 100644 --- a/esp32-hal/examples/sha.rs +++ b/esp32-hal/examples/sha.rs @@ -10,13 +10,13 @@ use esp32_hal::{ prelude::*, sha::{Sha, ShaMode}, timer::TimerGroup, + xtensa_lx, Rtc, }; use esp_backtrace as _; use esp_println::println; use nb::block; use sha2::{Digest, Sha512}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/spi_eh1_device_loopback.rs b/esp32-hal/examples/spi_eh1_device_loopback.rs index bd9eb7dc7..4b7d56684 100644 --- a/esp32-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32-hal/examples/spi_eh1_device_loopback.rs @@ -31,7 +31,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/spi_eh1_loopback.rs b/esp32-hal/examples/spi_eh1_loopback.rs index 9aab98eee..f82e9f702 100644 --- a/esp32-hal/examples/spi_eh1_loopback.rs +++ b/esp32-hal/examples/spi_eh1_loopback.rs @@ -29,7 +29,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/spi_loopback.rs b/esp32-hal/examples/spi_loopback.rs index d85835088..00f18fb14 100644 --- a/esp32-hal/examples/spi_loopback.rs +++ b/esp32-hal/examples/spi_loopback.rs @@ -28,7 +28,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/spi_loopback_dma.rs b/esp32-hal/examples/spi_loopback_dma.rs index dea517e4f..8af34f981 100644 --- a/esp32-hal/examples/spi_loopback_dma.rs +++ b/esp32-hal/examples/spi_loopback_dma.rs @@ -30,7 +30,6 @@ use esp32_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/examples/timer_interrupt.rs b/esp32-hal/examples/timer_interrupt.rs index 7b52ce559..fbe36b133 100644 --- a/esp32-hal/examples/timer_interrupt.rs +++ b/esp32-hal/examples/timer_interrupt.rs @@ -18,7 +18,6 @@ use esp32_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; static TIMER00: Mutex>>>> = Mutex::new(RefCell::new(None)); static TIMER01: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32-hal/examples/watchdog.rs b/esp32-hal/examples/watchdog.rs index 675e10a03..923cfee04 100644 --- a/esp32-hal/examples/watchdog.rs +++ b/esp32-hal/examples/watchdog.rs @@ -15,7 +15,6 @@ use esp32_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32-hal/src/lib.rs b/esp32-hal/src/lib.rs index 1d392583e..497919960 100644 --- a/esp32-hal/src/lib.rs +++ b/esp32-hal/src/lib.rs @@ -13,6 +13,7 @@ pub use esp_hal_common::{ dma, dma::pdma, efuse, + entry, gpio, i2c, i2s, @@ -28,8 +29,10 @@ pub use esp_hal_common::{ spi, system, timer, + trapframe, uart, utils, + xtensa_lx, Cpu, Delay, PulseControl, @@ -74,17 +77,17 @@ pub unsafe extern "C" fn ESP32Reset() -> ! { } // set stack pointer to end of memory: no need to retain stack up to this point - xtensa_lx::set_stack_pointer(&mut _stack_end_cpu0); + esp_hal_common::xtensa_lx::set_stack_pointer(&mut _stack_end_cpu0); // copying data from flash to various data segments is done by the bootloader // initialization to zero needs to be done by the application // Initialize RTC RAM - xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); - xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); // continue with default reset handler - xtensa_lx_rt::Reset(); + esp_hal_common::xtensa_lx_rt::Reset(); } /// The ESP32 has a first stage bootloader that handles loading program data diff --git a/esp32c2-hal/Cargo.toml b/esp32c2-hal/Cargo.toml index c914ea9e0..0dfc95210 100644 --- a/esp32c2-hal/Cargo.toml +++ b/esp32c2-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp32c2-hal" -version = "0.3.0" +version = "0.4.0" authors = [ "Jesse Braham ", "Björn Quentin ", @@ -30,15 +30,14 @@ embedded-hal = { version = "0.2.7", features = ["unproven"] } embedded-hal-1 = { version = "=1.0.0-alpha.9", optional = true, package = "embedded-hal" } embedded-hal-async = { version = "0.2.0-alpha.0", optional = true } embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true } -esp-hal-common = { version = "0.5.0", features = ["esp32c2"], path = "../esp-hal-common" } -esp-riscv-rt = { version = "0.1.0", optional = true } +esp-hal-common = { version = "0.6.0", features = ["esp32c2"], path = "../esp-hal-common" } r0 = "1.0.0" [dev-dependencies] critical-section = "1.1.1" embassy-executor = { package = "embassy-executor", git = "https://github.com/embassy-rs/embassy/", rev = "cd9a65b", features = ["nightly", "integrated-timers"] } embedded-graphics = "0.7.1" -esp-backtrace = { version = "0.4.0", features = ["esp32c2", "panic-handler", "exception-handler", "print-uart"] } +esp-backtrace = { version = "0.5.0", features = ["esp32c2", "panic-handler", "exception-handler", "print-uart"] } esp-println = { version = "0.3.1", features = ["esp32c2"] } sha2 = { version = "0.10.6", default-features = false} ssd1306 = "0.7.1" @@ -48,7 +47,7 @@ static_cell = "1.0.0" default = ["rt", "vectored", "xtal40mhz"] direct-boot = [] eh1 = ["esp-hal-common/eh1", "dep:embedded-hal-1", "dep:embedded-hal-nb"] -rt = ["esp-riscv-rt"] +rt = [] ufmt = ["esp-hal-common/ufmt"] vectored = ["esp-hal-common/vectored"] async = ["esp-hal-common/async", "embedded-hal-async"] diff --git a/esp32c2-hal/examples/adc.rs b/esp32c2-hal/examples/adc.rs index 5eaad98f8..58154e7e4 100644 --- a/esp32c2-hal/examples/adc.rs +++ b/esp32c2-hal/examples/adc.rs @@ -17,7 +17,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/advanced_serial.rs b/esp32c2-hal/examples/advanced_serial.rs index 2403751ae..a68bdd9d1 100644 --- a/esp32c2-hal/examples/advanced_serial.rs +++ b/esp32c2-hal/examples/advanced_serial.rs @@ -21,7 +21,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; #[entry] diff --git a/esp32c2-hal/examples/blinky.rs b/esp32c2-hal/examples/blinky.rs index 60284482a..fb51e004f 100644 --- a/esp32c2-hal/examples/blinky.rs +++ b/esp32c2-hal/examples/blinky.rs @@ -15,7 +15,6 @@ use esp32c2_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/blinky_erased_pins.rs b/esp32c2-hal/examples/blinky_erased_pins.rs index 925f6125e..96512decc 100644 --- a/esp32c2-hal/examples/blinky_erased_pins.rs +++ b/esp32c2-hal/examples/blinky_erased_pins.rs @@ -15,7 +15,6 @@ use esp32c2_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/clock_monitor.rs b/esp32c2-hal/examples/clock_monitor.rs index b2d13a334..80b01a18e 100644 --- a/esp32c2-hal/examples/clock_monitor.rs +++ b/esp32c2-hal/examples/clock_monitor.rs @@ -13,10 +13,10 @@ use esp32c2_hal::{ interrupt, peripherals::{self, Peripherals}, prelude::*, + riscv, Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static RTC: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c2-hal/examples/embassy_hello_world.rs b/esp32c2-hal/examples/embassy_hello_world.rs index 90af6b59c..ed9b42dfc 100644 --- a/esp32c2-hal/examples/embassy_hello_world.rs +++ b/esp32c2-hal/examples/embassy_hello_world.rs @@ -38,7 +38,7 @@ async fn run2() { static EXECUTOR: StaticCell = StaticCell::new(); -#[esp_riscv_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32c2-hal/examples/embassy_spi.rs b/esp32c2-hal/examples/embassy_spi.rs index 53a2fc484..d90de72bf 100644 --- a/esp32c2-hal/examples/embassy_spi.rs +++ b/esp32c2-hal/examples/embassy_spi.rs @@ -57,7 +57,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[esp_riscv_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32c2-hal/examples/embassy_wait.rs b/esp32c2-hal/examples/embassy_wait.rs index 1cb779c64..f883ace63 100644 --- a/esp32c2-hal/examples/embassy_wait.rs +++ b/esp32c2-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio9>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[esp_riscv_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32c2-hal/examples/gpio_interrupt.rs b/esp32c2-hal/examples/gpio_interrupt.rs index 7a91dbd88..36f86ab1b 100644 --- a/esp32c2-hal/examples/gpio_interrupt.rs +++ b/esp32c2-hal/examples/gpio_interrupt.rs @@ -15,12 +15,12 @@ use esp32c2_hal::{ interrupt, peripherals::{self, Peripherals}, prelude::*, + riscv, timer::TimerGroup, Delay, Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static BUTTON: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c2-hal/examples/hello_world.rs b/esp32c2-hal/examples/hello_world.rs index b40ae82ff..25d820a4b 100644 --- a/esp32c2-hal/examples/hello_world.rs +++ b/esp32c2-hal/examples/hello_world.rs @@ -15,7 +15,6 @@ use esp32c2_hal::{ Uart, }; use esp_backtrace as _; -use esp_riscv_rt::entry; use nb::block; #[entry] diff --git a/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs index 83b00b5f9..d7d5303d5 100644 --- a/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c2-hal/examples/i2c_bmp180_calibration_data.rs @@ -20,7 +20,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/i2c_display.rs b/esp32c2-hal/examples/i2c_display.rs index 42af86967..a02541ab1 100644 --- a/esp32c2-hal/examples/i2c_display.rs +++ b/esp32c2-hal/examples/i2c_display.rs @@ -29,7 +29,6 @@ use esp32c2_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; use nb::block; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; diff --git a/esp32c2-hal/examples/ledc.rs b/esp32c2-hal/examples/ledc.rs index 5ab711c97..000dc2342 100644 --- a/esp32c2-hal/examples/ledc.rs +++ b/esp32c2-hal/examples/ledc.rs @@ -22,7 +22,6 @@ use esp32c2_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/read_efuse.rs b/esp32c2-hal/examples/read_efuse.rs index 9d83c530a..8265c3912 100644 --- a/esp32c2-hal/examples/read_efuse.rs +++ b/esp32c2-hal/examples/read_efuse.rs @@ -14,7 +14,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/rtc_watchdog.rs b/esp32c2-hal/examples/rtc_watchdog.rs index 1db93aef5..f24ada1d1 100644 --- a/esp32c2-hal/examples/rtc_watchdog.rs +++ b/esp32c2-hal/examples/rtc_watchdog.rs @@ -14,11 +14,11 @@ use esp32c2_hal::{ interrupt, peripherals::{self, Peripherals}, prelude::*, + riscv, Rtc, Rwdt, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static RWDT: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c2-hal/examples/serial_interrupts.rs b/esp32c2-hal/examples/serial_interrupts.rs index 7930dba03..9e00aa8ea 100644 --- a/esp32c2-hal/examples/serial_interrupts.rs +++ b/esp32c2-hal/examples/serial_interrupts.rs @@ -13,6 +13,7 @@ use esp32c2_hal::{ interrupt, peripherals::{self, Peripherals, UART0}, prelude::*, + riscv, timer::TimerGroup, uart::config::AtCmdConfig, Cpu, @@ -20,7 +21,6 @@ use esp32c2_hal::{ Uart, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; use nb::block; static SERIAL: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c2-hal/examples/sha.rs b/esp32c2-hal/examples/sha.rs index 7982a9fc9..0ddb7770a 100644 --- a/esp32c2-hal/examples/sha.rs +++ b/esp32c2-hal/examples/sha.rs @@ -14,7 +14,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; use sha2::{Digest, Sha256}; diff --git a/esp32c2-hal/examples/spi_eh1_device_loopback.rs b/esp32c2-hal/examples/spi_eh1_device_loopback.rs index b58d51546..5564bbf55 100644 --- a/esp32c2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c2-hal/examples/spi_eh1_device_loopback.rs @@ -31,7 +31,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/spi_eh1_loopback.rs b/esp32c2-hal/examples/spi_eh1_loopback.rs index fb2407348..9414d456c 100644 --- a/esp32c2-hal/examples/spi_eh1_loopback.rs +++ b/esp32c2-hal/examples/spi_eh1_loopback.rs @@ -29,7 +29,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/spi_loopback.rs b/esp32c2-hal/examples/spi_loopback.rs index e61afaefb..8d675629f 100644 --- a/esp32c2-hal/examples/spi_loopback.rs +++ b/esp32c2-hal/examples/spi_loopback.rs @@ -28,7 +28,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/spi_loopback_dma.rs b/esp32c2-hal/examples/spi_loopback_dma.rs index aebbfe4af..615a48aec 100644 --- a/esp32c2-hal/examples/spi_loopback_dma.rs +++ b/esp32c2-hal/examples/spi_loopback_dma.rs @@ -30,7 +30,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c2-hal/examples/systimer.rs b/esp32c2-hal/examples/systimer.rs index 8264ffb69..b9ceaefe1 100644 --- a/esp32c2-hal/examples/systimer.rs +++ b/esp32c2-hal/examples/systimer.rs @@ -20,7 +20,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; static ALARM0: Mutex>>> = Mutex::new(RefCell::new(None)); static ALARM1: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c2-hal/examples/timer_interrupt.rs b/esp32c2-hal/examples/timer_interrupt.rs index 21ddadb07..1998ea312 100644 --- a/esp32c2-hal/examples/timer_interrupt.rs +++ b/esp32c2-hal/examples/timer_interrupt.rs @@ -12,11 +12,11 @@ use esp32c2_hal::{ interrupt, peripherals::{self, Peripherals, TIMG0}, prelude::*, + riscv, timer::{Timer, Timer0, TimerGroup}, Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static TIMER0: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c2-hal/examples/watchdog.rs b/esp32c2-hal/examples/watchdog.rs index a01bcc2ec..ff305a499 100644 --- a/esp32c2-hal/examples/watchdog.rs +++ b/esp32c2-hal/examples/watchdog.rs @@ -14,7 +14,6 @@ use esp32c2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; #[entry] diff --git a/esp32c2-hal/src/lib.rs b/esp32c2-hal/src/lib.rs index 335e0d9ab..af6fd8fc0 100644 --- a/esp32c2-hal/src/lib.rs +++ b/esp32c2-hal/src/lib.rs @@ -9,6 +9,7 @@ pub use esp_hal_common::{ clock, dma::{self, gdma}, efuse, + entry, gpio, i2c, interrupt, @@ -16,11 +17,13 @@ pub use esp_hal_common::{ macros, peripherals, prelude, + riscv, sha, spi, system, systimer, timer, + trapframe, uart, Cpu, Delay, @@ -50,7 +53,7 @@ extern "C" { #[cfg(feature = "direct-boot")] #[doc(hidden)] -#[esp_riscv_rt::pre_init] +#[esp_hal_common::esp_riscv_rt::pre_init] unsafe fn init() { r0::init_data(&mut _srwtext, &mut _erwtext, &_irwtext); } diff --git a/esp32c3-hal/Cargo.toml b/esp32c3-hal/Cargo.toml index c37d38fed..34eae4512 100644 --- a/esp32c3-hal/Cargo.toml +++ b/esp32c3-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp32c3-hal" -version = "0.5.0" +version = "0.6.0" authors = [ "Jesse Braham ", "Björn Quentin ", @@ -32,8 +32,7 @@ embedded-hal-1 = { version = "=1.0.0-alpha.9", optional = true, package = "e embedded-hal-async = { version = "0.2.0-alpha.0", optional = true } embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true } embedded-can = { version = "0.4.1", optional = true } -esp-hal-common = { version = "0.5.0", features = ["esp32c3"], path = "../esp-hal-common" } -esp-riscv-rt = { version = "0.1.0", optional = true } +esp-hal-common = { version = "0.6.0", features = ["esp32c3"], path = "../esp-hal-common" } r0 = "1.0.0" [dev-dependencies] @@ -41,7 +40,7 @@ aes = "0.8.2" critical-section = "1.1.1" embassy-executor = { package = "embassy-executor", git = "https://github.com/embassy-rs/embassy/", rev = "cd9a65b", features = ["nightly", "integrated-timers"] } embedded-graphics = "0.7.1" -esp-backtrace = { version = "0.4.0", features = ["esp32c3", "panic-handler", "exception-handler", "print-uart"] } +esp-backtrace = { version = "0.5.0", features = ["esp32c3", "panic-handler", "exception-handler", "print-uart"] } esp-println = { version = "0.3.1", features = ["esp32c3"] } sha2 = { version = "0.10.6", default-features = false} smart-leds = "0.3.0" @@ -53,7 +52,7 @@ default = ["rt", "vectored"] mcu-boot = [] direct-boot = [] eh1 = ["esp-hal-common/eh1", "dep:embedded-hal-1", "dep:embedded-hal-nb", "dep:embedded-can"] -rt = ["esp-riscv-rt"] +rt = [] smartled = ["esp-hal-common/smartled"] ufmt = ["esp-hal-common/ufmt"] vectored = ["esp-hal-common/vectored"] diff --git a/esp32c3-hal/examples/adc.rs b/esp32c3-hal/examples/adc.rs index 2267a0505..c6fd7d197 100644 --- a/esp32c3-hal/examples/adc.rs +++ b/esp32c3-hal/examples/adc.rs @@ -17,7 +17,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/advanced_serial.rs b/esp32c3-hal/examples/advanced_serial.rs index 8a2d6ba42..4bc71ec08 100644 --- a/esp32c3-hal/examples/advanced_serial.rs +++ b/esp32c3-hal/examples/advanced_serial.rs @@ -21,7 +21,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; #[entry] diff --git a/esp32c3-hal/examples/aes.rs b/esp32c3-hal/examples/aes.rs index 28138fc3e..d0d744e52 100644 --- a/esp32c3-hal/examples/aes.rs +++ b/esp32c3-hal/examples/aes.rs @@ -15,7 +15,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/blinky.rs b/esp32c3-hal/examples/blinky.rs index dd2436e67..a1b2a4dd2 100644 --- a/esp32c3-hal/examples/blinky.rs +++ b/esp32c3-hal/examples/blinky.rs @@ -15,7 +15,6 @@ use esp32c3_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/blinky_erased_pins.rs b/esp32c3-hal/examples/blinky_erased_pins.rs index e09420cae..bb86b38a7 100644 --- a/esp32c3-hal/examples/blinky_erased_pins.rs +++ b/esp32c3-hal/examples/blinky_erased_pins.rs @@ -15,7 +15,6 @@ use esp32c3_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/clock_monitor.rs b/esp32c3-hal/examples/clock_monitor.rs index c54d1cc21..2293e4861 100644 --- a/esp32c3-hal/examples/clock_monitor.rs +++ b/esp32c3-hal/examples/clock_monitor.rs @@ -13,10 +13,10 @@ use esp32c3_hal::{ interrupt, peripherals::{self, Peripherals}, prelude::*, + riscv, Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static RTC: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c3-hal/examples/embassy_hello_world.rs b/esp32c3-hal/examples/embassy_hello_world.rs index 3c39eb32f..fac860134 100644 --- a/esp32c3-hal/examples/embassy_hello_world.rs +++ b/esp32c3-hal/examples/embassy_hello_world.rs @@ -38,7 +38,7 @@ async fn run2() { static EXECUTOR: StaticCell = StaticCell::new(); -#[esp_riscv_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32c3-hal/examples/embassy_spi.rs b/esp32c3-hal/examples/embassy_spi.rs index 6f2bd3819..d0c904f90 100644 --- a/esp32c3-hal/examples/embassy_spi.rs +++ b/esp32c3-hal/examples/embassy_spi.rs @@ -57,7 +57,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[esp_riscv_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32c3-hal/examples/embassy_wait.rs b/esp32c3-hal/examples/embassy_wait.rs index b09ab77cd..213a75ad1 100644 --- a/esp32c3-hal/examples/embassy_wait.rs +++ b/esp32c3-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio9>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[esp_riscv_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32c3-hal/examples/gpio_interrupt.rs b/esp32c3-hal/examples/gpio_interrupt.rs index 0bfb0c8eb..ed112d8bd 100644 --- a/esp32c3-hal/examples/gpio_interrupt.rs +++ b/esp32c3-hal/examples/gpio_interrupt.rs @@ -15,12 +15,12 @@ use esp32c3_hal::{ interrupt, peripherals::{self, Peripherals}, prelude::*, + riscv, timer::TimerGroup, Delay, Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static BUTTON: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c3-hal/examples/hello_rgb.rs b/esp32c3-hal/examples/hello_rgb.rs index 2a7b025c3..c891c6363 100644 --- a/esp32c3-hal/examples/hello_rgb.rs +++ b/esp32c3-hal/examples/hello_rgb.rs @@ -25,7 +25,6 @@ use esp32c3_hal::{ }; #[allow(unused_imports)] use esp_backtrace as _; -use esp_riscv_rt::entry; use smart_leds::{ brightness, gamma, diff --git a/esp32c3-hal/examples/hello_world.rs b/esp32c3-hal/examples/hello_world.rs index a4129f6c0..6b1b6f9f9 100644 --- a/esp32c3-hal/examples/hello_world.rs +++ b/esp32c3-hal/examples/hello_world.rs @@ -15,7 +15,6 @@ use esp32c3_hal::{ Uart, }; use esp_backtrace as _; -use esp_riscv_rt::entry; use nb::block; #[entry] diff --git a/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs b/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs index 2176c28c7..ecf8024f7 100644 --- a/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32c3-hal/examples/i2c_bmp180_calibration_data.rs @@ -20,7 +20,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/i2c_display.rs b/esp32c3-hal/examples/i2c_display.rs index 2d2360c70..a902de012 100644 --- a/esp32c3-hal/examples/i2c_display.rs +++ b/esp32c3-hal/examples/i2c_display.rs @@ -29,7 +29,6 @@ use esp32c3_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; use nb::block; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; diff --git a/esp32c3-hal/examples/i2s_read.rs b/esp32c3-hal/examples/i2s_read.rs index 373a0ef83..3992dde7f 100644 --- a/esp32c3-hal/examples/i2s_read.rs +++ b/esp32c3-hal/examples/i2s_read.rs @@ -27,7 +27,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/i2s_sound.rs b/esp32c3-hal/examples/i2s_sound.rs index be8a8f003..9f7c01aa5 100644 --- a/esp32c3-hal/examples/i2s_sound.rs +++ b/esp32c3-hal/examples/i2s_sound.rs @@ -42,7 +42,6 @@ use esp32c3_hal::{ IO, }; use esp_backtrace as _; -use esp_riscv_rt::entry; const SINE: [i16; 64] = [ 0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244, 28897, 30272, 31356, diff --git a/esp32c3-hal/examples/ledc.rs b/esp32c3-hal/examples/ledc.rs index 11914eb16..c6305e066 100644 --- a/esp32c3-hal/examples/ledc.rs +++ b/esp32c3-hal/examples/ledc.rs @@ -22,7 +22,6 @@ use esp32c3_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/pulse_control.rs b/esp32c3-hal/examples/pulse_control.rs index 524a6abb3..2c8b9c9ba 100644 --- a/esp32c3-hal/examples/pulse_control.rs +++ b/esp32c3-hal/examples/pulse_control.rs @@ -16,7 +16,6 @@ use esp32c3_hal::{ Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/ram.rs b/esp32c3-hal/examples/ram.rs index 3230dba0d..7e60f220b 100644 --- a/esp32c3-hal/examples/ram.rs +++ b/esp32c3-hal/examples/ram.rs @@ -17,7 +17,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; #[ram(rtc_fast)] diff --git a/esp32c3-hal/examples/read_efuse.rs b/esp32c3-hal/examples/read_efuse.rs index 07ea13b05..3cd965e61 100644 --- a/esp32c3-hal/examples/read_efuse.rs +++ b/esp32c3-hal/examples/read_efuse.rs @@ -14,7 +14,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/rtc_watchdog.rs b/esp32c3-hal/examples/rtc_watchdog.rs index 759899520..5a98e4912 100644 --- a/esp32c3-hal/examples/rtc_watchdog.rs +++ b/esp32c3-hal/examples/rtc_watchdog.rs @@ -14,11 +14,11 @@ use esp32c3_hal::{ interrupt, peripherals::{self, Peripherals}, prelude::*, + riscv, Rtc, Rwdt, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static RWDT: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c3-hal/examples/serial_interrupts.rs b/esp32c3-hal/examples/serial_interrupts.rs index 1b81c07ba..8937b6c11 100644 --- a/esp32c3-hal/examples/serial_interrupts.rs +++ b/esp32c3-hal/examples/serial_interrupts.rs @@ -13,6 +13,7 @@ use esp32c3_hal::{ interrupt, peripherals::{self, Peripherals, UART0}, prelude::*, + riscv, timer::TimerGroup, uart::config::AtCmdConfig, Cpu, @@ -20,7 +21,6 @@ use esp32c3_hal::{ Uart, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; use nb::block; static SERIAL: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c3-hal/examples/sha.rs b/esp32c3-hal/examples/sha.rs index deb32a398..31090f3d4 100644 --- a/esp32c3-hal/examples/sha.rs +++ b/esp32c3-hal/examples/sha.rs @@ -14,7 +14,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; use sha2::{Digest, Sha256}; diff --git a/esp32c3-hal/examples/spi_eh1_device_loopback.rs b/esp32c3-hal/examples/spi_eh1_device_loopback.rs index a3fd6c44f..6f51e5dcc 100644 --- a/esp32c3-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32c3-hal/examples/spi_eh1_device_loopback.rs @@ -31,7 +31,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/spi_eh1_loopback.rs b/esp32c3-hal/examples/spi_eh1_loopback.rs index 5064ca187..1c2587b63 100644 --- a/esp32c3-hal/examples/spi_eh1_loopback.rs +++ b/esp32c3-hal/examples/spi_eh1_loopback.rs @@ -29,7 +29,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/spi_loopback.rs b/esp32c3-hal/examples/spi_loopback.rs index 38eab6c37..8753da8d3 100644 --- a/esp32c3-hal/examples/spi_loopback.rs +++ b/esp32c3-hal/examples/spi_loopback.rs @@ -28,7 +28,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/spi_loopback_dma.rs b/esp32c3-hal/examples/spi_loopback_dma.rs index c8c72a016..45bb0e227 100644 --- a/esp32c3-hal/examples/spi_loopback_dma.rs +++ b/esp32c3-hal/examples/spi_loopback_dma.rs @@ -30,7 +30,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32c3-hal/examples/systimer.rs b/esp32c3-hal/examples/systimer.rs index bcf4548df..6d6c42ec0 100644 --- a/esp32c3-hal/examples/systimer.rs +++ b/esp32c3-hal/examples/systimer.rs @@ -20,7 +20,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; static ALARM0: Mutex>>> = Mutex::new(RefCell::new(None)); static ALARM1: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c3-hal/examples/timer_interrupt.rs b/esp32c3-hal/examples/timer_interrupt.rs index b885dc441..fde48cc89 100644 --- a/esp32c3-hal/examples/timer_interrupt.rs +++ b/esp32c3-hal/examples/timer_interrupt.rs @@ -13,11 +13,11 @@ use esp32c3_hal::{ interrupt, peripherals::{self, Peripherals, TIMG0, TIMG1}, prelude::*, + riscv, timer::{Timer, Timer0, TimerGroup}, Rtc, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; static TIMER0: Mutex>>>> = Mutex::new(RefCell::new(None)); static TIMER1: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32c3-hal/examples/twai.rs b/esp32c3-hal/examples/twai.rs index 9497bcd15..ad4d4e968 100644 --- a/esp32c3-hal/examples/twai.rs +++ b/esp32c3-hal/examples/twai.rs @@ -21,7 +21,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; #[entry] diff --git a/esp32c3-hal/examples/usb_serial_jtag.rs b/esp32c3-hal/examples/usb_serial_jtag.rs index aad70b7bb..5c570f069 100644 --- a/esp32c3-hal/examples/usb_serial_jtag.rs +++ b/esp32c3-hal/examples/usb_serial_jtag.rs @@ -14,13 +14,13 @@ use esp32c3_hal::{ interrupt, peripherals::{self, Peripherals, USB_DEVICE}, prelude::*, + riscv, timer::TimerGroup, Cpu, Rtc, UsbSerialJtag, }; use esp_backtrace as _; -use esp_riscv_rt::{entry, riscv}; use nb::block; static USB_SERIAL: Mutex>>> = diff --git a/esp32c3-hal/examples/watchdog.rs b/esp32c3-hal/examples/watchdog.rs index e5ca62d4b..5a656daf1 100644 --- a/esp32c3-hal/examples/watchdog.rs +++ b/esp32c3-hal/examples/watchdog.rs @@ -14,7 +14,6 @@ use esp32c3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use esp_riscv_rt::entry; use nb::block; #[entry] diff --git a/esp32c3-hal/src/lib.rs b/esp32c3-hal/src/lib.rs index 7592cafdb..739e9f302 100644 --- a/esp32c3-hal/src/lib.rs +++ b/esp32c3-hal/src/lib.rs @@ -14,6 +14,7 @@ pub use esp_hal_common::{ dma, dma::gdma, efuse, + entry, gpio, i2c, i2s, @@ -23,11 +24,13 @@ pub use esp_hal_common::{ peripherals, prelude, pulse_control, + riscv, sha, spi, system, systimer, timer, + trapframe, twai, uart, utils, @@ -125,7 +128,7 @@ static ENTRY_POINT: unsafe fn() -> ! = start_hal; #[cfg(feature = "direct-boot")] #[doc(hidden)] -#[esp_riscv_rt::pre_init] +#[esp_hal_common::esp_riscv_rt::pre_init] unsafe fn init() { r0::init_data(&mut _srwtext, &mut _erwtext, &_irwtext); diff --git a/esp32s2-hal/Cargo.toml b/esp32s2-hal/Cargo.toml index f18944e27..06a1be582 100644 --- a/esp32s2-hal/Cargo.toml +++ b/esp32s2-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp32s2-hal" -version = "0.5.0" +version = "0.6.0" authors = [ "Jesse Braham ", "Björn Quentin ", @@ -30,16 +30,14 @@ embedded-hal = { version = "0.2.7", features = ["unproven"] } embedded-hal-1 = { version = "=1.0.0-alpha.9", optional = true, package = "embedded-hal" } embedded-hal-async = { version = "0.2.0-alpha.0", optional = true } embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true } -esp-hal-common = { version = "0.5.0", features = ["esp32s2"], path = "../esp-hal-common" } -xtensa-lx = { version = "0.7.0", features = ["esp32s2"] } -xtensa-lx-rt = { version = "0.14.0", features = ["esp32s2"], optional = true } -xtensa-atomic-emulation-trap = { version = "0.3.0", features = ["esp32s2"] } +esp-hal-common = { version = "0.6.0", features = ["esp32s2"], path = "../esp-hal-common" } +xtensa-atomic-emulation-trap = { version = "0.4.0" } [dev-dependencies] critical-section = "1.1.1" embassy-executor = { package = "embassy-executor", git = "https://github.com/embassy-rs/embassy/", rev = "cd9a65b", features = ["nightly", "integrated-timers"] } embedded-graphics = "0.7.1" -esp-backtrace = { version = "0.4.0", features = ["esp32s2", "panic-handler", "print-uart"] } +esp-backtrace = { version = "0.5.0", features = ["esp32s2", "panic-handler", "print-uart", "exception-handler"] } esp-println = { version = "0.3.1", features = ["esp32s2"] } sha2 = { version = "0.10.6", default-features = false} smart-leds = "0.3.0" @@ -52,7 +50,7 @@ aes = "0.8.2" [features] default = ["rt", "vectored"] eh1 = ["esp-hal-common/eh1", "dep:embedded-hal-1", "dep:embedded-hal-nb"] -rt = ["xtensa-lx-rt/esp32s2"] +rt = [] smartled = ["esp-hal-common/smartled"] ufmt = ["esp-hal-common/ufmt"] vectored = ["esp-hal-common/vectored"] diff --git a/esp32s2-hal/examples/adc.rs b/esp32s2-hal/examples/adc.rs index 50c539fa0..2847ff920 100644 --- a/esp32s2-hal/examples/adc.rs +++ b/esp32s2-hal/examples/adc.rs @@ -17,8 +17,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -55,20 +53,3 @@ fn main() -> ! { delay.delay_ms(1500u32); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/advanced_serial.rs b/esp32s2-hal/examples/advanced_serial.rs index 36ac70fc3..be9f09210 100644 --- a/esp32s2-hal/examples/advanced_serial.rs +++ b/esp32s2-hal/examples/advanced_serial.rs @@ -23,8 +23,6 @@ use esp32s2_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -70,20 +68,3 @@ fn main() -> ! { delay.delay_ms(250u32); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/aes.rs b/esp32s2-hal/examples/aes.rs index 1035a1f25..5cee0a377 100644 --- a/esp32s2-hal/examples/aes.rs +++ b/esp32s2-hal/examples/aes.rs @@ -10,12 +10,13 @@ use esp32s2_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + xtensa_lx, Rtc, }; use esp_backtrace as _; use esp_println::println; -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); diff --git a/esp32s2-hal/examples/blinky.rs b/esp32s2-hal/examples/blinky.rs index 393c5c8a4..ee0c86d3f 100644 --- a/esp32s2-hal/examples/blinky.rs +++ b/esp32s2-hal/examples/blinky.rs @@ -15,8 +15,6 @@ use esp32s2_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -47,20 +45,3 @@ fn main() -> ! { delay.delay_ms(500u32); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/blinky_erased_pins.rs b/esp32s2-hal/examples/blinky_erased_pins.rs index eee987b43..bdb78b74f 100644 --- a/esp32s2-hal/examples/blinky_erased_pins.rs +++ b/esp32s2-hal/examples/blinky_erased_pins.rs @@ -15,7 +15,6 @@ use esp32s2_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s2-hal/examples/clock_monitor.rs b/esp32s2-hal/examples/clock_monitor.rs index cbf7a7431..8f0569529 100644 --- a/esp32s2-hal/examples/clock_monitor.rs +++ b/esp32s2-hal/examples/clock_monitor.rs @@ -18,7 +18,6 @@ use esp32s2_hal::{ use esp_backtrace as _; use esp_println::println; use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; static RTC: Mutex>> = Mutex::new(RefCell::new(None)); @@ -68,20 +67,3 @@ fn RTC_CORE() { rtc.rwdt.clear_interrupt(); }); } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/dac.rs b/esp32s2-hal/examples/dac.rs index e0d5b9a6c..dd34af20f 100644 --- a/esp32s2-hal/examples/dac.rs +++ b/esp32s2-hal/examples/dac.rs @@ -16,8 +16,6 @@ use esp32s2_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -56,20 +54,3 @@ fn main() -> ! { delay.delay_ms(50u32); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/embassy_hello_world.rs b/esp32s2-hal/examples/embassy_hello_world.rs index f4ece5b10..a812b5741 100644 --- a/esp32s2-hal/examples/embassy_hello_world.rs +++ b/esp32s2-hal/examples/embassy_hello_world.rs @@ -39,7 +39,7 @@ async fn run2() { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); @@ -66,20 +66,3 @@ fn main() -> ! { spawner.spawn(run2()).ok(); }); } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/embassy_spi.rs b/esp32s2-hal/examples/embassy_spi.rs index e4655ef8f..501669fba 100644 --- a/esp32s2-hal/examples/embassy_spi.rs +++ b/esp32s2-hal/examples/embassy_spi.rs @@ -57,7 +57,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32s2-hal/examples/embassy_wait.rs b/esp32s2-hal/examples/embassy_wait.rs index 00bb9c863..75affd83b 100644 --- a/esp32s2-hal/examples/embassy_wait.rs +++ b/esp32s2-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio0>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32s2-hal/examples/gpio_interrupt.rs b/esp32s2-hal/examples/gpio_interrupt.rs index 7e2285a2f..b3ee1bfd1 100644 --- a/esp32s2-hal/examples/gpio_interrupt.rs +++ b/esp32s2-hal/examples/gpio_interrupt.rs @@ -5,6 +5,7 @@ #![no_std] #![no_main] +#![feature(asm_experimental_arch)] use core::cell::RefCell; @@ -17,12 +18,11 @@ use esp32s2_hal::{ peripherals::{self, Peripherals}, prelude::*, timer::TimerGroup, + xtensa_lx, Delay, Rtc, }; use esp_backtrace as _; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; static BUTTON: Mutex>>>> = Mutex::new(RefCell::new(None)); @@ -78,20 +78,3 @@ fn GPIO() { .clear_interrupt() }); } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/hello_rgb.rs b/esp32s2-hal/examples/hello_rgb.rs index af1f74015..39fe8c4bb 100644 --- a/esp32s2-hal/examples/hello_rgb.rs +++ b/esp32s2-hal/examples/hello_rgb.rs @@ -30,8 +30,6 @@ use smart_leds::{ hsv::{hsv2rgb, Hsv}, SmartLedsWrite, }; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -82,20 +80,3 @@ fn main() -> ! { } } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/hello_world.rs b/esp32s2-hal/examples/hello_world.rs index 952abc7d8..d684d9ef3 100644 --- a/esp32s2-hal/examples/hello_world.rs +++ b/esp32s2-hal/examples/hello_world.rs @@ -16,8 +16,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use nb::block; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -42,20 +40,3 @@ fn main() -> ! { block!(timer0.wait()).unwrap(); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs b/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs index e6ad37fce..92b9defee 100644 --- a/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32s2-hal/examples/i2c_bmp180_calibration_data.rs @@ -20,7 +20,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s2-hal/examples/i2c_display.rs b/esp32s2-hal/examples/i2c_display.rs index fcb23e552..fdba6a06f 100644 --- a/esp32s2-hal/examples/i2c_display.rs +++ b/esp32s2-hal/examples/i2c_display.rs @@ -32,7 +32,6 @@ use esp_backtrace as _; use nb::block; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -129,20 +128,3 @@ fn main() -> ! { block!(timer0.wait()).unwrap(); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/i2s_read.rs b/esp32s2-hal/examples/i2s_read.rs index 5398b4038..9175ec91e 100644 --- a/esp32s2-hal/examples/i2s_read.rs +++ b/esp32s2-hal/examples/i2s_read.rs @@ -26,7 +26,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s2-hal/examples/i2s_sound.rs b/esp32s2-hal/examples/i2s_sound.rs index b262ec2cf..51b710adb 100644 --- a/esp32s2-hal/examples/i2s_sound.rs +++ b/esp32s2-hal/examples/i2s_sound.rs @@ -42,7 +42,6 @@ use esp32s2_hal::{ IO, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; const SINE: [i16; 64] = [ 0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244, 28897, 30272, 31356, diff --git a/esp32s2-hal/examples/ledc.rs b/esp32s2-hal/examples/ledc.rs index fb47e4912..52fdd5835 100644 --- a/esp32s2-hal/examples/ledc.rs +++ b/esp32s2-hal/examples/ledc.rs @@ -24,7 +24,6 @@ use esp32s2_hal::{ use esp_backtrace as _; use esp_println; use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -71,20 +70,3 @@ fn main() -> ! { loop {} } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/pcnt_encoder.rs b/esp32s2-hal/examples/pcnt_encoder.rs index 2bdfab326..c8a77f2a1 100644 --- a/esp32s2-hal/examples/pcnt_encoder.rs +++ b/esp32s2-hal/examples/pcnt_encoder.rs @@ -28,7 +28,6 @@ use esp_hal::{ IO, }; use esp_println::println; -use xtensa_lx_rt::entry; static UNIT0: Mutex>> = Mutex::new(RefCell::new(None)); static VALUE: AtomicI32 = AtomicI32::new(0); diff --git a/esp32s2-hal/examples/pulse_control.rs b/esp32s2-hal/examples/pulse_control.rs index cccede5e6..50a51e3ed 100644 --- a/esp32s2-hal/examples/pulse_control.rs +++ b/esp32s2-hal/examples/pulse_control.rs @@ -16,8 +16,6 @@ use esp32s2_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -76,20 +74,3 @@ fn main() -> ! { .unwrap(); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/ram.rs b/esp32s2-hal/examples/ram.rs index 255a22c2d..1f719cf32 100644 --- a/esp32s2-hal/examples/ram.rs +++ b/esp32s2-hal/examples/ram.rs @@ -18,8 +18,6 @@ use esp32s2_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[ram(rtc_fast)] static mut SOME_INITED_DATA: [u8; 2] = [0xaa, 0xbb]; @@ -97,20 +95,3 @@ fn function_in_ram() { fn function_in_rtc_ram() -> u32 { 42 } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/read_efuse.rs b/esp32s2-hal/examples/read_efuse.rs index 50a609dd4..dfc6736cc 100644 --- a/esp32s2-hal/examples/read_efuse.rs +++ b/esp32s2-hal/examples/read_efuse.rs @@ -14,8 +14,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -35,20 +33,3 @@ fn main() -> ! { loop {} } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/rtc_watchdog.rs b/esp32s2-hal/examples/rtc_watchdog.rs index dd0112323..88fd14810 100644 --- a/esp32s2-hal/examples/rtc_watchdog.rs +++ b/esp32s2-hal/examples/rtc_watchdog.rs @@ -18,8 +18,6 @@ use esp32s2_hal::{ Rwdt, }; use esp_backtrace as _; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; static RWDT: Mutex>> = Mutex::new(RefCell::new(None)); @@ -61,20 +59,3 @@ fn RTC_CORE() { rwdt.unlisten(); }); } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/serial_interrupts.rs b/esp32s2-hal/examples/serial_interrupts.rs index 283247bff..50021c41d 100644 --- a/esp32s2-hal/examples/serial_interrupts.rs +++ b/esp32s2-hal/examples/serial_interrupts.rs @@ -20,8 +20,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use nb::block; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; static SERIAL: Mutex>>> = Mutex::new(RefCell::new(None)); @@ -97,20 +95,3 @@ fn UART0() { serial.reset_rx_fifo_full_interrupt(); }); } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/sha.rs b/esp32s2-hal/examples/sha.rs index ce1e47ffd..bc2d45f4a 100644 --- a/esp32s2-hal/examples/sha.rs +++ b/esp32s2-hal/examples/sha.rs @@ -10,13 +10,13 @@ use esp32s2_hal::{ prelude::*, sha::{Sha, ShaMode}, timer::TimerGroup, + xtensa_lx, Rtc, }; use esp_backtrace as _; use esp_println::println; use nb::block; use sha2::{Digest, Sha512}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s2-hal/examples/spi_eh1_device_loopback.rs b/esp32s2-hal/examples/spi_eh1_device_loopback.rs index f515967fa..326c49ff4 100644 --- a/esp32s2-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32s2-hal/examples/spi_eh1_device_loopback.rs @@ -24,15 +24,15 @@ use esp32s2_hal::{ gpio::IO, peripherals::Peripherals, prelude::*, + rt, spi::{Spi, SpiBusController, SpiMode}, timer::TimerGroup, + trapframe, Delay, Rtc, }; use esp_backtrace as _; use esp_println::{print, println}; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -148,20 +148,3 @@ fn main() -> ! { delay.delay_ms(250u32); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/spi_eh1_loopback.rs b/esp32s2-hal/examples/spi_eh1_loopback.rs index 3592fc785..a17c42449 100644 --- a/esp32s2-hal/examples/spi_eh1_loopback.rs +++ b/esp32s2-hal/examples/spi_eh1_loopback.rs @@ -29,8 +29,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -120,20 +118,3 @@ fn main() -> ! { delay.delay_ms(250u32); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/spi_loopback.rs b/esp32s2-hal/examples/spi_loopback.rs index ff4769516..170bfa23e 100644 --- a/esp32s2-hal/examples/spi_loopback.rs +++ b/esp32s2-hal/examples/spi_loopback.rs @@ -28,8 +28,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -74,20 +72,3 @@ fn main() -> ! { delay.delay_ms(250u32); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/spi_loopback_dma.rs b/esp32s2-hal/examples/spi_loopback_dma.rs index 35ccfbe76..5f6dc4bd1 100644 --- a/esp32s2-hal/examples/spi_loopback_dma.rs +++ b/esp32s2-hal/examples/spi_loopback_dma.rs @@ -30,8 +30,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -118,20 +116,3 @@ fn buffer2() -> &'static mut [u8; 32000] { static mut BUFFER: [u8; 32000] = [0u8; 32000]; unsafe { &mut BUFFER } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/systimer.rs b/esp32s2-hal/examples/systimer.rs index 3f4fe809a..31f841bae 100644 --- a/esp32s2-hal/examples/systimer.rs +++ b/esp32s2-hal/examples/systimer.rs @@ -20,8 +20,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; static ALARM0: Mutex>>> = Mutex::new(RefCell::new(None)); static ALARM1: Mutex>>> = Mutex::new(RefCell::new(None)); @@ -123,20 +121,3 @@ fn SYSTIMER_TARGET2() { .clear_interrupt() }); } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/timer_interrupt.rs b/esp32s2-hal/examples/timer_interrupt.rs index 42acbaf5b..a364d71cf 100644 --- a/esp32s2-hal/examples/timer_interrupt.rs +++ b/esp32s2-hal/examples/timer_interrupt.rs @@ -19,8 +19,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; static TIMER00: Mutex>>>> = Mutex::new(RefCell::new(None)); static TIMER01: Mutex>>>> = Mutex::new(RefCell::new(None)); @@ -129,20 +127,3 @@ fn TG1_T1_LEVEL() { } }); } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/examples/usb_serial.rs b/esp32s2-hal/examples/usb_serial.rs index e2b127f28..d84d6c507 100644 --- a/esp32s2-hal/examples/usb_serial.rs +++ b/esp32s2-hal/examples/usb_serial.rs @@ -16,7 +16,6 @@ use esp32s2_hal::{ }; use esp_backtrace as _; use usb_device::prelude::{UsbDeviceBuilder, UsbVidPid}; -use xtensa_lx_rt::entry; static mut EP_MEMORY: [u32; 1024] = [0; 1024]; diff --git a/esp32s2-hal/examples/watchdog.rs b/esp32s2-hal/examples/watchdog.rs index 9fd4d2f55..6e3e32026 100644 --- a/esp32s2-hal/examples/watchdog.rs +++ b/esp32s2-hal/examples/watchdog.rs @@ -15,8 +15,6 @@ use esp32s2_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_atomic_emulation_trap as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { @@ -40,20 +38,3 @@ fn main() -> ! { block!(timer0.wait()).unwrap(); } } - -#[xtensa_lx_rt::exception] -fn exception( - cause: xtensa_lx_rt::exception::ExceptionCause, - frame: xtensa_lx_rt::exception::Context, -) { - use esp_println::*; - - println!("\n\nException occured {:?} {:x?}", cause, frame); - - let backtrace = esp_backtrace::arch::backtrace(); - for b in backtrace.iter() { - if let Some(addr) = b { - println!("0x{:x}", addr) - } - } -} diff --git a/esp32s2-hal/src/lib.rs b/esp32s2-hal/src/lib.rs index 3704a5e4f..adde6ec1e 100644 --- a/esp32s2-hal/src/lib.rs +++ b/esp32s2-hal/src/lib.rs @@ -1,8 +1,10 @@ #![no_std] +// always enable atomic emulation on ESP32-S2 pub use embedded_hal as ehal; #[cfg(feature = "embassy")] pub use esp_hal_common::embassy; +use esp_hal_common::xtensa_lx_rt::exception::ExceptionCause; #[doc(inline)] pub use esp_hal_common::{ aes, @@ -12,6 +14,7 @@ pub use esp_hal_common::{ dma, dma::pdma, efuse, + entry, gpio, i2c::{self, I2C}, i2s, @@ -28,8 +31,10 @@ pub use esp_hal_common::{ system, systimer, timer, + trapframe, uart, utils, + xtensa_lx, Cpu, Delay, PulseControl, @@ -38,6 +43,11 @@ pub use esp_hal_common::{ Rwdt, Uart, }; +use xtensa_atomic_emulation_trap as _; + +pub mod rt { + pub use esp_hal_common::xtensa_lx_rt::exception::ExceptionCause; +} pub use self::gpio::IO; @@ -74,17 +84,17 @@ pub unsafe extern "C" fn ESP32Reset() -> ! { } // set stack pointer to end of memory: no need to retain stack up to this point - xtensa_lx::set_stack_pointer(&mut _stack_end_cpu0); + esp_hal_common::xtensa_lx::set_stack_pointer(&mut _stack_end_cpu0); // copying data from flash to various data segments is done by the bootloader // initialization to zero needs to be done by the application // Initialize RTC RAM - xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); - xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); // continue with default reset handler - xtensa_lx_rt::Reset(); + esp_hal_common::xtensa_lx_rt::Reset(); } /// The ESP32 has a first stage bootloader that handles loading program data @@ -95,3 +105,63 @@ pub unsafe extern "C" fn ESP32Reset() -> ! { pub extern "Rust" fn __init_data() -> bool { false } + +/// Atomic Emulation is always enabled on ESP32-S2 +#[doc(hidden)] +#[no_mangle] +#[export_name = "__exception"] // this overrides the exception handler in xtensa_lx_rt +#[link_section = ".rwtext"] +unsafe fn exception(cause: ExceptionCause, save_frame: &mut trapframe::TrapFrame) { + match cause { + ExceptionCause::Illegal => { + let mut regs = [ + save_frame.A0, + save_frame.A1, + save_frame.A2, + save_frame.A3, + save_frame.A4, + save_frame.A5, + save_frame.A6, + save_frame.A7, + save_frame.A8, + save_frame.A9, + save_frame.A10, + save_frame.A11, + save_frame.A12, + save_frame.A13, + save_frame.A14, + save_frame.A15, + ]; + + if xtensa_atomic_emulation_trap::atomic_emulation(save_frame.PC, &mut regs) { + save_frame.PC += 3; // 24bit instruction + + save_frame.A0 = regs[0]; + save_frame.A1 = regs[1]; + save_frame.A2 = regs[2]; + save_frame.A3 = regs[3]; + save_frame.A4 = regs[4]; + save_frame.A5 = regs[5]; + save_frame.A6 = regs[6]; + save_frame.A7 = regs[7]; + save_frame.A8 = regs[8]; + save_frame.A9 = regs[9]; + save_frame.A10 = regs[10]; + save_frame.A11 = regs[11]; + save_frame.A12 = regs[12]; + save_frame.A13 = regs[13]; + save_frame.A14 = regs[14]; + save_frame.A15 = regs[15]; + + return; + } + } + _ => (), + } + + extern "C" { + fn __user_exception(cause: ExceptionCause, save_frame: &mut trapframe::TrapFrame); + } + + __user_exception(cause, save_frame); +} diff --git a/esp32s3-hal/Cargo.toml b/esp32s3-hal/Cargo.toml index 165ce9b57..3b16f401c 100644 --- a/esp32s3-hal/Cargo.toml +++ b/esp32s3-hal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esp32s3-hal" -version = "0.5.0" +version = "0.6.0" authors = [ "Jesse Braham ", "Björn Quentin ", @@ -32,16 +32,14 @@ embedded-hal-1 = { version = "=1.0.0-alpha.9", optional = true, package = "e embedded-hal-async = { version = "0.2.0-alpha.0", optional = true } embedded-hal-nb = { version = "=1.0.0-alpha.1", optional = true } embedded-can = { version = "0.4.1", optional = true } -esp-hal-common = { version = "0.5.0", features = ["esp32s3"], path = "../esp-hal-common" } +esp-hal-common = { version = "0.6.0", features = ["esp32s3"], path = "../esp-hal-common" } r0 = { version = "1.0.0", optional = true } -xtensa-lx = { version = "0.7.0", features = ["esp32s3"] } -xtensa-lx-rt = { version = "0.14.0", features = ["esp32s3"], optional = true } [dev-dependencies] critical-section = "1.1.1" embassy-executor = { package = "embassy-executor", git = "https://github.com/embassy-rs/embassy/", rev = "cd9a65b", features = ["nightly", "integrated-timers"] } embedded-graphics = "0.7.1" -esp-backtrace = { version = "0.4.0", features = ["esp32s3", "panic-handler", "exception-handler", "print-uart"] } +esp-backtrace = { version = "0.5.0", features = ["esp32s3", "panic-handler", "exception-handler", "print-uart"] } esp-println = { version = "0.3.1", features = ["esp32s3"] } sha2 = { version = "0.10.6", default-features = false} smart-leds = "0.3.0" @@ -55,14 +53,14 @@ aes = "0.8.2" default = ["rt", "vectored"] direct-boot = ["r0"] eh1 = ["esp-hal-common/eh1", "dep:embedded-hal-1", "dep:embedded-hal-nb", "dep:embedded-can"] -rt = ["xtensa-lx-rt/esp32s3"] +rt = [] smartled = ["esp-hal-common/smartled"] ufmt = ["esp-hal-common/ufmt"] vectored = ["esp-hal-common/vectored"] async = ["esp-hal-common/async", "embedded-hal-async"] embassy = ["esp-hal-common/embassy"] embassy-time-systick = ["esp-hal-common/embassy-time-systick", "embassy-time/tick-hz-16_000_000"] -embassy-time-timg0 = ["esp-hal-common/embassy-time-timg0", "embassy-time/tick-hz-1_000_000"] +embassy-time-timg0 = ["esp-hal-common/embassy-time-timg0", "embassy-time/tick-hz-1_000_000"] [[example]] name = "hello_rgb" diff --git a/esp32s3-hal/examples/adc.rs b/esp32s3-hal/examples/adc.rs index 826ec5eae..d35717dbf 100644 --- a/esp32s3-hal/examples/adc.rs +++ b/esp32s3-hal/examples/adc.rs @@ -17,7 +17,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/advanced_serial.rs b/esp32s3-hal/examples/advanced_serial.rs index fd86b44c5..d6a2dbf1e 100644 --- a/esp32s3-hal/examples/advanced_serial.rs +++ b/esp32s3-hal/examples/advanced_serial.rs @@ -23,7 +23,6 @@ use esp32s3_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/aes.rs b/esp32s3-hal/examples/aes.rs index a7d46927f..d0e5a00df 100644 --- a/esp32s3-hal/examples/aes.rs +++ b/esp32s3-hal/examples/aes.rs @@ -10,12 +10,13 @@ use esp32s3_hal::{ peripherals::Peripherals, prelude::*, timer::TimerGroup, + xtensa_lx, Rtc, }; use esp_backtrace as _; use esp_println::println; -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { let peripherals = Peripherals::take(); let mut system = peripherals.SYSTEM.split(); diff --git a/esp32s3-hal/examples/blinky.rs b/esp32s3-hal/examples/blinky.rs index 8338c70d4..9ce069721 100644 --- a/esp32s3-hal/examples/blinky.rs +++ b/esp32s3-hal/examples/blinky.rs @@ -15,7 +15,6 @@ use esp32s3_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/blinky_erased_pins.rs b/esp32s3-hal/examples/blinky_erased_pins.rs index 91f609403..0cfefe4c3 100644 --- a/esp32s3-hal/examples/blinky_erased_pins.rs +++ b/esp32s3-hal/examples/blinky_erased_pins.rs @@ -15,7 +15,6 @@ use esp32s3_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/clock_monitor.rs b/esp32s3-hal/examples/clock_monitor.rs index 06c3016bf..6f14b4ddf 100644 --- a/esp32s3-hal/examples/clock_monitor.rs +++ b/esp32s3-hal/examples/clock_monitor.rs @@ -17,7 +17,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; static RTC: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s3-hal/examples/embassy_hello_world.rs b/esp32s3-hal/examples/embassy_hello_world.rs index 3e814b3c3..2b9b9d1f8 100644 --- a/esp32s3-hal/examples/embassy_hello_world.rs +++ b/esp32s3-hal/examples/embassy_hello_world.rs @@ -38,7 +38,7 @@ async fn run2() { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32s3-hal/examples/embassy_spi.rs b/esp32s3-hal/examples/embassy_spi.rs index 5c425ba26..7e60de2e0 100644 --- a/esp32s3-hal/examples/embassy_spi.rs +++ b/esp32s3-hal/examples/embassy_spi.rs @@ -57,7 +57,7 @@ async fn spi_task(spi: &'static mut SpiType<'static>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32s3-hal/examples/embassy_wait.rs b/esp32s3-hal/examples/embassy_wait.rs index c25d9c09f..d05f677bc 100644 --- a/esp32s3-hal/examples/embassy_wait.rs +++ b/esp32s3-hal/examples/embassy_wait.rs @@ -34,7 +34,7 @@ async fn ping(mut pin: Gpio0>) { static EXECUTOR: StaticCell = StaticCell::new(); -#[xtensa_lx_rt::entry] +#[entry] fn main() -> ! { esp_println::println!("Init!"); let peripherals = Peripherals::take(); diff --git a/esp32s3-hal/examples/gpio_interrupt.rs b/esp32s3-hal/examples/gpio_interrupt.rs index 215829cd1..36c2ce904 100644 --- a/esp32s3-hal/examples/gpio_interrupt.rs +++ b/esp32s3-hal/examples/gpio_interrupt.rs @@ -17,11 +17,11 @@ use esp32s3_hal::{ peripherals::{self, Peripherals}, prelude::*, timer::TimerGroup, + xtensa_lx, Delay, Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; static BUTTON: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s3-hal/examples/hello_rgb.rs b/esp32s3-hal/examples/hello_rgb.rs index 5d5c71d16..85267ad71 100644 --- a/esp32s3-hal/examples/hello_rgb.rs +++ b/esp32s3-hal/examples/hello_rgb.rs @@ -31,7 +31,6 @@ use smart_leds::{ hsv::{hsv2rgb, Hsv}, SmartLedsWrite, }; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/hello_world.rs b/esp32s3-hal/examples/hello_world.rs index 433cd7487..fa4743aec 100644 --- a/esp32s3-hal/examples/hello_world.rs +++ b/esp32s3-hal/examples/hello_world.rs @@ -16,7 +16,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs b/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs index 301a5a43d..bcb36afa8 100644 --- a/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs +++ b/esp32s3-hal/examples/i2c_bmp180_calibration_data.rs @@ -20,7 +20,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/i2c_display.rs b/esp32s3-hal/examples/i2c_display.rs index b61c213ae..d5f33b50f 100644 --- a/esp32s3-hal/examples/i2c_display.rs +++ b/esp32s3-hal/examples/i2c_display.rs @@ -31,7 +31,6 @@ use esp32s3_hal::{ use esp_backtrace as _; use nb::block; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/i2s_read.rs b/esp32s3-hal/examples/i2s_read.rs index 46d20a028..fd5b8d935 100644 --- a/esp32s3-hal/examples/i2s_read.rs +++ b/esp32s3-hal/examples/i2s_read.rs @@ -27,7 +27,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/i2s_sound.rs b/esp32s3-hal/examples/i2s_sound.rs index b4ad55128..c958767bd 100644 --- a/esp32s3-hal/examples/i2s_sound.rs +++ b/esp32s3-hal/examples/i2s_sound.rs @@ -42,7 +42,6 @@ use esp32s3_hal::{ IO, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; const SINE: [i16; 64] = [ 0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244, 28897, 30272, 31356, diff --git a/esp32s3-hal/examples/ledc.rs b/esp32s3-hal/examples/ledc.rs index ae5cca47a..e03f1d88a 100644 --- a/esp32s3-hal/examples/ledc.rs +++ b/esp32s3-hal/examples/ledc.rs @@ -22,7 +22,6 @@ use esp32s3_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/mcpwm.rs b/esp32s3-hal/examples/mcpwm.rs index 56a208323..8fe011c71 100644 --- a/esp32s3-hal/examples/mcpwm.rs +++ b/esp32s3-hal/examples/mcpwm.rs @@ -16,7 +16,6 @@ use esp32s3_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/multicore.rs b/esp32s3-hal/examples/multicore.rs index d586f101c..e23d0ed2e 100644 --- a/esp32s3-hal/examples/multicore.rs +++ b/esp32s3-hal/examples/multicore.rs @@ -19,7 +19,6 @@ use esp32s3_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/pcnt_encoder.rs b/esp32s3-hal/examples/pcnt_encoder.rs index 201fce31d..a49e9b3e4 100644 --- a/esp32s3-hal/examples/pcnt_encoder.rs +++ b/esp32s3-hal/examples/pcnt_encoder.rs @@ -28,7 +28,6 @@ use esp_hal::{ IO, }; use esp_println::println; -use xtensa_lx_rt::entry; static UNIT0: Mutex>> = Mutex::new(RefCell::new(None)); static VALUE: AtomicI32 = AtomicI32::new(0); diff --git a/esp32s3-hal/examples/pulse_control.rs b/esp32s3-hal/examples/pulse_control.rs index 83ba6a02a..88356f02b 100644 --- a/esp32s3-hal/examples/pulse_control.rs +++ b/esp32s3-hal/examples/pulse_control.rs @@ -16,7 +16,6 @@ use esp32s3_hal::{ Rtc, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/ram.rs b/esp32s3-hal/examples/ram.rs index a85231e93..fffa24ccb 100644 --- a/esp32s3-hal/examples/ram.rs +++ b/esp32s3-hal/examples/ram.rs @@ -18,7 +18,6 @@ use esp32s3_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[ram(rtc_fast)] static mut SOME_INITED_DATA: [u8; 2] = [0xaa, 0xbb]; diff --git a/esp32s3-hal/examples/read_efuse.rs b/esp32s3-hal/examples/read_efuse.rs index 9ac89f563..836f50648 100644 --- a/esp32s3-hal/examples/read_efuse.rs +++ b/esp32s3-hal/examples/read_efuse.rs @@ -14,7 +14,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/rtc_watchdog.rs b/esp32s3-hal/examples/rtc_watchdog.rs index c588f8981..c9cc8aece 100644 --- a/esp32s3-hal/examples/rtc_watchdog.rs +++ b/esp32s3-hal/examples/rtc_watchdog.rs @@ -18,7 +18,6 @@ use esp32s3_hal::{ Rwdt, }; use esp_backtrace as _; -use xtensa_lx_rt::entry; static RWDT: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s3-hal/examples/serial_interrupts.rs b/esp32s3-hal/examples/serial_interrupts.rs index 3fdce1270..300f5cdac 100644 --- a/esp32s3-hal/examples/serial_interrupts.rs +++ b/esp32s3-hal/examples/serial_interrupts.rs @@ -20,7 +20,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use nb::block; -use xtensa_lx_rt::entry; static SERIAL: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s3-hal/examples/sha.rs b/esp32s3-hal/examples/sha.rs index a51163c9d..72c4a9880 100644 --- a/esp32s3-hal/examples/sha.rs +++ b/esp32s3-hal/examples/sha.rs @@ -10,13 +10,13 @@ use esp32s3_hal::{ prelude::*, sha::{Sha, ShaMode}, timer::TimerGroup, + xtensa_lx, Rtc, }; use esp_backtrace as _; use esp_println::println; use nb::block; use sha2::{Digest, Sha512}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/spi_eh1_device_loopback.rs b/esp32s3-hal/examples/spi_eh1_device_loopback.rs index 154a4adf6..10b4796ca 100644 --- a/esp32s3-hal/examples/spi_eh1_device_loopback.rs +++ b/esp32s3-hal/examples/spi_eh1_device_loopback.rs @@ -31,7 +31,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/spi_eh1_loopback.rs b/esp32s3-hal/examples/spi_eh1_loopback.rs index ae85a037f..c27f6e404 100644 --- a/esp32s3-hal/examples/spi_eh1_loopback.rs +++ b/esp32s3-hal/examples/spi_eh1_loopback.rs @@ -29,7 +29,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::{print, println}; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/spi_loopback.rs b/esp32s3-hal/examples/spi_loopback.rs index c1c2ca2ef..5080b7436 100644 --- a/esp32s3-hal/examples/spi_loopback.rs +++ b/esp32s3-hal/examples/spi_loopback.rs @@ -28,7 +28,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/spi_loopback_dma.rs b/esp32s3-hal/examples/spi_loopback_dma.rs index 92b3ebaeb..e8a5f652d 100644 --- a/esp32s3-hal/examples/spi_loopback_dma.rs +++ b/esp32s3-hal/examples/spi_loopback_dma.rs @@ -30,7 +30,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/systimer.rs b/esp32s3-hal/examples/systimer.rs index c6c63175a..61cda670e 100644 --- a/esp32s3-hal/examples/systimer.rs +++ b/esp32s3-hal/examples/systimer.rs @@ -20,7 +20,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; static ALARM0: Mutex>>> = Mutex::new(RefCell::new(None)); static ALARM1: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s3-hal/examples/timer_interrupt.rs b/esp32s3-hal/examples/timer_interrupt.rs index ab8405f1f..9b3349a5e 100644 --- a/esp32s3-hal/examples/timer_interrupt.rs +++ b/esp32s3-hal/examples/timer_interrupt.rs @@ -19,7 +19,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use esp_println::println; -use xtensa_lx_rt::entry; static TIMER00: Mutex>>>> = Mutex::new(RefCell::new(None)); static TIMER01: Mutex>>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s3-hal/examples/twai.rs b/esp32s3-hal/examples/twai.rs index 5a05da0a1..f0092267a 100644 --- a/esp32s3-hal/examples/twai.rs +++ b/esp32s3-hal/examples/twai.rs @@ -37,7 +37,6 @@ use esp32s3_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/examples/usb_serial.rs b/esp32s3-hal/examples/usb_serial.rs index 2df9d099f..9d5a62c27 100644 --- a/esp32s3-hal/examples/usb_serial.rs +++ b/esp32s3-hal/examples/usb_serial.rs @@ -16,7 +16,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use usb_device::prelude::{UsbDeviceBuilder, UsbVidPid}; -use xtensa_lx_rt::entry; static mut EP_MEMORY: [u32; 1024] = [0; 1024]; diff --git a/esp32s3-hal/examples/usb_serial_jtag.rs b/esp32s3-hal/examples/usb_serial_jtag.rs index 6cc0f48ed..d95eedc6d 100644 --- a/esp32s3-hal/examples/usb_serial_jtag.rs +++ b/esp32s3-hal/examples/usb_serial_jtag.rs @@ -21,7 +21,6 @@ use esp32s3_hal::{ }; use esp_backtrace as _; use nb::block; -use xtensa_lx_rt::entry; static USB_SERIAL: Mutex>>> = Mutex::new(RefCell::new(None)); diff --git a/esp32s3-hal/examples/watchdog.rs b/esp32s3-hal/examples/watchdog.rs index 7c6fc4fcf..7070b3910 100644 --- a/esp32s3-hal/examples/watchdog.rs +++ b/esp32s3-hal/examples/watchdog.rs @@ -15,7 +15,6 @@ use esp32s3_hal::{ use esp_backtrace as _; use esp_println::println; use nb::block; -use xtensa_lx_rt::entry; #[entry] fn main() -> ! { diff --git a/esp32s3-hal/src/lib.rs b/esp32s3-hal/src/lib.rs index bf2923dd1..d53d69d70 100644 --- a/esp32s3-hal/src/lib.rs +++ b/esp32s3-hal/src/lib.rs @@ -13,6 +13,7 @@ pub use esp_hal_common::{ cpu_control::CpuControl, dma::{self, gdma}, efuse, + entry, gpio, i2c, i2s, @@ -30,9 +31,11 @@ pub use esp_hal_common::{ system, systimer, timer, + trapframe, twai, uart, utils, + xtensa_lx, Cpu, Delay, PulseControl, @@ -129,8 +132,8 @@ pub unsafe fn startup_direct_boot() -> ! { ); // Initialize RTC RAM - xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); - xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); // first of all copy rwtext extern "C" { @@ -165,7 +168,7 @@ pub unsafe fn startup_direct_boot() -> ! { .sysclk_conf .modify(|_, w| w.soc_clk_sel().bits(1)); - xtensa_lx_rt::Reset(); + esp_hal_common::xtensa_lx_rt::Reset(); } #[cfg(feature = "rt")] @@ -222,17 +225,17 @@ pub unsafe extern "C" fn ESP32Reset() -> ! { } // set stack pointer to end of memory: no need to retain stack up to this point - xtensa_lx::set_stack_pointer(&mut _stack_end_cpu0); + esp_hal_common::xtensa_lx::set_stack_pointer(&mut _stack_end_cpu0); // copying data from flash to various data segments is done by the bootloader // initialization to zero needs to be done by the application // Initialize RTC RAM - xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); - xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end); + esp_hal_common::xtensa_lx_rt::zero_bss(&mut _rtc_slow_bss_start, &mut _rtc_slow_bss_end); // continue with default reset handler - xtensa_lx_rt::Reset(); + esp_hal_common::xtensa_lx_rt::Reset(); } /// The ESP32 has a first stage bootloader that handles loading program data