Skip to content
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
10 changes: 8 additions & 2 deletions cmake/nuttx_add_rust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ include(nuttx_parse_function_args)
# - riscv32: riscv32imc/imac/imafc-unknown-nuttx-elf
# - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx-macho for sim on macOS,
# x86_64-unknown-nuttx otherwise
# - aarch64: aarch64-unknown-nuttx-macho for sim on macOS,
# aarch64-unknown-nuttx otherwise
#
Expand All @@ -50,7 +51,12 @@ include(nuttx_parse_function_args)

function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
if(ARCHTYPE STREQUAL "x86_64")
set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/x86_64-unknown-nuttx.json")
if(CONFIG_ARCH_SIM AND CONFIG_HOST_MACOS)
set(TARGET_TRIPLE
"${PROJECT_SOURCE_DIR}/tools/x86_64-unknown-nuttx-macho.json")
else()
set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/x86_64-unknown-nuttx.json")
endif()
elseif(ARCHTYPE STREQUAL "x86")
set(TARGET_TRIPLE "${PROJECT_SOURCE_DIR}/tools/i486-unknown-nuttx.json")
elseif(ARCHTYPE STREQUAL "aarch64")
Expand Down
10 changes: 7 additions & 3 deletions tools/Rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#
# Supported architectures and their target triples:
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx-macho for sim on macOS,
# x86_64-unknown-nuttx otherwise
# - armv7a: armv7a-nuttx-eabi, armv7a-nuttx-eabihf
# - thumbv6m: thumbv6m-nuttx-eabi
# - thumbv7a: thumbv7a-nuttx-eabi, thumbv7a-nuttx-eabihf
Expand All @@ -49,13 +50,16 @@
define RUST_TARGET_TRIPLE
$(or \
$(and $(filter x86_64,$(LLVM_ARCHTYPE)), \
$(TOPDIR)/tools/x86_64-unknown-nuttx.json \
$(if $(and $(filter y,$(CONFIG_ARCH_SIM)),$(filter y,$(CONFIG_HOST_MACOS))), \
$(TOPDIR)/tools/x86_64-unknown-nuttx-macho.json, \
$(TOPDIR)/tools/x86_64-unknown-nuttx.json \
) \
), \
$(and $(filter x86,$(LLVM_ARCHTYPE)), \
$(TOPDIR)/tools/i486-unknown-nuttx.json \
), \
$(and $(filter aarch64,$(LLVM_ARCHTYPE)), \
$(if $(and $(filter sim,$(CONFIG_ARCH)),$(filter y,$(CONFIG_HOST_MACOS))), \
$(if $(and $(filter y,$(CONFIG_ARCH_SIM)),$(filter y,$(CONFIG_HOST_MACOS))), \
$(TOPDIR)/tools/aarch64-unknown-nuttx-macho.json, \
$(TOPDIR)/tools/aarch64-unknown-nuttx.json \
) \
Expand Down
Loading