Skip to content

Commit a53e8f8

Browse files
cmake: support armv8r target for Cortex-R52
This commit adds Rust build support for the Cortex-R52 CPU type. Signed-off-by: Matthew Richey <[email protected]>
1 parent c94328f commit a53e8f8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ function(_rust_map_target)
4949
else()
5050
message(FATAL_ERROR "Rust: Unsupported riscv ISA")
5151
endif()
52+
elseif(CONFIG_CPU_CORTEX_R52)
53+
set(RUST_TARGET "armv8r-none-eabihf" PARENT_SCOPE)
54+
55+
# build core (and maybe also alloc) from source for tier 3 target
56+
if(CONFIG_RUST_ALLOC)
57+
set(CARGO_EXTRA_FLAGS -Z build-std=core,alloc PARENT_SCOPE)
58+
else()
59+
set(CARGO_EXTRA_FLAGS -Z build-std=core PARENT_SCOPE)
60+
endif()
5261
else()
5362
message(FATAL_ERROR "Rust: Add support for other target")
5463
endif()
@@ -182,6 +191,7 @@ ${config_paths}
182191
${command_paths}
183192
--target ${RUST_TARGET}
184193
--target-dir ${CARGO_TARGET_DIR}
194+
${CARGO_EXTRA_FLAGS}
185195
COMMENT "Building Rust application"
186196
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
187197
)

Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ menu "Rust Language Support"
88
config RUST_SUPPORTED
99
bool
1010
default y if ((CPU_CORTEX_M || \
11+
CPU_CORTEX_R52 || \
1112
(RISCV && !RISCV_ISA_RV32E && !RISCV_ISA_RV128I)) && \
1213
!TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
1314
help

0 commit comments

Comments
 (0)