Skip to content

Commit a871c7f

Browse files
committed
Add support for board native_sim/native/64
This allows the native_sim/native/64 target to build on both x86_64 and aarch64 Linux. Currently 32-bit native_sim is not supported, as upstream rust does not build std/core/alloc for the unknown-none variants of these targets. This adds the "zephyr,sim-flash" device so that the generated DT will compile. Based on a contribution by: Author: Evan Perry Grove <[email protected]> Date: Wed Jan 29 13:00:29 2025 -0600 Signed-off-by: Evan Perry Grove <[email protected]> Signed-off-by: David Brown <[email protected]>
1 parent 349164d commit a871c7f

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ jobs:
5454
rustup target add thumbv7em-none-eabi
5555
rustup target add thumbv7m-none-eabi
5656
rustup target add thumbv8m.main-none-eabi
57+
rustup target add x86_64-unknown-none
58+
rustup target add aarch64-unknown-none
5759
5860
# Note that Renode is only provided for x86_64 targets. This matches the github runners.
5961
- name: Install Renode

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ function(_rust_map_target)
4949
else()
5050
message(FATAL_ERROR "Rust: Unsupported riscv ISA")
5151
endif()
52+
elseif(CONFIG_ARCH_POSIX AND CONFIG_64BIT AND (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "x86_64"))
53+
set(RUST_TARGET "x86_64-unknown-none" PARENT_SCOPE)
54+
elseif(CONFIG_ARCH_POSIX AND CONFIG_64BIT AND (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64"))
55+
set(RUST_TARGET "aarch64-unknown-none" PARENT_SCOPE)
5256
else()
5357
message(FATAL_ERROR "Rust: Add support for other target")
5458
endif()

Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ menu "Rust Language Support"
88
config RUST_SUPPORTED
99
bool
1010
default y if ((CPU_CORTEX_M || \
11-
(RISCV && !RISCV_ISA_RV32E && !RISCV_ISA_RV128I)) && \
11+
(RISCV && !RISCV_ISA_RV32E && !RISCV_ISA_RV128I) || \
12+
(ARCH_POSIX && 64BIT)) && \
1213
!TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
1314
help
1415
Selected for platforms that have support for Rust.

dt-rust.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- "nordic,nrf52-flash-controller"
4646
- "nordic,nrf51-flash-controller"
4747
- "raspberrypi,pico-flash-controller"
48+
- "zephyr,sim-flash"
4849
level: 0
4950
actions:
5051
- type: instance

0 commit comments

Comments
 (0)