Skip to content

Commit

Permalink
Initial support for NuttX (rust-lang#3909)
Browse files Browse the repository at this point in the history
Define the essential types that for NuttX OS.

Signed-off-by: Huang Qi <[email protected]>
  • Loading branch information
no1wudi committed Oct 10, 2024
1 parent 42d1000 commit 490cc21
Show file tree
Hide file tree
Showing 3 changed files with 567 additions and 3 deletions.
5 changes: 4 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const ALLOWED_CFGS: &'static [&'static str] = &[

// Extra values to allow for check-cfg.
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
("target_os", &["switch", "aix", "ohos", "hurd", "visionos"]),
(
"target_os",
&["switch", "aix", "ohos", "hurd", "visionos", "nuttx"],
),
("target_env", &["illumos", "wasi", "aix", "ohos"]),
(
"target_arch",
Expand Down
10 changes: 8 additions & 2 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,11 @@ extern "C" {
}

cfg_if! {
if #[cfg(any(target_os = "l4re", target_os = "espidf"))] {
// required libraries for L4Re and the ESP-IDF framework are linked externally, ATM
if #[cfg(any(target_os = "l4re", target_os = "espidf", target_os = "nuttx"))] {
// required libraries are linked externally for these platforms:
// * L4Re
// * ESP-IDF
// * NuttX
} else if #[cfg(feature = "std")] {
// cargo build, don't pull in anything extra as the std dep
// already pulls in all libs.
Expand Down Expand Up @@ -1617,6 +1620,9 @@ cfg_if! {
} else if #[cfg(target_os = "hurd")] {
mod hurd;
pub use self::hurd::*;
} else if #[cfg(target_os = "nuttx")] {
mod nuttx;
pub use self::nuttx::*;
} else {
// Unknown target_os
}
Expand Down
Loading

0 comments on commit 490cc21

Please sign in to comment.