diff options
author | 2017-02-28 09:59:03 -0500 | |
---|---|---|
committer | 2017-02-28 10:04:01 -0500 | |
commit | 4979a7d3831cdfd50133edff04711f8190b16021 (patch) | |
tree | 7fdef03c10080df2ae0787f8390325702ebb3387 /src/lib.rs | |
parent | 3f4c581a9cd52c4ad14da2d7008d004a2d888f36 (diff) | |
download | cortex-m-4979a7d3831cdfd50133edff04711f8190b16021.tar.gz cortex-m-4979a7d3831cdfd50133edff04711f8190b16021.tar.zst cortex-m-4979a7d3831cdfd50133edff04711f8190b16021.zip |
changes to better integrate with svd2rust
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -7,25 +7,30 @@ //! - Interrupt manipulation mechanisms //! - Data structures like the vector table //! - Miscellaneous assembly instructions like `bkpt` -//! +#![cfg_attr(feature = "semihosting", feature(macro_reexport))] #![deny(missing_docs)] #![deny(warnings)] #![feature(asm)] #![feature(const_fn)] +#![feature(core_intrinsics)] +#![feature(naked_functions)] #![no_std] +#[cfg(feature = "semihosting")] +pub extern crate cortex_m_semihosting as semihosting; extern crate volatile_register; +#[macro_use] +mod macros; + +#[macro_use] pub mod asm; +pub mod exception; pub mod interrupt; pub mod peripheral; pub mod register; -mod exception; - -pub use exception::Exception; - /// Stack frame #[repr(C)] pub struct StackFrame { @@ -82,14 +87,22 @@ pub struct VectorTable { pub interrupts: [Option<Handler>; 0], } -/// Returns the vector table -pub fn vector_table() -> &'static VectorTable { - unsafe { deref(peripheral::scb().vtor.read() as usize) } +/// A reserved spot in the vector table +#[derive(Clone, Copy)] +#[repr(u32)] +pub enum Reserved { + /// Reserved + Vector = 0, } /// Exception/Interrupt Handler pub type Handler = unsafe extern "C" fn(); +/// Returns the vector table +pub fn vector_table() -> &'static VectorTable { + unsafe { deref(peripheral::scb().vtor.read() as usize) } +} + #[cfg(test)] fn address<T>(r: &T) -> usize { r as *const T as usize |