Skip to content

Commit c31dfc1

Browse files
authored
Initial support for NuttX (rust-lang#3909)
Define the essential types that for NuttX OS. Signed-off-by: Huang Qi <[email protected]>
1 parent 433d019 commit c31dfc1

File tree

3 files changed

+566
-3
lines changed

3 files changed

+566
-3
lines changed

build.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
2424
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
2525
(
2626
"target_os",
27-
&["switch", "aix", "ohos", "hurd", "rtems", "visionos"],
27+
&[
28+
"switch", "aix", "ohos", "hurd", "rtems", "visionos", "nuttx",
29+
],
2830
),
2931
("target_env", &["illumos", "wasi", "aix", "ohos"]),
3032
(

src/unix/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,11 @@ extern "C" {
326326
}
327327

328328
cfg_if! {
329-
if #[cfg(any(target_os = "l4re", target_os = "espidf"))] {
330-
// required libraries for L4Re and the ESP-IDF framework are linked externally, ATM
329+
if #[cfg(any(target_os = "l4re", target_os = "espidf", target_os = "nuttx"))] {
330+
// required libraries are linked externally for these platforms:
331+
// * L4Re
332+
// * ESP-IDF
333+
// * NuttX
331334
} else if #[cfg(feature = "std")] {
332335
// cargo build, don't pull in anything extra as the std dep
333336
// already pulls in all libs.
@@ -1610,6 +1613,9 @@ cfg_if! {
16101613
} else if #[cfg(target_os = "hurd")] {
16111614
mod hurd;
16121615
pub use self::hurd::*;
1616+
} else if #[cfg(target_os = "nuttx")] {
1617+
mod nuttx;
1618+
pub use self::nuttx::*;
16131619
} else {
16141620
// Unknown target_os
16151621
}

0 commit comments

Comments
 (0)