cmake: Add Renesas RX support

This commit add toolchain command line option for the RX
architecture support

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
This commit is contained in:
Duy Nguyen 2025-03-31 12:02:42 +07:00 committed by Benjamin Cabé
parent 5fabd3634a
commit 65ad2b0883
2 changed files with 38 additions and 0 deletions

View File

@ -78,6 +78,8 @@ elseif("${ARCH}" STREQUAL "mips")
include(${CMAKE_CURRENT_LIST_DIR}/target_mips.cmake)
elseif("${ARCH}" STREQUAL "xtensa")
include(${CMAKE_CURRENT_LIST_DIR}/target_xtensa.cmake)
elseif("${ARCH}" STREQUAL "rx")
include(${CMAKE_CURRENT_LIST_DIR}/target_rx.cmake)
endif()
if(SYSROOT_DIR)

View File

@ -0,0 +1,36 @@
# SPDX-License-Identifier: Apache-2.0
list(APPEND TOOLCHAIN_C_FLAGS)
list(APPEND TOOLCHAIN_C_FLAGS -mlittle-endian-data -ffunction-sections -fdata-sections)
list(APPEND TOOLCHAIN_LD_FLAGS)
list(APPEND TOOLCHAIN_LD_FLAGS -mlittle-endian-data)
if(NOT CONFIG_PICOLIBC)
list(APPEND TOOLCHAIN_LD_FLAGS -lm)
endif()
if(NOT CONFIG_FPU)
list(APPEND TOOLCHAIN_C_FLAGS -nofpu)
endif()
if("cross-compile" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT})
if(CONFIG_CPU_RXV1)
list(APPEND TOOLCHAIN_C_FLAGS -misa=v1)
list(APPEND TOOLCHAIN_LD_FLAGS -misa=v1)
elseif(CONFIG_CPU_RXV2)
list(APPEND TOOLCHAIN_C_FLAGS -misa=v2)
list(APPEND TOOLCHAIN_LD_FLAGS -misa=v2)
else()
list(APPEND TOOLCHAIN_C_FLAGS -misa=v3)
list(APPEND TOOLCHAIN_LD_FLAGS -misa=v3)
endif()
elseif("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT})
if(CONFIG_SOC_SERIES_RX130)
list(APPEND TOOLCHAIN_C_FLAGS -mcpu=rx100)
list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=rx100)
elseif(CONFIG_SOC_SERIES_RX62N)
list(APPEND TOOLCHAIN_C_FLAGS -mcpu=rx600)
list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=rx600)
endif()
endif()