From cc5bca8e83b4fe372d8d87b35d82ff466d1a290a Mon Sep 17 00:00:00 2001 From: Peter Krull Date: Sun, 23 Apr 2023 15:50:46 +0200 Subject: [PATCH] Added feature flag to embassy-rp intrinsics to avoid conflicts with rp2040-hal --- embassy-rp/src/intrinsics.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/embassy-rp/src/intrinsics.rs b/embassy-rp/src/intrinsics.rs index 3b63846d..50934e04 100644 --- a/embassy-rp/src/intrinsics.rs +++ b/embassy-rp/src/intrinsics.rs @@ -402,6 +402,7 @@ macro_rules! division_function { }; } +#[cfg(all(target_arch = "arm", feature = "intrinsics"))] division_function! { unsigned_divmod __aeabi_uidivmod __aeabi_uidiv ( u32 ) { "str r0, [r2, #0x060]", // DIV_UDIVIDEND @@ -409,6 +410,7 @@ division_function! { } } +#[cfg(all(target_arch = "arm", feature = "intrinsics"))] division_function! { signed_divmod __aeabi_idivmod __aeabi_idiv ( i32 ) { "str r0, [r2, #0x068]", // DIV_SDIVIDEND @@ -416,6 +418,7 @@ division_function! { } } +#[cfg(all(target_arch = "arm", feature = "intrinsics"))] fn divider_unsigned(n: u32, d: u32) -> DivResult { let packed = unsafe { unsigned_divmod(n, d) }; DivResult { @@ -424,6 +427,7 @@ fn divider_unsigned(n: u32, d: u32) -> DivResult { } } +#[cfg(all(target_arch = "arm", feature = "intrinsics"))] fn divider_signed(n: i32, d: i32) -> DivResult { let packed = unsafe { signed_divmod(n, d) }; // Double casts to avoid sign extension @@ -441,6 +445,7 @@ struct DivResult { pub remainder: T, } +#[cfg(all(target_arch = "arm", feature = "intrinsics"))] intrinsics! { extern "C" fn __udivsi3(n: u32, d: u32) -> u32 { divider_unsigned(n, d).quotient