Skip to content

apps/cmake: Fix aarch64 NuttX Rust target specs#3510

Open
toku-mac wants to merge 1 commit into
apache:masterfrom
toku-mac:fix_aarch64_target_specs
Open

apps/cmake: Fix aarch64 NuttX Rust target specs#3510
toku-mac wants to merge 1 commit into
apache:masterfrom
toku-mac:fix_aarch64_target_specs

Conversation

@toku-mac
Copy link
Copy Markdown
Contributor

Summary

Previously, aarch64 sim builds on macOS used aarch64-apple-darwin,
which sets target_os=macos and causes NuttX-specific cfg guards to be silently skipped.

This PR adds two custom Rust target JSON files:

  • tools/aarch64-unknown-nuttx.json — ELF target for Linux/bare-metal
  • tools/aarch64-unknown-nuttx-macho.json — Mach-O target for macOS sim

Rust.mk and cmake/nuttx_add_rust.cmake are updated to select the
appropriate target.

Depends on the corresponding nuttx-side PR. #18992

Impact

Allows proper building of sim on Apple Silicon Macs and aarch64 Linux.
(Support for Intel Macs will be considered separately.)

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host(s): OS (macOS 26.5), CPU(Apple M1), compiler(Apple clang version 21.0.0)
  • Target(s): arch(sim)
  • Ensure your PATH environment variable is properly configured to allow execution of: menuconfig, olddefconfig, savedefconfig, and setconfig.
  • Use the Rust toolchain version prior to nightly-2026-04-29 to avoid errors related to lib/rustlib/src/rust/library/std/src/sys/net/connection/socket/unix.rs.
  • This PR is a successor of PR #18978

PR verification Self-Check

  • My PR adheres to Contributing Guidelines and Documentation (git commit title and message, coding standard, etc).
  • My PR is ready for review and can be safely merged into a codebase.

Comment thread tools/aarch64-unknown-nuttx-macho.json Outdated
Add aarch64 Rust target specs for NuttX, including a Mach-O variant
for macOS sim builds. Use the NuttX custom targets instead of
aarch64-apple-darwin so Rust std is built with target_os=nuttx while
still producing link-compatible objects for sim.

Signed-off-by: Shoji Tokunaga <toku@mac.com>
@toku-mac toku-mac force-pushed the fix_aarch64_target_specs branch from 77b62fc to 6e58319 Compare May 29, 2026 14:10
@toku-mac
Copy link
Copy Markdown
Contributor Author

Since the PR on the nuttx git repository has been merged into master, I've decided not to move the tools/aarch64-unknown-nuttx.json file from the apps git.
Please review commit 6e58319.

@xiaoxiang781216
Copy link
Copy Markdown
Contributor

Since the PR on the nuttx git repository has been merged into master, I've decided not to move the tools/aarch64-unknown-nuttx.json file from the apps git. Please review commit 6e58319.

but it's better to create a new patch to put all json config in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants