esp-hal/esp32c2-hal/src/lib.rs
Jesse Braham f7830e2750
Reduce duplication, simplify re-exports, and general cleanup/organization (#424)
* 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
2023-03-08 06:35:59 -08:00

48 lines
967 B
Rust

#![no_std]
pub use embedded_hal as ehal;
#[cfg(feature = "embassy")]
pub use esp_hal_common::embassy;
#[doc(inline)]
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;
}
#[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);
}
#[allow(unreachable_code)]
#[export_name = "_mp_hook"]
#[doc(hidden)]
pub fn mp_hook() -> bool {
if cfg!(feature = "direct-boot") {
true
} else {
unsafe {
r0::zero_bss(&mut _sbss, &mut _ebss);
}
false
}
}