diff --git a/Cargo.toml b/Cargo.toml index d1af23f6b0fe9b5f5a6a7fbd40daaacdc49f08cc..d0d582ac3e7524e66be094208f5fec48f88eef20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cortex-m-debug" -version = "0.1.0" +version = "0.1.1" authors = ["Per Lindgren <per.lindgren@ltu.se>"] [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 73ebcb549f57ca193f7b1124dd6f20880b62b155..102138500fe80cf3e91a072f42630f495cecc686 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,18 +4,24 @@ #[macro_export] macro_rules! ip { ($s:expr) => { - #[allow(unsafe_code)] - cortex_m::itm::write_str( - unsafe { &(&*cortex_m::peripheral::ITM.get()).stim[0] }, - $s - ); + { + extern crate cortex_m; + #[allow(unsafe_code)] + cortex_m::itm::write_str( + unsafe { &(&*cortex_m::peripheral::ITM.get()).stim[0] }, + $s + ); + } }; ($($arg:tt)*) => { - #[allow(unsafe_code)] - cortex_m::itm::write_fmt( - unsafe { &(&*cortex_m::peripheral::ITM.get()).stim[0] }, - format_args!($($arg)* - )); + { + extern crate cortex_m; + #[allow(unsafe_code)] + cortex_m::itm::write_fmt( + unsafe { &(&*cortex_m::peripheral::ITM.get()).stim[0] }, + format_args!($($arg)*) + ); + } } }