diff options
| author | Frédéric Desbiens <[email protected]> | 2026-06-08 10:01:32 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-06-08 10:01:32 +0200 |
| commit | 87ab09cce305eb9cd4aacac4e8c62af72f665bff (patch) | |
| tree | dd062ebbea5235d1921c64b396bf7e4ce79e9e15 /cmake/threadx_riscv_port.cmake | |
| parent | 9ab0cf9683f832cdb48e2099533a5b06a3afcd64 (diff) | |
| parent | 730b61874bc5cf40768987605ae5187fde0fa1e2 (diff) | |
Merge pull request #544 from eclipse-threadx/devv6.5.1.202602_rel
Merging changes for the v.6.5.1.202602 release
Diffstat (limited to 'cmake/threadx_riscv_port.cmake')
| -rw-r--r-- | cmake/threadx_riscv_port.cmake | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cmake/threadx_riscv_port.cmake b/cmake/threadx_riscv_port.cmake new file mode 100644 index 00000000..99a995ac --- /dev/null +++ b/cmake/threadx_riscv_port.cmake @@ -0,0 +1,50 @@ +# threadx_riscv_port.cmake +# +# Helper function shared by the three RISC-V port CMakeLists files +# (risc-v32/gnu, risc-v32/clang, risc-v64/gnu). +# +# Usage: +# include(cmake/threadx_riscv_port.cmake) +# threadx_add_riscv_port(SRC_DIR <path-to-src> +# INC_DIR <path-to-inc> +# [EXAMPLE_DIR <path-to-example-build>]) +# +# SRC_DIR — directory containing the 8 ThreadX .S port files. +# INC_DIR — directory containing tx_port.h (added as PUBLIC include). +# EXAMPLE_DIR — optional: if provided and contains a CMakeLists.txt, +# add_subdirectory() is called on it. + +function(threadx_add_riscv_port) + cmake_parse_arguments(RISCV "" "SRC_DIR;INC_DIR;EXAMPLE_DIR" "" ${ARGN}) + + if(NOT RISCV_SRC_DIR) + message(FATAL_ERROR "threadx_add_riscv_port: SRC_DIR is required") + endif() + if(NOT RISCV_INC_DIR) + message(FATAL_ERROR "threadx_add_riscv_port: INC_DIR is required") + endif() + + target_sources(${PROJECT_NAME} + PRIVATE + # {{BEGIN_TARGET_SOURCES}} + ${RISCV_SRC_DIR}/tx_initialize_low_level.S + ${RISCV_SRC_DIR}/tx_thread_context_restore.S + ${RISCV_SRC_DIR}/tx_thread_context_save.S + ${RISCV_SRC_DIR}/tx_thread_interrupt_control.S + ${RISCV_SRC_DIR}/tx_thread_schedule.S + ${RISCV_SRC_DIR}/tx_thread_stack_build.S + ${RISCV_SRC_DIR}/tx_thread_system_return.S + ${RISCV_SRC_DIR}/tx_timer_interrupt.S + # {{END_TARGET_SOURCES}} + ) + + target_include_directories(${PROJECT_NAME} + PUBLIC + ${RISCV_INC_DIR} + ) + + if(RISCV_EXAMPLE_DIR AND + EXISTS ${RISCV_EXAMPLE_DIR}/CMakeLists.txt) + add_subdirectory(${RISCV_EXAMPLE_DIR}) + endif() +endfunction() |
