mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
tools: Enable Rust sim builds on Intel Macs
Add support for building Rust apps on the NuttX simulator running on Intel (x86_64) macOS. - Add tools/x86_64-unknown-nuttx-macho.json, a Mach-O Rust target for the macOS sim. - Rust.defs: select the new x86_64 macho target for sim on macOS. - boards/sim/.../Make.defs: keep the default PIC/PIE-compatible code generation on macOS by not adding -fno-pic/-mcmodel=medium. - sethost.sh: enable CONFIG_HOST_X86_64 for non-arm64 hosts. Signed-off-by: Shoji Tokunaga <toku@mac.com>
This commit is contained in:
parent
3c8621cb89
commit
59a66fa17d
5 changed files with 57 additions and 5 deletions
|
|
@ -46,6 +46,8 @@ ifeq ($(CONFIG_ARCH_SIM),y)
|
|||
else ifeq ($(CONFIG_HOST_MACOS),y)
|
||||
ifeq ($(LLVM_ARCHTYPE),aarch64)
|
||||
RUSTFLAGS += --target $(TOPDIR)/tools/aarch64-unknown-nuttx-macho.json
|
||||
else ifeq ($(LLVM_ARCHTYPE),x86_64)
|
||||
RUSTFLAGS += --target $(TOPDIR)/tools/x86_64-unknown-nuttx-macho.json
|
||||
else
|
||||
$(error Unsupported Rust SIM target on macOS: LLVM_ARCHTYPE=$(LLVM_ARCHTYPE))
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
},
|
||||
"os": "nuttx",
|
||||
"panic-strategy": "abort",
|
||||
"relocation-model": "pic",
|
||||
"split-debuginfo": "off",
|
||||
"stack-probes": {
|
||||
"kind": "inline"
|
||||
|
|
|
|||
|
|
@ -191,6 +191,9 @@ if [ "X$host" == "Xlinux" -o "X$host" == "Xmacos" -o "X$host" == "Xbsd" ]; then
|
|||
if [ "X$cpu" == "Xarm64" ]; then
|
||||
echo " Select CONFIG_HOST_ARM64=y"
|
||||
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_ARM64
|
||||
else
|
||||
echo " Select CONFIG_HOST_X86_64=y"
|
||||
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_X86_64
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
36
tools/x86_64-unknown-nuttx-macho.json
Normal file
36
tools/x86_64-unknown-nuttx-macho.json
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"arch": "x86_64",
|
||||
"archive-format": "darwin",
|
||||
"binary-format": "mach-o",
|
||||
"cpu": "x86-64",
|
||||
"crt-objects-fallback": "false",
|
||||
"data-layout": "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
|
||||
"debuginfo-kind": "dwarf",
|
||||
"default-uwtable": true,
|
||||
"disable-redzone": true,
|
||||
"emit-debug-gdb-scripts": false,
|
||||
"frame-pointer": "always",
|
||||
"function-sections": false,
|
||||
"linker-flavor": "gnu-lld",
|
||||
"lld-flavor": "darwin",
|
||||
"llvm-target": "x86_64-apple-macosx",
|
||||
"max-atomic-width": 64,
|
||||
"metadata": {
|
||||
"description": "x86_64 Mach-O target for NuttX sim on macOS",
|
||||
"host_tools": false,
|
||||
"std": true,
|
||||
"tier": 3
|
||||
},
|
||||
"os": "nuttx",
|
||||
"panic-strategy": "abort",
|
||||
"relocation-model": "pic",
|
||||
"split-debuginfo": "off",
|
||||
"stack-probes": {
|
||||
"kind": "inline"
|
||||
},
|
||||
"target-family": [
|
||||
"unix"
|
||||
],
|
||||
"target-pointer-width": 64,
|
||||
"vendor": "unknown"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue