Skip to content

Commit 490cc21

Browse files
committed
Initial support for NuttX (#3909)
Define the essential types that for NuttX OS. Signed-off-by: Huang Qi <[email protected]>
1 parent 42d1000 commit 490cc21

File tree

3 files changed

+567
-3
lines changed

3 files changed

+567
-3
lines changed

build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
3535

3636
// Extra values to allow for check-cfg.
3737
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
38-
("target_os", &["switch", "aix", "ohos", "hurd", "visionos"]),
38+
(
39+
"target_os",
40+
&["switch", "aix", "ohos", "hurd", "visionos", "nuttx"],
41+
),
3942
("target_env", &["illumos", "wasi", "aix", "ohos"]),
4043
(
4144
"target_arch",

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)