mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 06:40:47 +00:00

* Move some linker scripts into `esp-hal-common` and update the build script * Move `EspDefaultHandler` and `DefaultHandler` definitions into `esp-hal-common` * Re-export everything from `esp-hal-common` * Add a couple cfg symbols, cleanup/organize some exports/modules
75 lines
1.7 KiB
Rust
75 lines
1.7 KiB
Rust
#![no_std]
|
|
|
|
pub use embedded_hal as ehal;
|
|
#[cfg(feature = "embassy")]
|
|
pub use esp_hal_common::embassy;
|
|
pub use esp_hal_common::*;
|
|
|
|
pub use self::gpio::IO;
|
|
|
|
/// Common module for analog functions
|
|
pub mod analog {
|
|
pub use esp_hal_common::analog::{AvailableAnalog, SarAdcExt};
|
|
}
|
|
|
|
extern "C" {
|
|
// Boundaries of the .iram section
|
|
static mut _srwtext: u32;
|
|
static mut _erwtext: u32;
|
|
static mut _irwtext: u32;
|
|
|
|
// Boundaries of the .bss section
|
|
static mut _ebss: u32;
|
|
static mut _sbss: u32;
|
|
|
|
// Boundaries of the rtc .bss section
|
|
static mut _rtc_fast_bss_start: u32;
|
|
static mut _rtc_fast_bss_end: u32;
|
|
|
|
// Boundaries of the .rtc_fast.text section
|
|
static mut _srtc_fast_text: u32;
|
|
static mut _ertc_fast_text: u32;
|
|
static mut _irtc_fast_text: u32;
|
|
|
|
// Boundaries of the .rtc_fast.data section
|
|
static mut _rtc_fast_data_start: u32;
|
|
static mut _rtc_fast_data_end: u32;
|
|
static mut _irtc_fast_data: u32;
|
|
}
|
|
|
|
#[cfg(feature = "direct-boot")]
|
|
#[doc(hidden)]
|
|
#[esp_hal_common::esp_riscv_rt::pre_init]
|
|
unsafe fn init() {
|
|
r0::init_data(&mut _srwtext, &mut _erwtext, &_irwtext);
|
|
|
|
r0::init_data(
|
|
&mut _rtc_fast_data_start,
|
|
&mut _rtc_fast_data_end,
|
|
&_irtc_fast_data,
|
|
);
|
|
|
|
r0::init_data(&mut _srtc_fast_text, &mut _ertc_fast_text, &_irtc_fast_text);
|
|
|
|
esp_hal_common::disable_apm_filter();
|
|
}
|
|
|
|
#[allow(unreachable_code)]
|
|
#[export_name = "_mp_hook"]
|
|
#[doc(hidden)]
|
|
pub fn mp_hook() -> bool {
|
|
unsafe {
|
|
r0::zero_bss(&mut _rtc_fast_bss_start, &mut _rtc_fast_bss_end);
|
|
}
|
|
|
|
#[cfg(feature = "direct-boot")]
|
|
return true;
|
|
|
|
// no init data when using normal boot - but we need to zero out BSS
|
|
unsafe {
|
|
r0::zero_bss(&mut _sbss, &mut _ebss);
|
|
}
|
|
|
|
false
|
|
}
|