Merged
Conversation
X86 support for Rust needs more test and verification, and not upstreamed to Rust side yet. It's better to use custom target triples for x86 by json files for now, and it can be upstreamed to Rust side if stable enough. Changed the Rust target triples in the CMake configuration to reference JSON files for x86_64 and i486 architectures. This improves the build process by providing more detailed target specifications. * Added JSON files for i486 and x86_64 targets * Updated CMake functions to use the new target triples * Enhanced build directory structure for Rust crates Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Remove quotes around target-pointer-width values in i486 and x86_64 target configuration files to change from string to numeric type. This change is required due to recent rustc JSON format modifications that expect numeric values instead of strings for target-pointer-width. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
1 task
simbit18
approved these changes
Mar 13, 2026
lupyuen
approved these changes
Mar 13, 2026
cederom
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds JSON-based target specification files for x86 and x86_64 architectures to enable Rust support on NuttX RTOS with proper target configuration.
Why change is necessary?
X86 support for Rust in NuttX is still under development and has not been upstreamed to the Rust compiler yet. The default Rust target triples for x86 architectures do not properly support NuttX-specific requirements such as soft-float, proper ABI settings, and NuttX-specific linker configurations.
What functional part of the code is being changed?
cmake/nuttx_add_rust.cmake- Updated to use JSON target specification files for x86/x86_64 architecturestools/Rust.mk- Updated build configurationtools/x86_64-unknown-nuttx.jsonandtools/i486-unknown-nuttx.jsonHow does the change exactly work?
x86_64-unknown-nuttx,i686-unknown-nuttx), the build system now references custom JSON target specification filesx86-softfloat)nuttx_rust_target_triple()now returns the path to JSON files for x86 architecturesKey changes:
target-pointer-widthtype from string to numeric to comply with recent rustc JSON format requirementsImpact
YES - New feature: Adds JSON-based target specification support for x86/x86_64 Rust builds on NuttX
NO - This is a build system improvement that is transparent to end users. Developers building Rust applications for x86 NuttX targets will automatically benefit from the proper target configuration.
YES - The build process for Rust applications on x86/x86_64 architectures will now use custom JSON target specifications instead of relying on built-in Rust target triples. This provides more accurate and maintainable target configurations.
YES - Affects x86 and x86_64 architectures. Enables proper Rust support with soft-float and correct ABI settings for these architectures on NuttX.
NO - The change is internal to the build system and does not require documentation updates for general users.
NO - This change only affects build configuration and does not introduce security implications.
NO - This is a new feature addition and does not break existing functionality. Future compatibility is improved as we can now maintain our own target specifications independent of Rust upstream.
Once x86 Rust support stabilizes and is upstreamed to the Rust compiler, we can consider removing these custom JSON files and using the built-in target triples.
Testing
I confirm that changes are verified on local setup and works as intended:
Build Host(s):
Target(s):