Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/Rust: Add support for x86 platform #2980

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmake/nuttx_add_rust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ include(nuttx_parse_function_args)
# - thumbv8m.base: thumbv8m.base-nuttx-eabi, thumbv8m.base-nuttx-eabihf
# - riscv32: riscv32imc/imac/imafc-unknown-nuttx-elf
# - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
#
# Inputs:
# ARCHTYPE - Architecture type (e.g. thumbv7m, riscv32)
Expand All @@ -45,7 +47,11 @@ include(nuttx_parse_function_args)
# ~~~

function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
if(ARCHTYPE MATCHES "thumb")
if(ARCHTYPE STREQUAL "x86_64")
set(TARGET_TRIPLE "x86_64-unknown-nuttx")
elseif(ARCHTYPE STREQUAL "x86")
set(TARGET_TRIPLE "i686-unknown-nuttx")
elseif(ARCHTYPE MATCHES "thumb")
if(ARCHTYPE MATCHES "thumbv8m")
# Extract just the base architecture type (thumbv8m.main or thumbv8m.base)
if(ARCHTYPE MATCHES "thumbv8m.main")
Expand Down
8 changes: 8 additions & 0 deletions tools/Rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# - LLVM_CPUTYPE: CPU type (e.g. cortex-m23, sifive-e20)
#
# Supported architectures and their target triples:
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
# - armv7a: armv7a-nuttx-eabi, armv7a-nuttx-eabihf
# - thumbv6m: thumbv6m-nuttx-eabi
# - thumbv7a: thumbv7a-nuttx-eabi, thumbv7a-nuttx-eabihf
Expand All @@ -44,6 +46,12 @@

define RUST_TARGET_TRIPLE
$(or \
$(and $(filter x86_64,$(LLVM_ARCHTYPE)), \
x86_64-unknown-nuttx \
), \
$(and $(filter x86,$(LLVM_ARCHTYPE)), \
i686-unknown-nuttx \
), \
$(and $(filter thumb%,$(LLVM_ARCHTYPE)), \
$(if $(filter thumbv8m%,$(LLVM_ARCHTYPE)), \
$(if $(filter cortex-m23,$(LLVM_CPUTYPE)),thumbv8m.base,thumbv8m.main)-nuttx-$(LLVM_ABITYPE), \
Expand Down
Loading