Skip to content

Commit 4c6a4b7

Browse files
no1wuditgross35
authored andcommitted
Initial support for NuttX (rust-lang#3909)
Define the essential types that for NuttX OS. Signed-off-by: Huang Qi <[email protected]> (backport <rust-lang#3909>) (cherry picked from commit c31dfc1)
1 parent 80e055a commit 4c6a4b7

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
@@ -37,7 +37,9 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
3737
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
3838
(
3939
"target_os",
40-
&["switch", "aix", "ohos", "hurd", "rtems", "visionos"],
40+
&[
41+
"switch", "aix", "ohos", "hurd", "rtems", "visionos", "nuttx",
42+
],
4143
),
4244
("target_env", &["illumos", "wasi", "aix", "ohos"]),
4345
(

src/unix/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,11 @@ extern "C" {
319319
}
320320

321321
cfg_if! {
322-
if #[cfg(any(target_os = "l4re", target_os = "espidf"))] {
323-
// required libraries for L4Re and the ESP-IDF framework are linked externally, ATM
322+
if #[cfg(any(target_os = "l4re", target_os = "espidf", target_os = "nuttx"))] {
323+
// required libraries are linked externally for these platforms:
324+
// * L4Re
325+
// * ESP-IDF
326+
// * NuttX
324327
} else if #[cfg(feature = "std")] {
325328
// cargo build, don't pull in anything extra as the std dep
326329
// already pulls in all libs.
@@ -1617,6 +1620,9 @@ cfg_if! {
16171620
} else if #[cfg(target_os = "hurd")] {
16181621
mod hurd;
16191622
pub use self::hurd::*;
1623+
} else if #[cfg(target_os = "nuttx")] {
1624+
mod nuttx;
1625+
pub use self::nuttx::*;
16201626
} else {
16211627
// Unknown target_os
16221628
}

0 commit comments

Comments
 (0)