Skip to content
Open
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: 7 additions & 3 deletions cmake/nuttx_add_rust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ include(nuttx_parse_function_args)
# - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
# - x86: i686-unknown-nuttx
# - x86_64: x86_64-unknown-nuttx
# - aarch64: aarch64-apple-darwin
# - aarch64: aarch64-unknown-nuttx-macho for sim on macOS,
# aarch64-unknown-nuttx otherwise
#
# Inputs:
# ARCHTYPE - Architecture type (e.g. thumbv7m, riscv32)
Expand All @@ -55,8 +56,11 @@ function(nuttx_rust_target_triple ARCHTYPE ABITYPE CPUTYPE OUTPUT)
elseif(ARCHTYPE STREQUAL "x86")
set(TARGET_TRIPLE "${APPDIR}/tools/i486-unknown-nuttx.json")
elseif(ARCHTYPE STREQUAL "aarch64")
if(APPLE)
set(TARGET_TRIPLE "aarch64-apple-darwin")
if(CONFIG_ARCH_SIM AND CONFIG_HOST_MACOS)
set(TARGET_TRIPLE
"${PROJECT_SOURCE_DIR}/tools/aarch64-unknown-nuttx-macho.json")
else()
set(TARGET_TRIPLE "${APPDIR}/tools/aarch64-unknown-nuttx.json")
endif()
elseif(ARCHTYPE MATCHES "thumb")
if(ARCHTYPE MATCHES "thumbv8m")
Expand Down
7 changes: 6 additions & 1 deletion tools/Rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
# - thumbv8m.base: thumbv8m.base-nuttx-eabi, thumbv8m.base-nuttx-eabihf
# - riscv32: riscv32imc/imac/imafc-unknown-nuttx-elf
# - riscv64: riscv64imac/imafdc-unknown-nuttx-elf
# - aarch64: aarch64-unknown-nuttx-macho for sim on macOS,
# aarch64-unknown-nuttx otherwise
#
# Usage: $(call RUST_TARGET_TRIPLE)
#
Expand All @@ -53,7 +55,10 @@ $(or \
$(APPDIR)/tools/i486-unknown-nuttx.json \
), \
$(and $(filter aarch64,$(LLVM_ARCHTYPE)), \
$(if $(filter y,$(CONFIG_HOST_MACOS)),aarch64-apple-darwin) \
$(if $(and $(filter sim,$(CONFIG_ARCH)),$(filter y,$(CONFIG_HOST_MACOS))), \
$(TOPDIR)/tools/aarch64-unknown-nuttx-macho.json, \
$(APPDIR)/tools/aarch64-unknown-nuttx.json \
) \
), \
$(and $(filter thumb%,$(LLVM_ARCHTYPE)), \
$(if $(filter thumbv8m%,$(LLVM_ARCHTYPE)), \
Expand Down
42 changes: 42 additions & 0 deletions tools/aarch64-unknown-nuttx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"arch": "aarch64",
"crt-objects-fallback": "false",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32",
"default-uwtable": true,
"disable-redzone": true,
"features": "+v8a,+strict-align,+neon",
"linker": "rust-lld",
"linker-flavor": "gnu-lld",
"llvm-target": "aarch64-unknown-nuttx",
"max-atomic-width": 128,
"metadata": {
"description": "aarch64 target for NuttX RTOS",
"host_tools": false,
"std": true,
"tier": 3
},
"os": "nuttx",
"panic-strategy": "abort",
"pre-link-args": {
"gnu": [
"--fix-cortex-a53-843419"
],
"gnu-lld": [
"--fix-cortex-a53-843419"
]
},
"relocation-model": "static",
"stack-probes": {
"kind": "inline"
},
"supported-sanitizers": [
"kcfi",
"kernel-address",
"kernel-hwaddress"
],
"supports-xray": true,
"target-family": [
"unix"
],
"target-pointer-width": 64
}
Loading