From 30af7388a4077354f6083082fee040595978bbac Mon Sep 17 00:00:00 2001 From: yan hu Date: Fri, 7 Aug 2026 18:05:09 +0800 Subject: [rust][tools] Fix Rust build example configuration handling Improve the Rust build integration across core, applications, components, and module examples. Fix build failure propagation, target and feature handling, linker flags, example configuration semantics, and add STM32 CI attach coverage. --- components/rust/core/src/api/mod.rs | 2 ++ components/rust/core/src/api/queue.rs | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'components/rust/core/src/api') diff --git a/components/rust/core/src/api/mod.rs b/components/rust/core/src/api/mod.rs index 8fc2ba2301..cf3d0bbc0c 100644 --- a/components/rust/core/src/api/mod.rs +++ b/components/rust/core/src/api/mod.rs @@ -14,6 +14,7 @@ pub mod thread; pub mod mutex; pub mod sem; pub mod queue; +#[cfg(feature = "libdl")] pub mod libloading; @@ -24,4 +25,5 @@ pub use thread::*; pub use mutex::*; pub use sem::*; pub use queue::*; +#[cfg(feature = "libdl")] pub use libloading::*; diff --git a/components/rust/core/src/api/queue.rs b/components/rust/core/src/api/queue.rs index 96665e47f2..8a77374b90 100644 --- a/components/rust/core/src/api/queue.rs +++ b/components/rust/core/src/api/queue.rs @@ -20,7 +20,7 @@ pub type APIRawQueue = rt_mq_t; pub(crate) fn queue_create(name: &str, len: u64, message_size: u64) -> Option { let s = CString::new(name).unwrap(); let raw; - unsafe { raw = rt_mq_create(s.as_ptr(), message_size, len, 0) } + unsafe { raw = rt_mq_create(s.as_ptr(), message_size as rt_size_t, len as rt_size_t, 0) } if raw == ptr::null_mut() { None } else { @@ -35,7 +35,7 @@ pub(crate) fn queue_send_wait( msg_size: u64, tick: i32, ) -> RttCResult { - unsafe { rt_mq_send_wait(handle, msg, msg_size, tick).into() } + unsafe { rt_mq_send_wait(handle, msg, msg_size as rt_size_t, tick).into() } } #[inline] @@ -45,7 +45,12 @@ pub(crate) fn queue_receive_wait( msg_size: u64, tick: i32, ) -> RttCResult { - unsafe { rt_mq_recv(handle, msg, msg_size, tick).into() } + let ret = unsafe { rt_mq_recv(handle, msg, msg_size as rt_size_t, tick) }; + if ret >= 0 { + RttCResult::Ok + } else { + ret.into() + } } #[inline] -- cgit v1.3.1