From 6dfffaa3f97dc571d262090487750691c03cc78b Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sun, 26 Jul 2020 00:24:09 +1200 Subject: [PATCH 1/2] Factor the 'std_stub' module out into the 'avr-std-stub' crate This way it can be reused by other crates. --- src/lib.rs | 2 -- src/std_stub.rs | 15 --------------- 2 files changed, 17 deletions(-) delete mode 100644 src/std_stub.rs diff --git a/src/lib.rs b/src/lib.rs index b205ecf..c537772 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,6 +24,4 @@ pub mod config; mod register; mod pin; -#[doc(hidden)] -pub mod std_stub; diff --git a/src/std_stub.rs b/src/std_stub.rs deleted file mode 100644 index 53cd096..0000000 --- a/src/std_stub.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! Stub methods that `libstd` normally defines. - -// These do not need to be in a module, but we group them here for clarity. -pub mod std { - #[lang = "eh_personality"] - #[no_mangle] - pub unsafe extern "C" fn rust_eh_personality(_state: (), _exception_object: *mut (), _context: *mut ()) -> () { - } - - #[panic_handler] - fn panic(_info: &::core::panic::PanicInfo) -> ! { - loop {} - } -} - From 869113a693becf3ee466020c2dd5ae218402266b Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sun, 26 Jul 2020 00:33:58 +1200 Subject: [PATCH 2/2] Use the std stub definitions from the 'avr-std-stub' crate --- Cargo.toml | 1 + src/lib.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 4068c77..09125be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ build = "core_generator/build.rs" keywords = ["avr", "arduino", "uno"] [dependencies] +avr-std-stub = "1.0" target-cpu-macro = "0.1" [build-dependencies] diff --git a/src/lib.rs b/src/lib.rs index c537772..81759f6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,6 +9,8 @@ #![no_std] +extern crate avr_std_stub; + pub use self::register::{Register, RegisterBits, RegisterValue}; pub use self::pin::{DataDirection, Pin};